ndstrim
is a program to trim the excess padding space found in Nintendo DS(i) ROMs, created as a
project to familiarize myself with Rust.
It takes into account whether a game bundles a RSA certificate in order for Download Play functionality to work, and preserves it while trimming the excess space from the ROM file.
ndstrim
can trim any amount of files in a single run. To execute it, use:
ndstrim foo.nds bar.nds baz.nds
This will produce three files called foo.trim.nds
, bar.trim.nds
and baz.trim.nds
in
the same directory as the original ROM files.
You can optionally provide a custom extension to use in place of trim.nds
by passing the -e
flag. Ensure that the extension you provide contains no leading dot.
If you don't care about preserving the original ROMs, you can run:
ndstrim -i foo.nds bar.nds baz.nds
This will trim the files in-place, and is irreversible.
If you want to check what ndstrim
would do, you can use:
ndstrim -s foo.nds bar.nds baz.nds
This option can be combined with -i
.
Launching ndstrim
without arguments will display a brief usage message, but you can get a more
helpful one by passing the -h
flag.
Building ndstrim
is a straightforward process that can be done using cargo
.
For a debug build, run:
cargo b
For a release build, which produces an optimized and stripped binary with full LTO, run:
cargo b --release
On Windows, it might happen that Defender quarantines the prebuilt .exe as a malware. Likewise, some VirusTotal engines may flag the binary, even if sandbox analysis shows that the file is clean.
This is a false positive, most likely triggered by the use of UPX to minify the binary's size.
If you don't trust the binary, however, you can always review the source and build ndstrim
on
your system by following the instructions above.
This program is based on an adaptation of the trimming algorithm included in GodMode9.
Additionally, to validate NDS ROMs, it adapts the CRC-16 algorithm included in TWiLightMenu.
This program is licensed under the terms of the MIT license.
See LICENSE.txt for further info.