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

c4388354

Well-Known Member
Member
Joined
Jan 23, 2015
Messages
142
Trophies
0
XP
623
Country
United States
Code:
        # since we will only have three possible results to these, these are
        #   hardcoded variables for convenience
        # these could be generated but given this, I'm not doing that
        # this is still ugly even after the rewrite, but it works
        tmd_padding = b'\0' * 12  # padding to add at the end of the tmd
        content_count = b'\x01'
        tmd_size = b'\x34\x0B\0\0\0\0\0\0'
        content_index = b'\x80'  # one extra bit in binary for each content
        # this is assuming that a game has a manual if it also has a dlp child
        # I've not seen a case of the opposite yet
        if manual_cfa_offset != 0:
            tmd_padding = b'\0' * 28

one extra bit in binary for each content,
this is assuming that a game has a manual if it also has a dlp child
I've not seen a case of the opposite yet

I know of one game that has a 'DLP child' but no 'manual':
Cooking_Mama_4_Kitchen_Magic_USA_3DS-VENOM (No-Intro #0090)
I remember trying to convert and install this but the CIA install failed,
I never looked into why, I assume its to do with the code above.
 

ihaveahax

Well-Known Member
OP
Member
Joined
Apr 20, 2015
Messages
6,070
Trophies
2
XP
7,842
Country
United States
Code:
        # since we will only have three possible results to these, these are
        #   hardcoded variables for convenience
        # these could be generated but given this, I'm not doing that
        # this is still ugly even after the rewrite, but it works
        tmd_padding = b'\0' * 12  # padding to add at the end of the tmd
        content_count = b'\x01'
        tmd_size = b'\x34\x0B\0\0\0\0\0\0'
        content_index = b'\x80'  # one extra bit in binary for each content
        # this is assuming that a game has a manual if it also has a dlp child
        # I've not seen a case of the opposite yet
        if manual_cfa_offset != 0:
            tmd_padding = b'\0' * 28



I know of one game that has a 'DLP child' but no 'manual':
Cooking_Mama_4_Kitchen_Magic_USA_3DS-VENOM (No-Intro #0090)
I remember trying to convert and install this but the CIA install failed,
I never looked into why, I assume its to do with the code above.
i'll look into that, thanks. this seems to be an extremely rare case.

--------------------- MERGED ---------------------------

@c4388354 I know how to fix this I think, but try the conversion in GodMode9 (select file, build cia)
 

ihaveahax

Well-Known Member
OP
Member
Joined
Apr 20, 2015
Messages
6,070
Trophies
2
XP
7,842
Country
United States
Code:
        # since we will only have three possible results to these, these are
        #   hardcoded variables for convenience
        # these could be generated but given this, I'm not doing that
        # this is still ugly even after the rewrite, but it works
        tmd_padding = b'\0' * 12  # padding to add at the end of the tmd
        content_count = b'\x01'
        tmd_size = b'\x34\x0B\0\0\0\0\0\0'
        content_index = b'\x80'  # one extra bit in binary for each content
        # this is assuming that a game has a manual if it also has a dlp child
        # I've not seen a case of the opposite yet
        if manual_cfa_offset != 0:
            tmd_padding = b'\0' * 28



I know of one game that has a 'DLP child' but no 'manual':
Cooking_Mama_4_Kitchen_Magic_USA_3DS-VENOM (No-Intro #0090)
I remember trying to convert and install this but the CIA install failed,
I never looked into why, I assume its to do with the code above.
try the latest commit now: https://github.com/ihaveamac/3dsconv/blob/master/3dsconv.py

I managed to convert, verify, install, and not get an error at the game's dlp feature, so I guess it works.
 

ChambersNow

Well-Known Member
Newcomer
Joined
Aug 27, 2009
Messages
49
Trophies
1
XP
466
Country
United States
Hi, when trying to run this on Windows, I have the msvcr100.dll in the same directory as the exe the app crashes. Says unable to start correctly, any thoughts?
 

nl255

Well-Known Member
Member
Joined
Apr 9, 2004
Messages
3,000
Trophies
2
XP
2,802
Country
use ctrtool/makerom/3dstool for that. both support decryption using the boot9 keys now. this script will remain a converter only.

Unfortunately converting an encrypted cia to a decrypted cci/3ds requires creating/finding a separate rsf file in newer versions of makerom and I have no idea how to create one (and I have a feeling it is going to be a royal pain in the ass to have to create one for every cia you want to convert). Currently I have been working around that by using an older version of makerom that does not have that requirement and doing the decryption via decrypt9wip.
 
Last edited by nl255,

ihaveahax

Well-Known Member
OP
Member
Joined
Apr 20, 2015
Messages
6,070
Trophies
2
XP
7,842
Country
United States
Hi, when trying to run this on Windows, I have the msvcr100.dll in the same directory as the exe the app crashes. Says unable to start correctly, any thoughts?
try https://www.microsoft.com/en-us/download/details.aspx?id=26999
Unfortunately converting an encrypted cia to a decrypted cci/3ds requires creating/finding a separate rsf file in newer versions of makerom and I have no idea how to create one (and I have a feeling it is going to be a royal pain in the ass to have to create one for every cia you want to convert). Currently I have been working around that by using an older version of makerom that does not have that requirement and doing the decryption via decrypt9wip.
I'm not interested in making this script do anything more than conversion to cia. converting to cci is useless except for Gateway (which I have no intention of supporting).
 

nl255

Well-Known Member
Member
Joined
Apr 9, 2004
Messages
3,000
Trophies
2
XP
2,802
Country
I'm not interested in making this script do anything more than conversion to cia. converting to cci is useless except for Gateway (which I have no intention of supporting).

I was thinking more of Citra. And just how are you supposed to get a rsf from a cia so that makerom will work on it?
 

ihaveahax

Well-Known Member
OP
Member
Joined
Apr 20, 2015
Messages
6,070
Trophies
2
XP
7,842
Country
United States
I was thinking more of Citra. And just how are you supposed to get a rsf from a cia so that makerom will work on it?
decrypt the cia, extract the cia (ctrtool --contents=contents game.cia), first content (contents.0000.xxxxxxxx) is a cxi, add .cxi to the end and use it in citra.
 

ihaveahax

Well-Known Member
OP
Member
Joined
Apr 20, 2015
Messages
6,070
Trophies
2
XP
7,842
Country
United States
two new releases since 4.0 which may be of interest, I guess.

https://github.com/ihaveamac/3dsconv/releases/latest

4.1:
  • Generate Meta region, for use with FBI and other tools
  • Some more code cleanup
4.2:
  • Fix conversion of titles with a dlp-child but no manual (gbatemp)
  • Now installable using setuptools, download source code and use python3 setup.py install (#13, thanks @dr1s)
  • Titles can be converted for use on dev-units (not fully tested), including those encrypted with dev-unit keys. See README for usage and limitations.
@c4388354 if you still haven't tried yet but want to, use 4.2 in the link above.
 

xXDungeon_CrawlerXx

Well-Known Member
Member
Joined
Jul 29, 2015
Messages
2,092
Trophies
1
Age
28
Location
Liverpool
XP
3,722
Country
those are probably dev-encrypted. do "3dsconv.py --dev-keys game.cci"
Tried it, need a certchain-dev.bin and I don't know where I can get it.
aaaanyways, I tried this tool (it's kinda old) but it converts the Unity-Games (have to rename the cci to 3ds before) to cia and they work on 3DS.
This tool is able to create a working cia, but it's not done in just one click (renaming cci to 3ds, move it to roms folder and then start the tool).

Is it possible to add a function to your py/exe to convert the cci directly to cia like this tool can do this with 3ds files?
https://gbatemp.net/threads/release-3ds-simple-cia-converter.384559/
 

ihaveahax

Well-Known Member
OP
Member
Joined
Apr 20, 2015
Messages
6,070
Trophies
2
XP
7,842
Country
United States
Tried it, need a certchain-dev.bin and I don't know where I can get it.
aaaanyways, I tried this tool (it's kinda old) but it converts the Unity-Games (have to rename the cci to 3ds before) to cia and they work on 3DS.
This tool is able to create a working cia, but it's not done in just one click (renaming cci to 3ds, move it to roms folder and then start the tool).

Is it possible to add a function to your py/exe to convert the cci directly to cia like this tool can do this with 3ds files?
https://gbatemp.net/threads/release-3ds-simple-cia-converter.384559/
it does convert directly to cia in one step once you have boot9, just with dev-encrypted titles you must do extra steps (which I thought was fine, since anyone who needs this should know how to use a terminal, and where to get the extra files).

cci does not have to be renamed to ".3ds" for this. how does cci not work? there is no difference at all besides file extension.

https://github.com/ihaveamac/3dsconv#developer-titles-not-fully-tested

doing this will result in a cia that only works on dev-units, if it was encrypted with dev keys. I'm not going to add something to change the encryption, other tools could do this.
 
Last edited by ihaveahax,

xXDungeon_CrawlerXx

Well-Known Member
Member
Joined
Jul 29, 2015
Messages
2,092
Trophies
1
Age
28
Location
Liverpool
XP
3,722
Country
hmm, okay :/
yea, the tool I used from Riku was only able to convert .3ds files because it is unable to detect cci files to convert them.
Just hexedited the tool now to prevent the renaming.

Thanks anyways
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: https://www.youtube.com/watch?v=WvojgRvNriw