Nintendo DS ROM API

Discussion in 'NDS - Emulation and Homebrew' started by JackHack96, Jul 21, 2015.

  1. JackHack96
    OP

    JackHack96 Newbie

    Newcomer
    2
    0
    Jul 19, 2015
    Italy
    Hi :)
    I'm developing a program for Pokémon ROMs, and after I wrote the API for reading the ROM, I have to deal with the reversed process, in other words I have to write the ROM.
    I tried to write an API, but it generates corrupted files :(

    Does anyone know some open-source programs that allow to write a ROM (apart from ndstool, which is difficult for a student like me :( )?
    Or a program which has an API for writing a ROM?
     
  2. CTurt

    CTurt Advanced Member

    Member
    73
    102
    May 3, 2015
    What is your ultimate goal? Because, programs such as dslazy already exist which can simplify the process of unpacking and repacking DS ROMs with ndstool. Unless you just want to do this for learning, I would recommend avoiding writing your own tool.

    With that said, "corrupt" is a very broad term, anything could be wrong: CRCs, offsets, lengths, etc.

    I suggest you try unpacking and repacking some simple homebrew games first, because many don't have a filesystem, and so will just contain the header and ARM 7 and ARM 9 binaries.

    If your application doesn't work for simple homebrews, you should look at the difference between the files in a hex editor and see what changed during the process.

    If you still need help, you should upload the source code of your generator, and explain more details about what exactly is corrupt with your new ROMs. If you're using C, I would be happy to take a look at your project.

    Here are some resources that may help you:

    http://libnds.devkitpro.org/structsNDSHeader.html
    http://dsibrew.org/wiki/NDS_Format
    http://imrannazar.com/The-Smallest-NDS-File

    Regarding ndstool, it's pretty much the standard for doing this. If you don't understand the source code, you should ask what in particular you don't understand. Because alternatives are likely to be very similar anyway.
     
    Last edited by CTurt, Jul 21, 2015
  3. JackHack96
    OP

    JackHack96 Newbie

    Newcomer
    2
    0
    Jul 19, 2015
    Italy
    Thanks a lot for replying :D
    I'll try to explain me better. I'm developing an application which can edit pokémon games. As for reading the ROMs I have no problems (I can also decompress ARM9).
    The application works like this:
    1. It loads the ROM and it stores it in the RAM as a tree of folders and files
    2. The user edits the ROM, and the various changes he makes are stored in the RAM
    3. The program should take the ROM which is stored in the RAM and write it in the hard disk, and here comes the problem
    I have absolutely no problems to publish the source code, because I intend to make the program open-source. But it's not written in C, it's written in Java.
    Here is the API that should take care of the ROM, take a look at NitroFS class (if you understand Java)
     

    Attached Files: