Toolkit for decompiling DS games, dsd for short.
Join the discussion in the #dsd channel of our Discord server!
- Automate decomp project setup with zero user input, saving months of manual setup time.
- Allow developers to easily delink code into individual translation units and to quickly give names to symbols.
- Generate linker scripts with correct link order.
- Integrate with other decompilation tools, including objdiff.
Extracts a DS ROM into separate files for code and assets.
$ dsd rom extract --rom path/to/rom.nds --output-path path/to/extract/Options:
-r,--rom: Path to ROM file.-7,--arm7-bios: Path to ARM7 BIOS file, needed for decryption.-o,--output-path: Path to extract directory.
Builds a DS ROM from an extract directory.
$ dsd rom build --config path/to/extract/config.yaml --rom path/to/built_rom.ndsOptions:
-c,--config: Path toconfig.yamlin the extract directory.-7,--arm7-bios: Path to ARM7 BIOS file, needed for encryption.-o,--rom: Path to ROM file.
Creates a ds-rom configuration to build a ROM from linked binaries.
$ dsd rom config --elf path/to/final_link.o --config path/to/config.yamlOptions:
-e,--elf: Path to the final linked ELF file, generated by the LCF and the linker.-c,--config: Path toconfig.yamlgenerated byinit.
Initialize a new dsd configuration from a given extract directory generated by rom extract. This will analyze the code and generate config files.
$ dsd init --rom-config path/to/extract/config.yaml --output-path path/to/output/ --build-path path/to/build/Options:
-r,--rom-config: Path toconfig.yamlin the extract directory.-o,--output-path: Output path fordsdconfig files.-d,--dry: Dry run, only perform analysis but don't write any files.-b,--build-path: Output path for delinks and the LCF.
Delinks the game into relocatable ELF files. The output directory is determined by delinks_path in config.yaml.
$ dsd delink --config-path path/to/config.yamlOptions:
-c,--config-path: Path toconfig.yamlgenerated byinit.
Disassembles the game into assembly files. Used for informational purposes, doesn't target a specific assembler.
$ dsd dis --config-path path/to/config.yaml --asm-path path/to/asm/Options:
-c,--config-path: Path toconfig.yamlgenerated byinit.-a,--asm-path: Output path for assembly files.
Generates an objdiff configuration.
$ dsd objdiff --config-path path/to/config.yamlOptions:
-c,--config-path: Path toconfig.yamlgenerated byinit.-o,--output-path: Path to directory to generateobjdiff.json.--stdout: Print to stdout instead of writing to a file.-s,--scratch: Include decomp.me scratches.-C,--compiler: Name of compiler in decomp.me, see https://decomp.me/api/compiler for compilers for thends_arm9platform.-f,--c-flags: Compiler flags, as a single string.-p,--preset-id: Preset ID to use in decomp.me.-m,--custom-make: Custom build command forobjdiff.-M,--custom-args: Arguments to custom build command. Can be passed multiple times to append more arguments.
Generates a linker command file (LCF) for mwldarm.
$ dsd lcf --config-path path/to/config.yaml --lcf-file path/to/linker_script.lcf --objects-file path/to/objects.txtOptions:
-c,--config-path: Path toconfig.yamlgenerated byinit.-l,--lcf-file: Output path to LCF file.-o,--objects-file: Output path to objects list, to be passed to the linker.
Meant to be used by build systems. Outputs a JSON-formatted object containing information about which files delink generates and files needed for linking.
$ dsd json delinks --config-path path/to/config.yamlOptions:
-c,--config-path: Path toconfig.yamlgenerated byinit.
Verifies that built modules are matching the base ROM.
$ dsd check modules --config-path path/to/config.yamlOptions:
-c,--config-path: Path toconfig.yamlgenerated byinit.-f,--fail: Return failing exit code if a module doesn't pass the checks.
Verifies that all symbols from every symbols.txt file exist in the final linked ELF file.
$ dsd check symbols --config-path path/to/config.yaml --elf-path path/to/final_link.oOptions:
-c,--config-path: Path toconfig.yamlgenerated byinit.-e,--elf-path: Path to the final linked ELF file, generated by the LCF and the linker.-f,--fail: Return failing exit code if a symbol didn't match.
Applies symbol data from the final linked ELF to symbols.txt files.
$ dsd apply --config-path path/to/config.yaml --elf-path path/to/final_link.oOptions:
-c,--config-path: Path toconfig.yamlgenerated byinit.-e,--elf-path: Path to the final linked ELF file, generated by the LCF and the linker.-d,--dry: Dry run, do not write to any files.-v,--verbose: Verbose output.
Searches for a function using a signature. If found, the functions and its related objects get renamed.
$ dsd sig spply --config-path path/to/config.yaml --allOptions:
-c,--config-path: Path toconfig.yamlgenerated byinit.-s,--signature: Name of signature to apply.-a,--all: Apply all known signatures.-d,--dry: Dry run, do not write to any files.
Lists all known signatures that can be applied with sig apply
$ dsd sig listFormats configs associated with the given config.yaml file.
- Sections in
delinks.txtare sorted by address. - Delink files in
delinks.txtare sorted by link order. - Symbols in
symbols.txtare sorted by address. - Relocations in
relocs.txtare sorted by source address.
$ dsd format --config-path path/to/config.yamlOptions:
-c,--config-path: Path toconfig.yamlgenerated byinit.
Compares two dsd projects and generates a YAML file of diff actions. See diff apply for applying diff actions.
This subcommand can be used to bring improved analysis results of newer dsd versions to old dsd projects. It's recommended to pass all the --skip-* options when doing so, as it will exclude many regressive diff actions.
$ dsd diff new --config-before path/to/old/config.yaml --config-after path/to/new/config.yamlOptions:
-1,--config-before: Path toconfig.yamlgenerated byinitfor the first project.-2,--config-after: Path toconfig.yamlgenerated byinitfor the second project.-o,--output-path: Path to diff output file, defaults todsd_diff.yaml.--skip-files: Skips diff actions that affect delink files.--skip-default-names: Skips diff actions that rename symbols to their default names.--skip-broadened-relocs: Skips diff actions that add more overlay candidates to ambiguous relocations.--skip-zeroed-addends: Skips diff actions that set a relocation's addend to zero.--skip-globalized-symbols: Skips diff actions that turn a local symbol to global.--skip-sizeless-data: Skips diff actions that removes the explicit size of BSS/data symbols.--skip-ambiguous-symbols: Skips diff actions that add symbols marked withambiguous.
Opens an interactive TUI for applying or rejecting diff actions generated by diff new.
$ dsd diff applyOptions:
-i,--input-path: Path to diff actions YAML file generated bydiff new, defaults todsd_diff.yaml.--all: Skips the interactive TUI and applies all actions.
Controls:
| Key | Description |
|---|---|
| Q | Quit the TUI. |
| Ctrl+C | Force quit the TUI without saving. |
| ↓ (down) | Select next diff action. Hold Ctrl to go faster. |
| ↑ (up) | Select previous diff action. Hold Ctrl to go faster. |
| Home | Select first diff action. |
| End | Select last diff action. |
| 1 | Mark selected diff action as "good". |
| 2 | Mark selected diff action as "bad". |
| 3 | Mark selected diff action as "skipped" (default). |
| ↵ (return) | Apply good actions, discard bad actions, and remove both from the diff actions file. All the skipped actions will remain. |
| J | Scroll the description window down. |
| K | Scroll the description window up. |