[Release] .Net 3DS Toolkit - Extract and Repack 3DS ROMs (and CIAs)

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by evandixon, Oct 8, 2016.

  1. evandixon
    OP

    evandixon PMD Researcher

    Member
    1,652
    775
    May 29, 2009
    United States
    Ever notice how the majority of command-line applications require about a dozen commands for a single logical operation? This tool aims to fix that! ROMs can be extracted and repacked with a single command per operation, like so:

    To extract:
    Code:
    ToolkitConsole.exe MyRom.3ds RawFiles
    To repack as a CIA:
    Code:
    ToolkitConsole.exe RawFiles Repacked.cia
    To repack as a 0-key encrypted CCI (for use with Gateway):
    Code:
    ToolkitConsole.exe RawFiles Repacked.3ds -key0
    OR
    ToolkitConsole.exe RawFiles Repacked.3dz
    
    Note: 3dz files will be invalid until a private header is applied.

    To repack as a decrypted CCI (for use with Citra or Decrypt9):
    Code:
    ToolkitConsole.exe RawFiles Repacked.3ds
    To repack for HANS:
    Code:
    ToolkitConsole.exe RawFiles G:/ MyHack
    A GUI is available for anyone who doesn't want to bother with console commands. A .Net 4.6 code library is available for .Net developers making their own programs. See GitHub for library usage. Latest package will be on Sky Editor's MyGet feed and may be added to NuGet at some point.

    System requirements:
    • .Net Framework 4.6
    • Free space on the system drive. Cleanup happens as soon as possible, but especially for larger ROMs, you may need several GB free.

    Supported formats for extraction:
    • Decrypted CCI (aka .3DS)
    • Decrypted CXI (what Braindump gives you)
    • Decrypted CIA
    • NDS ROM

    Supported formats for building:
    • Decrypted CCI (aka .3DS)
      • For use with Citra
      • Can be used for Gateway and Sky 3DS (with CFW) if encrypted using Decrypt9
    • 0-Key Encrypted CCI
      • For use with Gateway
    • CIA
      • For use with CFW
    • HANS RomFS, Code.Bin, and Homebrew Launcher Shortcut
    • NDS ROM

    Planned Features:
    • Copy private header to 0-key encrypted CCI files as they are built. Until this is done, any *.3dz files created are invalid until a private header is added.

    Credits:
    • SciresM for 3DS Builder (modified to use command-line arguments)
    • profi200 for Project_CTR's makerom
    • dnasdw for 3dstool
    • Asia81 for HackingToolkit3DS, which provided the usage for 3dstool.

    Release Page
    GitHub
     
    Last edited by evandixon, Dec 5, 2016


  2. evandixon
    OP

    evandixon PMD Researcher

    Member
    1,652
    775
    May 29, 2009
    United States
    Updated to version 1.1.0.

    Notable changes:
    • Decrypted CXI files can be extracted (this includes files made using Braindump)
    • HANS files and shortcut can be made
    • Simplified library usage
     
    FlappyFalco and Nanquitas like this.
  3. Nanquitas

    Nanquitas GBAtemp Addict

    Member
    2,042
    1,666
    Sep 29, 2015
    France
    South of France :)
    Great work ! Will be loved by modders :)
     
    FlappyFalco likes this.
  4. pikatsu

    pikatsu GBAtemp Advanced Fan

    Member
    721
    123
    Apr 16, 2014
    Argentina
    Nice tool. Could you make a gui to make it easier?
     
  5. evandixon
    OP

    evandixon PMD Researcher

    Member
    1,652
    775
    May 29, 2009
    United States
    Good idea.

    Here's what the GUI will look like:
    [​IMG]
    [​IMG]
    [​IMG]

    I'll need a little time to make everything functional, but because the code library is almost as easy to use as the console, it shouldn't take too long.
     
  6. LinkSoraZelda

    LinkSoraZelda GBAtemp Advanced Maniac

    Member
    1,970
    617
    Aug 12, 2015
    United States
    Land of the Rising Orange
    Really hyped for .CIA extractor. Asia's toolkit doesn't work for me, and neither does ctrtool. Hopefully this does.
     
    RosaliinaDaHacker64 likes this.
  7. pikatsu

    pikatsu GBAtemp Advanced Fan

    Member
    721
    123
    Apr 16, 2014
    Argentina
    Nice gui with nice features. So double nice!
     
  8. Asia81

    Asia81 In my Ecchi World <3

    Member
    4,844
    2,340
    Nov 15, 2014
    France
    Albi
    @UniqueGeek Do you think, after your, you could also do for me a GUI version for mine?
    I already tried something, but I don't have any C knowledge...
     
  9. Nanquitas

    Nanquitas GBAtemp Addict

    Member
    2,042
    1,666
    Sep 29, 2015
    France
    South of France :)
    Do not do a gui in C. It's troublesome, especially when there easier options such as C#.

    You can easily create a nice gui with C# in Visual Studio. :)
     
    Sasori and gnmmarechal like this.
  10. evandixon
    OP

    evandixon PMD Researcher

    Member
    1,652
    775
    May 29, 2009
    United States
    Probably not, since mine is a code library made for use with other programs. The console is simply a way to easily test it (and I later realized that it's useful in its own right), and the GUI is coming because it was requested and because it is trivial to make. Making a GUI for HackingToolkit3DS would either require a rewrite of the batch file, or a lot of interfacing with the console. The GUI I'm working on does not actually interact with the console, it will instead call the code library.
    Or VB.Net, like mine. (Totally not biased or anything :P )
     
  11. Nanquitas

    Nanquitas GBAtemp Addict

    Member
    2,042
    1,666
    Sep 29, 2015
    France
    South of France :)
    Indeed VB.net is also a possibility.

    Depends on the preference of the dev.
    Anyway, using Visual Studio and a Net language for creating a gui is pretty easy. :)
     
  12. evandixon
    OP

    evandixon PMD Researcher

    Member
    1,652
    775
    May 29, 2009
    United States
    I added the GUI and even had time to get to CIA extraction. I dumped a cartridge to cia using Decrypt9, extracted it, and repacked it for my Gateway, and it worked.
    https://github.com/evandixon/DotNet3dsToolkit/releases/tag/1.2.0

    I didn't test it as much as I would like to have tested it (I'm out of time and have to temporarily rejoin the outside world), so it's marked as a pre-release, but it will probably™ work. I'm out of time, so I'll test it a little more in a few hours days. If anyone wants to give it a try in the mean time, please let me know what you think.
     
    Last edited by evandixon, Oct 24, 2016
    I pwned U! and Nanquitas like this.
  13. AnalogMan

    AnalogMan sumoCheatMenu Dev

    Member
    1,296
    757
    Apr 20, 2007
    United States
    Worked great for me. I used a CIA downloaded with encrypted title key, deep decrypted it with Decrypt9, extracted it with your tool, modified the RomFS, re-packed it, re-encrypted it and installed it.

    I also took a .3DS file and unpacked it, modded it, re-packed it and then couldn't test it since my Sky3DS would not let me write it even after updating the SHA1 in the template file :/ But it seems to have worked as intended. Last thing I need to test is dumping from SD -> CIA, then deep decrypting it and testing.
     
    Last edited by AnalogMan, Oct 24, 2016
  14. pikatsu

    pikatsu GBAtemp Advanced Fan

    Member
    721
    123
    Apr 16, 2014
    Argentina
    Tested a created cia and a build for Citra and both worked. Thanks
     
  15. evandixon
    OP

    evandixon PMD Researcher

    Member
    1,652
    775
    May 29, 2009
    United States
    Updated to 1.3.0. This release adds NDS ROM support while not significantly altering the usage. Now tools can extract and NDS and 3DS ROMs without altering anything but the file extension.

    NDS extraction uses my own code which runs much faster than ndstool. How much faster will likely depend on how beefy your computer is. On my laptop, it runs about 10x faster. Ndstool is still used for building, both because I haven't implemented building, but also ndstool runs pretty quickly for building, so I don't think it's worth writing it myself.
     
  16. AnalogMan

    AnalogMan sumoCheatMenu Dev

    Member
    1,296
    757
    Apr 20, 2007
    United States
    This is great. The only issue I've had is when using the GUI to build a CIA it finishes without displaying any errors if the build fails due to lack of memory. Needed to try building it with the command line tool to see the error.
     
  17. evandixon
    OP

    evandixon PMD Researcher

    Member
    1,652
    775
    May 29, 2009
    United States
    If the GUI doesn't show an error, it was a problem with one of the background processes. There should be a file called "LatestLog.txt" which contains the output of all the background processes (but unfortunately doesn't mark which line goes with which program; the console does). Could you take a look to see if there's any errors listed there?
     
  18. AnalogMan

    AnalogMan sumoCheatMenu Dev

    Member
    1,296
    757
    Apr 20, 2007
    United States
    It seems to only have the logs of the latest thing I did and that was a while ago. I'm running it on a VM and just upped the allocated memory. The GUI would show the loading bar then it would display Ready but no output file was found. Did it three times thinking it may have been the file name, location, etc. Then ran the command line and it gave the error that there was low memory. Fixed it by increasing the memory in the VM.
     
  19. jimmyleen

    jimmyleen GBAtemp Maniac

    Member
    1,152
    196
    Feb 28, 2016
    Oops nvm i'm not paying atention to the title of the topic.
     
  20. Gow supremo

    Gow supremo I am playing my 2ds

    Member
    240
    12
    Jan 24, 2016
    In the earth
    @UniqueGeek
    How to extract and rebulid romfs with bat and the gui tools is out?