Crates.io | ds-rom |
lib.rs | ds-rom |
version | 0.4.1 |
source | src |
created_at | 2024-07-19 11:33:24.426374 |
updated_at | 2024-11-08 20:14:28.709077 |
description | Library for extracting/building Nintendo DS ROMs. |
homepage | |
repository | https://github.com/AetiasHax/ds-rom |
max_upload_size | |
id | 1308547 |
size | 242,747 |
Library for extracting and building matching Nintendo DS ROMs. DSi/DSiware not supported yet.
ds-rom
has two representations of the ROM: raw and plain. To extract files from a ROM, it first reads the raw ROM, with the exact byte-for-byte content of the ROM file. Then, the plain ROM can extract all the components out of the raw ROM. Lastly, the plain ROM can be saved to files on disk.
use ds_rom::{rom::{raw, Rom}};
let raw_rom = raw::Rom::from_file("mygame.nds")?;
let rom = Rom::extract(&raw_rom)?;
rom.save("mygame_extracted/", None)?;
[!IMPORTANT] If the raw ROM is encrypted, you must pass an encryption key to
Rom::save
in place of theNone
value. See an example of this here.
Building a ROM is exactly the opposite of extracting. ds-rom
starts by loading a plain ROM from files on disk, the same files generated by Rom::save
. Then, the raw ROM can be built and saved as a single ROM file.
use ds_rom::rom::Rom;
let rom = Rom::load("mygame_extracted/", None)?;
let raw_rom = rom.build(None)?;
raw_rom.save("mygame_rebuilt.nds")?;
[!IMPORTANT] If the ROM is encrypted, you must pass an encryption key to
Rom::load
and optionallyRom::build
in place of theNone
value. See an example of this here.
(It is optional forRom::build
as it is only for computing a CRC checksum in the ROM header.)You can configure whether a ROM should be encrypted by editing the YAML files inside the extraction directory.
ds-rom
is also available as a CLI, and you can download the latest release here. Use dsrom --help
for a list of subcommands.