3dsconv.py - script to easily convert 3DS ROMs to CIA

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by ihaveamac, May 26, 2016.

  1. ihaveamac
    OP

    ihaveamac GBAtemp Guru

    Member
    5,452
    5,922
    Apr 20, 2015
    United States
    Tigard, OR
    So I've been working on this about a month or two ago, because I wanted a different way to convert ROMs to the CIA format for those who didn't want to use Wine or wanted something with source code. This is probably mostly replaced by ticket/titlekey/CDN stuff, but I figured it'd still be useful.

    Here is 3dsconv.py, a Python script intended for "advanced users" that allows you to convert Nintendo 3DS ROMs to CIAs entirely from the terminal, quickly and easily.

    Get the latest release (4.1)
    Please read the README and command output for more information.
    The only requirements are Python 3 in your PATH. pyaes needed for encryption. On Windows, the provided 3dsconv.exe can be used without Python or pyres.

    It was mainly designed to be put in your PATH so you can run it like any other command from anywhere, or to use in own scripts for automation or other purposes.

    Some of the features include...
    • Completely offline conversion of any ROM, including encrypted if the ARM9 bootROM is supplied
    • Supports Manual and Download Play
    • Supports converting and automatically detects fully-decrypted, zerokey-encrypted, and encrypted ROMs
    • Set specific output directory
    • Free and open source (MIT license), so you can check it out and modify it however you wish
    • Pure-Python including pyaes, making it very portable
    Source: https://github.com/ihaveamac/3dsconv
    All releases: https://github.com/ihaveamac/3dsconv/releases
    Please report bugs, requests, and other issues on GitHub or this thread. Include your operating system and game you converted (and if it was built using something like 3DS Builder).
     
    Last edited by ihaveamac, Jun 5, 2017


  2. TheReturningVoid

    TheReturningVoid 0xAAAAAAAA

    Member
    332
    144
    Oct 2, 2014
    /dev/urandom
    Been testing this for a little while now, and I can say that it works pretty well. Haven't tried with some of the newer releases though, so I'll report back once I get a change to test them.
     
  3. Angelcraft

    Angelcraft GBAtemp Advanced Fan

    Member
    521
    53
    Sep 8, 2015
    Spain
  4. Dr.Hacknik

    Dr.Hacknik Maniac | Dev | A Fellow (lewd) Megumin

    Member
    1,186
    971
    Mar 26, 2014
    United States
    my lewd corner
    Hmm, maybe i can convert this to C#....To Visual Studio!
     
    klear likes this.
  5. ihaveamac
    OP

    ihaveamac GBAtemp Guru

    Member
    5,452
    5,922
    Apr 20, 2015
    United States
    Tigard, OR
    there is already a similar Windows tool that already does the same thing; however I'm still interested in what you can come up with since the other is closed-source :)
     
  6. gamecaptor

    gamecaptor R.I.P. Densetsu. Legends never die!

    Member
    GBAtemp Patron
    gamecaptor is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    540
    290
    Jan 22, 2004
    United States
    Hyrule most of the time
    I have always used 3DS Simple CIA Converter v4.3 to convert my .3ds stuff to .cia. The process seems to be pretty much the same, so I'm a little confused as what's different?

    That said I just went through the process once and I want to be sure I'm doing it correctly.

    I first tried this command and I got this result:
    3dsconv ROM.3ds
    - processing: ROM (encrypted)
    ! 000400000017B200.Main.exheader.xorpad couldn't be found.
    use --gen-ncchinfo with this ROM.
    * done converting!
    0 out of 1 roms processed

    I Then went through these steps:
    1. I ran this command:
    3dsconv --gen-ncchinfo ROM.3ds
    - processing: ROM (encrypted)
    ! 000400000017B200.Main.exheader.xorpad couldn't be found.
    - saving ncchinfo.bin
    - use Decrypt9 on a 3DS system to generate the XORpads.
    place the file at the root or in a folder called "Decrypt9".
    view the Decrypt9 README and download releases at
    https://github.com/d0k3/Decrypt9WIP
    * done converting!
    0 out of 1 roms processed

    2. I then copied the ncchinfo.bin to the root of my 3DS SD card.

    3. I started Decrypt9 and selected XORpad Generator Options -> NCCH Padgen

    4. I copied the ################.Main.exheader.xorpad from my 3DS SD card back to my 3dsconv folder

    5. I then ran this command:
    3dsconv ROM.3ds
    - processing: ROM (encrypted)
    * done converting!
    1 out of 1 roms processed

    6. It created my ROM.cia file
     
  7. ihaveamac
    OP

    ihaveamac GBAtemp Guru

    Member
    5,452
    5,922
    Apr 20, 2015
    United States
    Tigard, OR
    the two big differences are that, since it's a python script it supports more operating systems than just Windows, and also properly supports decrypted roms. the second one especially, since Decrypt9 can now dump & decrypt game cards at the same time, removing the xorpad step.

    it also doesn't need exefs xorpads, which were used for region-freeing, which isn't really necessary (and can break out of region DLC? I'm not sure)
    nothing seems wrong in what you did.
     
    Last edited by ihaveamac, Jul 2, 2016
    gamecaptor likes this.
  8. gamecaptor

    gamecaptor R.I.P. Densetsu. Legends never die!

    Member
    GBAtemp Patron
    gamecaptor is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    540
    290
    Jan 22, 2004
    United States
    Hyrule most of the time
    Thanks for the info ihaveamac.
     
  9. Somebody Else

    Somebody Else Banned

    Banned
    29
    4
    May 3, 2016
    Italy
    Α gui should be nice
     
    Last edited by Somebody Else, Jul 2, 2016
  10. ongo_gablogian

    ongo_gablogian GBAtemp Regular

    Member
    187
    128
    Mar 26, 2010
    United States
    Thanks for this tool!

    Quick question though, anyone know how to add makerom to your path on mac?
     
  11. ihaveamac
    OP

    ihaveamac GBAtemp Guru

    Member
    5,452
    5,922
    Apr 20, 2015
    United States
    Tigard, OR
    your PATH would normally include places like /usr/bin. if you're lazy you can just drop makerom into this folder. note you probably won't see it normally from Finder, so use the "Go" menu then "Go to Folder..."

    you can also edit .bash_profile in your user folder to add something like:
    Code:
    export PATH=/Users/username/bin:${PATH}
    then make a folder in your user folder called "bin", and put makerom/etc in that.
     
  12. ongo_gablogian

    ongo_gablogian GBAtemp Regular

    Member
    187
    128
    Mar 26, 2010
    United States
    Thanks, I appreciate the help. I followed those steps and am now getting this error:

     
  13. ihaveamac
    OP

    ihaveamac GBAtemp Guru

    Member
    5,452
    5,922
    Apr 20, 2015
    United States
    Tigard, OR
    what folder did you put it in? not sure why this would happen.
     
  14. ongo_gablogian

    ongo_gablogian GBAtemp Regular

    Member
    187
    128
    Mar 26, 2010
    United States
    I tried both "/usr/bin" and "/users/username/bin".

    Btw, Is this a proper command structure?

    "python 3dsconv.py game.3ds"
     
  15. ihaveamac
    OP

    ihaveamac GBAtemp Guru

    Member
    5,452
    5,922
    Apr 20, 2015
    United States
    Tigard, OR
    if it's in /usr/bin, you should try "sudo chmod +x /usr/bin". for /Users/username/bin, use "chmod +x ~/bin/makerom"

    for using the script, you could use chmod on it:
    Code:
    chmod +x 3dsconv.py
    ./3dsconv.py game.3ds
     
  16. ongo_gablogian

    ongo_gablogian GBAtemp Regular

    Member
    187
    128
    Mar 26, 2010
    United States
    Strange, still getting the same error.
     
  17. ihaveamac
    OP

    ihaveamac GBAtemp Guru

    Member
    5,452
    5,922
    Apr 20, 2015
    United States
    Tigard, OR
    try using "makerom" from the terminal. does it do anything?
     
  18. ongo_gablogian

    ongo_gablogian GBAtemp Regular

    Member
    187
    128
    Mar 26, 2010
    United States
    Yep it spits out:

    -bash: /usr/bin/makerom: Permission denied
     
  19. ihaveamac
    OP

    ihaveamac GBAtemp Guru

    Member
    5,452
    5,922
    Apr 20, 2015
    United States
    Tigard, OR
    try this:
    Code:
    sudo chmod +x /usr/bin/makerom
     
  20. ongo_gablogian

    ongo_gablogian GBAtemp Regular

    Member
    187
    128
    Mar 26, 2010
    United States
    I'm still getting errors, but at least a .cxi file is being built.