Repacking 3DS roms

Discussion in '3DS - Flashcards & Custom Firmwares' started by piratesephiroth, Sep 4, 2014.

  1. piratesephiroth
    OP

    piratesephiroth I wish I could read

    Member
    3,017
    1,622
    Sep 5, 2013
    Brazil
    I see Relys included makerom in the 'utilities' archive. (the version in the link is different from the one in his archive, though)
    Then I wonder...
    Is it possible (with publicly available tools) to repack the files into romFS and then repack romFS back into the 3DS rom?
     
  2. Relys

    Relys Master of Computer Science

    Member
    863
    789
    Jan 5, 2007
    United States
    Well, I haven't tried this yet but according to the Wiki: "RomFs hasn't been completely implemented (But valid pre-built romfs can be used as substitute)". This means that we should be able to repackage decrypted romfs. If someone wants to look into decrypting romfs (with my tools), re-encrypting with 00000 keys (which is the format Gateway accepts), building with makerom and running on Gateway that would be a good step.

    I believe a new developer called applestash just started working on proper romfs building. The official makerom utilities from the CTR SDK should be able to build romfs properly.
     
  3. piratesephiroth
    OP

    piratesephiroth I wish I could read

    Member
    3,017
    1,622
    Sep 5, 2013
    Brazil
    Yeah. Now what's a 'prebuilt romfs'? The extracted partition? The rom itself?

    Also I wonder if encryption is really a problem...
    Say we sucessfully modify files and repack a rom. Can't we then just edit the ncchinfo.bin to reflect the new size, generate a new xorpad and use padgen to encrypt it back?
     
  4. kyogre123

    kyogre123 Mexican Pride

    Member
    2,919
    1,261
    Sep 23, 2013
    Mexico
    I have the SDK. I wish I would know where to start to at least rebuild a romFS.
     
  5. CollosalPokemon

    CollosalPokemon ばん。。。かい

    Member
    682
    342
    Oct 18, 2009
    United States

    neimod's ctrtool's source code is actually a good place to look at how the RomFS is structured since it can deconstruct RomFS'. 3DSGuy's (not completely finished) RomFS rebuilding code is also useful to figure out how to rebuild the RomFS.

    After using your decryption tools, I made tools to help me rebuild games although I still have to do some manual edits. I rebuilt some RomFS' and games with the zeroes key. It works nicely with Gateway. I'm glad gateway included a game dumping feature since I don't want to get games from shady sources.
    It would be nice if Gateway would enable the no-encryption flag in the NCCH header for roms. It seems to currently not be allowed for executable content (ie the NCCH 0)...not sure about different indexes but the important one would be index 0.
     
    loco365 likes this.
  6. Relys

    Relys Master of Computer Science

    Member
    863
    789
    Jan 5, 2007
    United States
    Please make a tutorial and share tools! :D I only have so much time to work on these kinds of things.
     
    piratesephiroth likes this.
  7. dubbz82

    dubbz82 GBAtemp Advanced Maniac

    Member
    1,512
    815
    Feb 2, 2014
    United States
    Sorry if I come off like somewhat of an idiot, but what would prevent us from enabling no-encryption flag in the header for roms, and then using something like a launcher.dat to point straight to the 3ds file and load it, or am I missing something?
     
  8. CollosalPokemon

    CollosalPokemon ばん。。。かい

    Member
    682
    342
    Oct 18, 2009
    United States
    My tools aren't public-release ready since I lazily threw them together this weekend, but anyone who researches the rom format on 3dbrew should at least be able to re-encrypt roms with the zeroes key currently.
    researching 3dsguy's (incomplete) romfs builder and neimod's romfs unpacker is useful as well.

    the flag that disables encryption doesn't mean that you can load things like you said. all it means is that you can use decrypted (ExHeader, AcHeader, ExeFS, RomFS) in the target rom instead of encrypted ones, but NCCH 0 seems to be banned from using that flag.
    it's not necessary since the zeroes key works fine and it's easy to decrypt stuff with a known key, but not having to encrypt anything would make things a little bit easier.
     
    cearp likes this.