[Release] 3DS Simple CIA Converter

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by Riku, Mar 20, 2015.

  1. Riku
    OP

    Riku GBAtemp Regular

    Member
    282
    528
    May 3, 2009
    United States
    After looking at how unnecessarily complicated current CIA converting methods are, I decided to write this tool. It's very simple and doesn't use Python or .NET Framework or any other programs and scripts, just my own code in a single exe file.

    [​IMG]

    I decided to take slightly different approach to keep things simple and only use ExHeader XORpads. They are 1MB each in size and multiple ROM files supported during 'ncchinfo.bin' creation, so you can make xorpads for a bunch of games in one go. With version 4.0 I added ability to patch minimum required kernel version (FW Spoof) and 'RegionFree', which requires *.exefs_norm.xorpad's. 'FW Spoof' function checks FW version game requires to run and only applied if original value exceeds entered (2D02:FW8.0-8.1, 2E02:FW9.0-9.2, 3002:FW9.3, 3102:FW9.5, 3202:FW9.6-9.8).

    1) Put your 3DS games into 'roms' folder and press 'Create ncchinfo.bin file' button to create 'ncchinfo.bin' from 3DS ROMs.

    2) Use rxTools along with created 'ncchinfo.bin' to generate ExHeader XORpads, put it in root of SD card, launch rxTools and follow 'Decryption Options-->Generate Xorpads'. At the end of process you may see 'Could not open SDinfo.bin!' message. It's okay, just ignore it.

    3) Put *.xorpad files you generated on 3DS from SD root into 'xorpads' folder, press 'Convert 3DS ROM to CIA' button, select folder with *.3ds files and wait for program to finish.

    >>> Detailed guide with pictures <<<

    UPDATE (2015-07-03)
    Version 4.3 is out

    Changelog:
    • Added zero-key encrypted ROM support, no xorpad required.
    • Added error skip so program doesn't stop converting remain files.
    • Added application Major version writing into TMD.
    Previous changelog
     

    Attached Files:

    Last edited by Riku, Jan 12, 2016


  2. cearp

    cearp the ticket master

    Member
    7,480
    4,712
    May 26, 2008
    Tuvalu
    thank you for this! not for myself, but for all the people who have trouble with the dirty cia conversion :)
    rsf files are evil :)
     
  3. Phytophthora

    Phytophthora Member

    Newcomer
    29
    9
    Apr 17, 2014
    Gambia, The
    Margen67 likes this.
  4. Riku
    OP

    Riku GBAtemp Regular

    Member
    282
    528
    May 3, 2009
    United States
    Possible, yes, but it will break compatibility with '3DS Multi Decryptor', since roxas75 decided to change 'ncchinfo.bin' format. Filenames inside ncchinfo.bin should be in Unicode. Maybe it's a better idea to ask him to fix this?
     
    Margen67 likes this.
  5. Phytophthora

    Phytophthora Member

    Newcomer
    29
    9
    Apr 17, 2014
    Gambia, The
    I don't really understand how all this stuff works but I think Roxas75 is just using this:
    https://github.com/archshift/Decrypt9
    since the '3DS Multi Decryptor' is not working on 9.2 systems?
    correct me if I'm wrong
     
    Margen67 likes this.
  6. zoogie

    zoogie simple pimp tool

    Member
    6,243
    7,904
    Nov 30, 2014
    United States
    His program decrypts games 'in place' so you wouldn't even need an ncchinfo.bin -- it's all plaintext already.
     
    Margen67 likes this.
  7. Riku
    OP

    Riku GBAtemp Regular

    Member
    282
    528
    May 3, 2009
    United States
    I see. I'll change 'ncchinfo.bin' format as soon as he adds 4.5 MSET launching support then.
    And we don't want them decrypted. We need XORpads so we can re-encrypt patched ExHeader back.
     
    Margen67 and Phytophthora like this.
  8. zoogie

    zoogie simple pimp tool

    Member
    6,243
    7,904
    Nov 30, 2014
    United States
    I thought no part of the cia needs to be encrypted. Doesn't the 3ds handle reencryption as part of the import process?
     
    Margen67 likes this.
  9. Riku
    OP

    Riku GBAtemp Regular

    Member
    282
    528
    May 3, 2009
    United States
    That's how my program works. It's designed to make process simple and fast. Transferring ROMs to SD card (some of them ~4GB) and decrypt whole thing (double this size), then transferring it back to PC and basically rebuilding CIA from scratch are not considered simple/fast by me. And, yes, there's multiple layers of encryption involved, import process adds one on top.
     
    Margen67 likes this.
  10. cearp

    cearp the ticket master

    Member
    7,480
    4,712
    May 26, 2008
    Tuvalu
    what titlekey do you use to encrypt with? a friend who told me this method a while ago used hex converted from ascii of Reggie Fils-Aime :D
     
  11. sailor_moon

    sailor_moon Let Me Sing You A Tune ♫

    Newcomer
    87
    26
    Aug 10, 2009
    Crystal Tokyo
    Just wanted to say Thanks for this Tool~ so Thank you very much for making this tool.
     
    Margen67 likes this.
  12. Apache Thunder

    Apache Thunder I have cameras in your head!

    Member
    4,101
    4,024
    Oct 7, 2007
    United States
    Levelland, Texas
    Makerom should support re-encrypting using zero keys as is the standard practice for building custom 3DS files and CIAs. Why not implement this in your scripts? Being able to use rxTools direct decryption method instead of messing with xorpads would make your "simple" cia converter even more simple to use and rxTools pretty much works on all firmware ranges. ;)
     
    Margen67 likes this.
  13. NicEXE

    NicEXE GBAtemp Fan

    Member
    397
    123
    Dec 6, 2009
    Cyprus
    Ok .NET Framework is an unnecessary requirement since people can produce GUI applications on windows without it but no python takes out OS X and *nix users in general.
    Scripts are more desirable (at least for me) since you can launch them practically on every OS and also you can open them and fiddle with them before you launch them.
    When you give out binaries the only way to mess with it is to decompile or disassemble them first.
     
    Margen67 likes this.
  14. Riku
    OP

    Riku GBAtemp Regular

    Member
    282
    528
    May 3, 2009
    United States
    Random one, I guess.

    This way you'll need fully decrypt every game on 3DS first, which means transferring it to SD card (up to 4GB each, again), wait for 3DS to finish decryption (takes a while) and transfer it back to pc. IT. IS. SLOW. My 'ncchinfo.bin' only produce 1MB ExHeader XORpads, other partitions just skipped + it can store info for multiple games. And I can make it support rxTools XORpad maker, but I don't want to loose '3DS Multi Decryptor' compatibility just yet.
     
    Margen67 and cearp like this.
  15. Apache Thunder

    Apache Thunder I have cameras in your head!

    Member
    4,101
    4,024
    Oct 7, 2007
    United States
    Levelland, Texas
    I think the 1mb xorpads named "s" that it creates is perhaps an issue with the particular ncchinfo.py script you are using to gen the ncchinfo file. I recently read that rxTools and perhaps Decrypt9 stores the filenames as unicode in the bin file which the original from the multitool doesn't (or it could be the other way around. I'm not that sure). So if you used the python script form void multitool thing to make the file instead of the one that came with rxTools you would get the bugged xorpad generation with only a 1mb file called "s". That file happens to be whatever the last xorpad it generated was. (since each new one it makes would overwrite the last one due to the bugged filenames)

    EDIT: Yep it's how it stores the file names. I genned the ncchinfo for a game rom with both the old ctrkeygen python script then used the one for rxTools. In a hex editor I can easily tell the difference. Looks like the old script generates the filenames in unicode while the new one doesn't. I would assume Decrypt9 (which rxTool's xorpad generator is based off of) also expects the new format. So just use the ncchinfo generator script that came with rxTools/Decrypt9 instead. ;)
     
    Margen67 likes this.
  16. Riku
    OP

    Riku GBAtemp Regular

    Member
    282
    528
    May 3, 2009
    United States
    Yeah, I'm already aware of this. I'm not using any scripts though, it's my own code. Switching from old unicode name format to rxTools-compatible one is simple. It's just rxTools can't fully replace '3DS Multi Decryptor' now, since you can't launch it via DS Profile and without WiFi connection.
     
    chriseayase and Margen67 like this.
  17. Apache Thunder

    Apache Thunder I have cameras in your head!

    Member
    4,101
    4,024
    Oct 7, 2007
    United States
    Levelland, Texas
    He plans on implementing Cubic Ninja support (and perhaps DS Profile version later) so that might not be true for very long. :D

    For me it doesn't matter. I use my 3DS near my computer all the time, so the internet requirement doesn't bother me. I even went through the trouble of manually updating to 9.2 via CIAs and such to get off the old 4.5 fw. I have no plans on going back. :D
     
    Margen67 likes this.
  18. Asia81

    Asia81 In my Ecchi World <3

    Member
    4,958
    2,452
    Nov 15, 2014
    France
    Albi
    Excuse me, but :
    What the utility of your tool if no Region-Free or firm version patches are supported. ?
     
    Margen67 likes this.
  19. Phytophthora

    Phytophthora Member

    Newcomer
    29
    9
    Apr 17, 2014
    Gambia, The
    So could you just make a second version just for rxTools/Decrypt9 usage besides the '3DS Multi Decryptor' version until rxTools supports DS Profile loading?
     
    Margen67 likes this.
  20. Riku
    OP

    Riku GBAtemp Regular

    Member
    282
    528
    May 3, 2009
    United States
    Generated CIAs are not 4.5CFW-friendly. For now it's more for Gateway users and maybe future CFWs.
    I'm considering this.
     
    Margen67, cearp and Phytophthora like this.