NDSFactory

From GameBrew
Revision as of 01:09, 10 October 2023 by HydeWing (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
NDSFactory
Ndsfactory.png
General
AuthorLuca1991
TypeOther PC Utilities
Versionautobuild
LicenseGPL-3.0
Last Updated2022/11/17
Links
Download
Website
Source
Support Author

NDSFactory is a tool to unpack & repack Nintendo DS ROMs (.nds)

About

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.

Basically an NDS software is composed of the following sections:

  • 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.)

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.

Screenshots

Ndsfactory.png

Usage

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.)

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).

Fat Patching Tab

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

  • 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

autobuild Feat/fat decoding (#14)

  • 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)

  • First Release.

Thanks

  • Special thanks to Antonio Barba & Davide Trogu

External links

Advertising: