NDSFactory: Difference between revisions

From GameBrew
(Created page with "{{Infobox DS Homebrews |title=NDSFactory |image=ndsfactory.png |description=Unpack & Repack Nintendo DS Roms (.nds). |author=Luca1991 |lastupdated=2022/11/17 |type=Other PC Utilities |version=autobuild |license=GPL-3.0 |download=https://dlhb.gamebrew.org/dshomebrew/ndsfactory.7z |website=https://github.com/Luca1991/NDSFactory |source=https://github.com/Luca1991/NDSFactory |donation=https://ko-fi.com/luca91 }} {{#seo: |title= (Other PC Utilities) - GameBrew |title_mode=ap...")
 
No edit summary
Line 6: Line 6:
|lastupdated=2022/11/17
|lastupdated=2022/11/17
|type=Other PC Utilities
|type=Other PC Utilities
|version=autobuild
|version=2022.11.17
|license=GPL-3.0
|license=GPL-3.0
|download=https://dlhb.gamebrew.org/dshomebrew/ndsfactory.7z
|download=https://dlhb.gamebrew.org/dshomebrew/ndsfactory.7z
Line 19: Line 19:
|image_alt=NDSFactory
|image_alt=NDSFactory
}}
}}
NDSFactory is a tool to unpack & repack Nintendo DS ROMs (.nds)
This tool, NDSFactory, makes it easy to unpack and repack Nintendo DS ROMs, but it requires some prior knowledge. Here's a breakdown of the different sections in an NDS software:


==About==
*Header
This software, NDSFactory, is designed to simplify the process of unpacking and repacking Nintendo DS roms. However, it is important to note that some prior knowledge is required.  
*ARM9 Binary
*ARM7 Binary
*FNT (Filename Table)
*FAT (File Allocation Table)
*ARM9/ARM7 Overlay (Optional)
*ARM9/ARM7 Overlay Files (Optional)
*Icon/Title Logo
*FAT Files (The actual files used by the software, like graphics, music, etc.)


Basically an NDS software is composed of the following sections:
With NDSFactory, you can extract these sections, modify them using your preferred method, and then rebuild the ROM with your edited sections. If the modified sections are larger than the original ones, you can specify their new physical address and size in the header. However, make sure they don't overlap, and remember to PATCH THE FAT.BIN (see usage).


* Header
This software is particularly useful for those interested in modding their games or creating trainers for them.
* ARM9 Binary
* ARM7 Binary
* FNT (Filename Table)
* FAT (File Allocation Table)
* ARM9/ARM7 Overlay (Optional)
* ARM9/ARM7 Overlay Files (Optional)
* Icon/Title Logo
* FAT Files (The actual files used by the software, like Graphics, Music etc.)


If the modified sections are larger than the original ones, you can specify their new physical address and size in the header. It is crucial to ensure that they do not overlap and to patch the FAT.BIN accordingly. This software is particularly useful for those interested in game modding or creating trainers.
==User guide==
===Unpacker Tab===
Load your Nintendo DS software (.nds) in the unpacker tab.


==Screenshots==
Extract the ROM sections, including individual FAT files.
[[image:ndsfactory.png|640px]]


==Usage==
Note the Original Address of the FAT Files; you'll need this value later if you plan to alter addresses and sizes of the sections.
===Unpacker Tab===
In the unpacker tab you can load your Nintendo DS software (.nds) and then you can extract the ROM sections, including the individual FAT files. Please note the Original Address of the FAT Files, you will need this value later if you are going to alter the addresses and size of the sections.


'''You can then do what you want with these sections (inject code, apply patches etc.)'''
Perform modifications on these sections (inject code, apply patches, etc.).


===Packer Tab===
===Packer Tab===
In the packer tab you can re-create an .nds file using your edited sections. If your sections are bigger than the originals, you have to edit their addresses and size (in the header). '''Make sure that the addresses don't overlap, or the final rom will be broken'''. If you are repacking edited sections, and the FAT Files Address is different than the original one, '''make sure to patch the FAT (fat.bin)''': the FAT is a list of absolute addresses (representing each file start address and end address), so you need to update them (you can easily do this using the FAT Patching Tab).
In the packer tab, recreate an .nds file using your edited sections.


===Fat Patching Tab===
If your edited sections are larger than the originals, edit their addresses and sizes in the header.
In this tab you can easily patch the FAT section (fat.bin). You have to do this only if the FAT Files (fat_data.bin) final address is different than the original one. Patching the FAT is easy, all you have to do is load your fat.bin, and fill the original address and the new address of fat_data.bin. This will produce a patched fat.bin that you can use in the packing process.


==Known Limitations/Possible Future Features/Bugs==
Ensure addresses don't overlap to avoid breaking the final ROM.
* Add support for roms with OVERLAY
* Add support to rebuild a new fat_data.bin and fat.bin from a set of files inside a directory
* Design a nice logo/icon
* If you found a bug, feel free to open an issue:)


==Changelog==
If repacking edited sections, and the FAT Files Address is different from the original, patch the FAT (fat.bin). The FAT is a list of absolute addresses (representing each file's start and end addresses). Use the FAT Patching Tab for this.
'''autobuild'''
Feat/fat decoding (#14)


* First step in implementing FAT file decoding : brute-force extraction without FNT lookup.
===Fat Patching Tab===
Load your fat.bin.


The FAT alone contains enough information to extract every file in a
Fill in the original address and the new address of fat_data.bin.
folder chosen by the user. However, reference to the file name table
(FNT) is needed to restore the files' names and the directory structure
(and avoid dumping useless data that may be left over in the data
section).


This commit only implements the dumping of all data by incrementing
This produces a patched fat.bin for use in the packing process.
through the FAT and writing every section marked by a FAT range into a
separate file, giving them incremental names.


The next commit will use the FNT to name them properly.
Remember, patching the FAT is necessary only if the FAT Files (fat_data.bin) final address differs from the original one.


* Proper FAT decoding : FNT lookup and directory structure
===Limitation===
(2022/11/17) ROMs with overlay are currently not supported.


Code comments explain the algorithm (which was understood thanks to the
==Screenshots==
wonderfully simple "FNT-Tool" script at :  
[[image:ndsfactory.png|640px]]
https://github.com/RoadrunnerWMC/FNT-Tool) ; the implementation is more
or less a C++ port of the Python code.


Everything may still be a little dirty, but it works !
==Changelog==
'''Feat/fat decoding (#14) 2022/11/17'''
* First step in implementing FAT file decoding : brute-force extraction without FNT lookup.
** The FAT alone contains enough information to extract every file in a folder chosen by the user. However, reference to the file name table (FNT) is needed to restore the files' names and the directory structure (and avoid dumping useless data that may be left over in the data section).
** This commit only implements the dumping of all data by incrementing through the FAT and writing every section marked by a FAT range into a separate file, giving them incremental names. The next commit will use the FNT to name them properly.
* Proper FAT decoding : FNT lookup and directory structure.
** Code comments explain the algorithm (which was understood thanks to the wonderfully simple "FNT-Tool" script at: https://github.com/RoadrunnerWMC/FNT-Tool) ; the implementation is more or less a C++ port of the Python code. Everything may still be a little dirty, but it works!


'''(v.1.0)'''
'''v.1.0 2019/09/13'''
* First Release.
* First Release.
*UPDATE 06 Dec 2020: rebuilt Windows version using msvc2019 (instead of mingw version of gcc). This should fix issue [https://github.com/Luca1991/NDSFactory/issues/1 #1].
==Credits==
Developed with love by Luca D'Amico.


==Thanks==
Special thanks to Antonio Barba & Davide Trogu.
*Special thanks to Antonio Barba & Davide Trogu


== External links ==
== External links ==
* Github - https://github.com/Luca1991/NDSFactory
* GitHub - https://github.com/Luca1991/NDSFactory

Revision as of 11:32, 2 February 2024

NDSFactory
Ndsfactory.png
General
AuthorLuca1991
TypeOther PC Utilities
Version2022.11.17
LicenseGPL-3.0
Last Updated2022/11/17
Links
Download
Website
Source
Support Author

This tool, NDSFactory, makes it easy to unpack and repack Nintendo DS ROMs, but it requires some prior knowledge. Here's a breakdown of the different sections in an NDS software:

  • Header
  • ARM9 Binary
  • ARM7 Binary
  • FNT (Filename Table)
  • FAT (File Allocation Table)
  • ARM9/ARM7 Overlay (Optional)
  • ARM9/ARM7 Overlay Files (Optional)
  • Icon/Title Logo
  • FAT Files (The actual files used by the software, like graphics, music, etc.)

With NDSFactory, you can extract these sections, modify them using your preferred method, and then rebuild the ROM with your edited sections. If the modified sections are larger than the original ones, you can specify their new physical address and size in the header. However, make sure they don't overlap, and remember to PATCH THE FAT.BIN (see usage).

This software is particularly useful for those interested in modding their games or creating trainers for them.

User guide

Unpacker Tab

Load your Nintendo DS software (.nds) in the unpacker tab.

Extract the ROM sections, including individual FAT files.

Note the Original Address of the FAT Files; you'll need this value later if you plan to alter addresses and sizes of the sections.

Perform modifications on these sections (inject code, apply patches, etc.).

Packer Tab

In the packer tab, recreate an .nds file using your edited sections.

If your edited sections are larger than the originals, edit their addresses and sizes in the header.

Ensure addresses don't overlap to avoid breaking the final ROM.

If repacking edited sections, and the FAT Files Address is different from the original, patch the FAT (fat.bin). The FAT is a list of absolute addresses (representing each file's start and end addresses). Use the FAT Patching Tab for this.

Fat Patching Tab

Load your fat.bin.

Fill in the original address and the new address of fat_data.bin.

This produces a patched fat.bin for use in the packing process.

Remember, patching the FAT is necessary only if the FAT Files (fat_data.bin) final address differs from the original one.

Limitation

(2022/11/17) ROMs with overlay are currently not supported.

Screenshots

Ndsfactory.png

Changelog

Feat/fat decoding (#14) 2022/11/17

  • First step in implementing FAT file decoding : brute-force extraction without FNT lookup.
    • The FAT alone contains enough information to extract every file in a folder chosen by the user. However, reference to the file name table (FNT) is needed to restore the files' names and the directory structure (and avoid dumping useless data that may be left over in the data section).
    • This commit only implements the dumping of all data by incrementing through the FAT and writing every section marked by a FAT range into a separate file, giving them incremental names. The next commit will use the FNT to name them properly.
  • Proper FAT decoding : FNT lookup and directory structure.
    • Code comments explain the algorithm (which was understood thanks to the wonderfully simple "FNT-Tool" script at: https://github.com/RoadrunnerWMC/FNT-Tool) ; the implementation is more or less a C++ port of the Python code. Everything may still be a little dirty, but it works!

v.1.0 2019/09/13

  • First Release.
  • UPDATE 06 Dec 2020: rebuilt Windows version using msvc2019 (instead of mingw version of gcc). This should fix issue #1.

Credits

Developed with love by Luca D'Amico.

Special thanks to Antonio Barba & Davide Trogu.

External links

Advertising: