[Release] Just another 3DS to CIA converter

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by drizztbsd, Apr 21, 2016.

  1. drizztbsd
    OP

    drizztbsd Advanced Member

    Newcomer
    63
    36
    Apr 4, 2016
    Italy
    Hi,
    this is just another 3DS to CIA converter.

    This uses only ExHeader XORpads (the first KB of the xorpad) and nothing else.

    FEATURES
    • Simple to use
    • Support of zipped roms and xorpads
    • Portable
    • Open Source (GPLv2)
    USAGE
    Just put your roms in the roms directory, xorpads in the xorpads directory and launch the program.

    If you don't have the xorpad the tool will generate an ncchinfo.bin file that must be used with Decrypt9WIP.

    You can also use zipped roms and multiple xorpad zipped.
    Zipped xorpads must also contains CRC32 of the ROM in filename (TITLEID.CRC32.Main.exheader.xorpad).

    An anonymous user released the complete set of exheader xorpads on GitHub (search for it).
    If you download his set by using the Download ZIP feature of GitHub, then you can put the zip file inside the xorpad directory and it'll be used automatically

    Here you can always find the last release with all-in-one binary for Windows

    KNOWN BUGS
    Big (more than 2GB) roms cannot be converted (yet) on 32-bit operating systems or if you are using a 32-bit make_cia.

    CHANGELOG
    v0.2.1
    • Fix ncchinfo.bin generation from roms inside zip files
    • Add a 64-bit make_cia.exe and a warning if you are using a 32-bit OS
     
    Last edited by drizztbsd, Apr 22, 2016


  2. Dorimori

    Dorimori professional lurker

    Member
    412
    1,091
    Mar 17, 2016
    United States
    the closet
    Nice!
     
  3. jimmyleen

    jimmyleen GBAtemp Maniac

    Member
    1,161
    198
    Feb 28, 2016
    Does anyone else have the knowledge to make uncart convert .3ds to .cia without using a pc?

    Edit: unfortunately i'm not that smart to make uncart do anything
     
  4. AnalogMan

    AnalogMan sumoCheatMenu Dev

    Member
    1,459
    857
    Apr 20, 2007
    United States
    Does this make the CIA's region free or CryptoFix them? I'd prefer if it didn't.
     
  5. cearp

    cearp the ticket master

    Member
    7,510
    4,745
    May 26, 2008
    Tuvalu
    open source, thank you!
    riku's tool was nice but, source is really important.

    yes i was thinking that too. using some code from decrypt9 we could decrypt what is needed and convert to cia on the device, all in 1 button press.
    but, is it that important? no - but very cool :)

    — Posts automatically merged - Please don't double post! —

    i think the OP would say if it did this, but even if it did, it's open source so you can change it :)
     
    ihaveamac likes this.
  6. jimmyleen

    jimmyleen GBAtemp Maniac

    Member
    1,161
    198
    Feb 28, 2016
    Important? No

    More convenient then using a pc? Yes indeed
     
  7. A_Random_Guy

    A_Random_Guy Officially That Dev

    Member
    862
    459
    May 22, 2015
    Malaysia
    Smea's closet
    Already found the motherload. Will keep for future backup
     
  8. ihaveamac

    ihaveamac GBAtemp Guru

    Member
    5,457
    5,924
    Apr 20, 2015
    United States
    Tigard, OR
    it doesn't use ExeFS xorpads, so it doesn't use regionfree.

    the ExHeader xorpad is only used to change a single byte in it, basically to indicate that it's an SD card title. in the same byte also tells if the code is compressed. (offset 0xD)
     
    cearp likes this.
  9. BerserkLeon

    BerserkLeon Not-so-new member

    Member
    433
    62
    Mar 22, 2010
    United States
    Pennsylvania
    [!] CXI decryption failed (Check CXIKey)
    [!] Actual savedata size, title version and Meta region could not be obtained
    [!] Memory Allocation Failure
    [!] Content could not be setup for CIA
     
  10. ihaveamac

    ihaveamac GBAtemp Guru

    Member
    5,457
    5,924
    Apr 20, 2015
    United States
    Tigard, OR
    how much RAM does your computer have and what game are you trying to convert?
     
  11. BerserkLeon

    BerserkLeon Not-so-new member

    Member
    433
    62
    Mar 22, 2010
    United States
    Pennsylvania
    Performance section of task manager reports 7.2GB
    Trying to convert SMT: Devil Survivor 2 Record Breaker (ADXE)
    or Bravely Second (BSEE)
    or Hyrule Warriors Legends (BZHE)
    All the games I've tried this with so far don't work... I'm booting D9 from a9lh wih all the needed keys I think.

    Tried 3dsconv.py too. Get:
    - processing: CTR-P-ADXE (encrypted)
    ! make_cia had an error.
    - full command: make_cia -o 0004000000159500-game-conv.cia --savesize=128 --content0=0004000000159500-game-conv.cxi --id_0=0 --index_0=0 --content1=0004000000159500-manual.cfa --index_1=1
    - output:
    then what I posted before.
    I had an error compiling make_cia so I grabbed the binary from d0k3's github. might that be the issue?

    here's that one.

    gcc --std=c99 -Wall -I. -c -o utils.o utils.c
    gcc --std=c99 -Wall -I. -c -o ctr_crypto.o ctr_crypto.c
    gcc --std=c99 -Wall -I. -c -o settings.o settings.c
    In file included from settings.c:21:0:
    settings.h:44:1: error: conflicting types for 'CERT_CONTEXT'
    CERT_CONTEXT;
    ^
    In file included from c:\app\x86_64-w64-mingw32\include\windows.h:95:0,
    from lib.h:32,
    from settings.c:19:
    c:\app\x86_64-w64-mingw32\include\wincrypt.h:2657:5: note: previous declaration of 'CERT_CONTEXT' was here
    } CERT_CONTEXT,*PCERT_CONTEXT;
    ^
    make: *** [settings.o] Error 1
     
    Last edited by BerserkLeon, Apr 22, 2016
  12. ihaveamac

    ihaveamac GBAtemp Guru

    Member
    5,457
    5,924
    Apr 20, 2015
    United States
    Tigard, OR
    I don't know if the one from d0k3's github is 32-bit or 64-bit. not really sure how to build it on Windows but I'll give something a shot.
     
  13. BerserkLeon

    BerserkLeon Not-so-new member

    Member
    433
    62
    Mar 22, 2010
    United States
    Pennsylvania
    Well if it's 64 bit I'm on a 64bit machine. If it's 32 bit it should run on a 64 bit machine.
    All 3 roms are smaller than 3GB, so does it need much more RAM than the ROM size?

    there's also this it spits out, didn't notice before.

    work/000400000017ea00-game-conv.cia
    CTR-P-BZHE.cia
    Traceback (most recent call last):
    File "C:\app\3dsconv.py", line 325, in <module>
    os.rename("work/%s-game-conv.cia" % tid, cianame)
    WindowsError: [Error 2] The system cannot find the file specified

    But strangely, there is a work dir with the cxis and cfas in it.
     
    Last edited by BerserkLeon, Apr 22, 2016
  14. ihaveamac

    ihaveamac GBAtemp Guru

    Member
    5,457
    5,924
    Apr 20, 2015
    United States
    Tigard, OR
    yeah but I think if it's a 32-bit executable, it will have limited 4gb ram or something. I don't know.

    here, I tried building it on 64-bit windows 8.1 through cygwin though it should still work fine through the command prompt. tell me how it goes. I think the DLL should be next to the exe if you don't have cygwin.
     

    Attached Files:

  15. BerserkLeon

    BerserkLeon Not-so-new member

    Member
    433
    62
    Mar 22, 2010
    United States
    Pennsylvania
    using 3dsconv as it spits out more;

    D:\3dscia>3dsconv.py --xorpads=xorpads CTR-P-BZHE.3ds
    - processing: CTR-P-BZHE (encrypted)
    ! make_cia had an error.
    - full command: make_cia -o 000400000017ea00-game-conv.cia --savesize=512 --content0=000400000017ea00-game-conv.cxi --id_0=0 --index_0=0 --content1=000400000017ea00-manual.cfa --index_1=1
    - output:
    [!] CXI decryption failed (Check CXIKey)
    [!] Actual savedata size, title version and Meta region could not be obtained
    [!] Memory Allocation Failure
    [!] Content could not be setup for CIA
    [!] Failed to generate 000400000017ea00-game-conv.cia

    work/000400000017ea00-game-conv.cia
    CTR-P-BZHE.cia
    Traceback (most recent call last):
    File "C:\app\3dsconv.py", line 325, in <module>
    os.rename("work/%s-game-conv.cia" % tid, cianame)
    WindowsError: [Error 2] The system cannot find the file specified

    though... it popped up faster this time.
     
  16. ihaveamac

    ihaveamac GBAtemp Guru

    Member
    5,457
    5,924
    Apr 20, 2015
    United States
    Tigard, OR
    I'll have to figure out "WindowsError: [Error 2] The system cannot find the file specified". for now, don't use --output=<dir>.

    here, I built it again using mingw or something (you can tell I don't build on Windows often!). I don't know if you need other files yet, tell me if you need something.
     

    Attached Files:

    BerserkLeon likes this.
  17. BerserkLeon

    BerserkLeon Not-so-new member

    Member
    433
    62
    Mar 22, 2010
    United States
    Pennsylvania
    i'm not using --output, just --xorpads
    if that's the issue, I'll try throwing everything in the same folder...

    nope, same thing.

    3ds-to-cia prints
    [!] CXI decryption failed (Check CXIKey)
    [!] Actual savedata size, title version and Meta region could not be obtained
    [!] Memory Allocation Failure
    [!] Content could not be setup for CIA
    [!] Failed to generate cia\CTR-P-ADXE.cia
    Error during CIA creation of 'roms\CTR-P-ADXE.3ds'
    Relaunch the program with -v for more informations.
    [ERROR]

    /work is something 3dsconv made without my intervention.

    Anyway thanks very much for the help. I wasn't expecting such an immediate response.
     
    Last edited by BerserkLeon, Apr 22, 2016
  18. ihaveamac

    ihaveamac GBAtemp Guru

    Member
    5,457
    5,924
    Apr 20, 2015
    United States
    Tigard, OR
    yeah I'm not sure anymore. I don't know the sizes of the games you're trying to convert but make_cia (and makerom too) aren't very efficient on memory I think. :(
    good to know
     
    Last edited by ihaveamac, Apr 22, 2016
  19. drizztbsd
    OP

    drizztbsd Advanced Member

    Newcomer
    63
    36
    Apr 4, 2016
    Italy
    Thank you.
    I released v0.2.1 with a 64-bit prebuilt make_cia.exe for Windows and a big warning if you are using a 32-bit Windows.
     
    BerserkLeon likes this.
  20. BerserkLeon

    BerserkLeon Not-so-new member

    Member
    433
    62
    Mar 22, 2010
    United States
    Pennsylvania
    Creating CIA...

    roms\CTR-P-ADXE.3ds [OK]

    I'm so confused...