Converting .3DS to .CIA for Hackers!
Hello, and welcome to the great guide on how to convert your games to work on CFW/Gateway yourself, without ever having to read a "user-friendly" script to ever know what the hell went wrong.
At the end of this tutorial you will know how to convert your games by using tools made by others, and if you're going to repeat this process often, you will probably want to hack a script together yourself to automate this (Protip: it's actually not that difficult to copypasta some commands into your favorite text editor).
This guide is geared towards linux users, but in contrast to pre-made scripts, these commands can be used almost anywhere as long as you have the tools on said platform.
Some games are really big, and because they are stored about 2 or 3 times their size in ram during some operations, you may need a 64bit computer and/or some swap space.
So, without further ado, let's begin:
First, we need the tools. Create a directory somewhere to put them.
Let's make a list:
* The game you want to convert
* On linux, you will compile the tools yourself, as there are no prebuilt binaries. You need at least gcc, g++ and make (search in your repositories), though installing the development tools package of your distribution isn't a bad idea.
* Python 2.7 (Again, search your repositories)
* A 3DS on 4.x with the mset exploit, or a 9.0-9.2.
* slot0x25KeyX.bin (Search the interwebz, because rulez disallow me from linking)
Put the hex number you found on the webz in a file called slot0x25KeyX.bin with your favorite hex editor. Copy the file to the tools directory.
* 3DS_Multi_Decryptor (or Decrypt9 if you're on 9.x) [thread]
The former contains prebuilt binaries in the github repo, the latter has a download link for prebuilt binaries in the thread.
To compile any of both yourself, grab devkitPRO (Just grab the perl updater and set variable, it's not difficult to install), and run "make" in the source directory.
Copy Launcher.dat and ctrKeyGen.py (or ncchinfo_gen.py if using Decrypt9) to your tools directory.
Optional (For firmware >=7.x roms): Copy MEX.py from 3DS_Multi_Decryptor to your tools directory.
* ctrtool and makerom (There are several versions on github, this is the most recently updated)
On linux, for makerom comment line 130 in ncch.c as it causes a segfault (details).
Run "make" in both directories, copy the binaries (named the same as their respective directories) to your tools directory.
* padxorer
Run "gcc -O3 padxorer.c -o padxorer" and copy the binary to the tools directory.
* Optional (for manual and download play): rom_tool [thread]
Just run "make" in the rom_tool directory and copy the resulting binary to the tools directory.
* Optional (If you don't want to create the rsf file yourself): rsfgen [post]
Also get dummy.rsf.
Just put rsfgen.py and dummy.rsf in the tools directory.
NOTE: It's inportant for dummy.rsf to use dos line endings. If you copy/pasted it instead of downloading it you may have problems. If the generated file by rsfgen.py looks weird, this may be the problem.
* Optional (To reinject the original headers into the rom): ExInjector [post]
Just put the file in the tools directory.
Now you should be ready for the action.
Create a new directory, place the tools directory inside and put your game there.
First, create ncchinfo.bin (Use ncchinfo_gen.py instead if you're using Decrypt9):
Now, grab a working Fat32-partitioned SD card (At least 2gb, but depends on game size).
Make sure slot0x25KeyX.bin has the right contents. If it doesn't, no program will tell you about it, and will continue generating your .cia happily.
Copy tools/Launcher.dat, tools/slot0x25KeyX.bin and ncchinfo.bin to the root of your SD card.
Pop it into your 3DS and launch the mset exploit (Or go to http://dukesrg.no-ip.org/3ds/go with the browser if using Decrypt9).
Choose "NCCH padgen" from the menu (I'm not sure about Decrypt9), and wait. This should take a while.
Pop the SD back into your PC, and copy all the *.Main.*.xorpad to some directory (I'll use "xorpads").
Now, extract the encrypted contents of your game:
It may complain about the exheader hash, but you shouldn't care.
Optional: If you have a *.Main.exefs_7x.xorpad, the game is for formware 7.x or higher. You need to merge dem xorpads.
NOTE: I haven't tested this, because I haven't encountered a 7.x game, yet.
Now, we have to decrypt the contents of the game:
Now, extract the exefs to obtain the icon and banner:
Now, create the rsf:
The --spoof option is optional if you want to enable firmware spoofing.
The --regionfree option is optional if you want to patch regionfree.
NOTE: Check the generated game.rsf file. If it looks weird, your dummy.rsf probably doesn't use dos line endings. Download it with git (or zip download), or convert it with unix2dos or similar.
Optional: If you want the manual/download play, you need to extract the .cfa:
Now, create the cxi:
Optional: Inject original exheader
The -fwspoof option is optional if you want to enable firmware spoofing.
NOTE: I've tried to use this with two roms, and it stuck on the 3ds logo. You may have a different experience, though.
Now, create the final cia:
You can remove any of the -content if your game doesn't have it, or you don't want it.
It may warn you about the cia not going to be encrypted, but we want it unencrypted.
That's it! Copy, install, and play!
If you're having problems, or there's something wrong with this guide, please post it in this thread.
Appendix
How to use rxTools to make this process a bit faster when bulking:
How to convert decrypted .3ds files:
Common problems:
Like, subscribe, comment, share, shill, give it as a present to your mom and feed it to your dog!
At the end of this tutorial you will know how to convert your games by using tools made by others, and if you're going to repeat this process often, you will probably want to hack a script together yourself to automate this (Protip: it's actually not that difficult to copypasta some commands into your favorite text editor).
This guide is geared towards linux users, but in contrast to pre-made scripts, these commands can be used almost anywhere as long as you have the tools on said platform.
Some games are really big, and because they are stored about 2 or 3 times their size in ram during some operations, you may need a 64bit computer and/or some swap space.
So, without further ado, let's begin:
First, we need the tools. Create a directory somewhere to put them.
Let's make a list:
* The game you want to convert
* On linux, you will compile the tools yourself, as there are no prebuilt binaries. You need at least gcc, g++ and make (search in your repositories), though installing the development tools package of your distribution isn't a bad idea.
* Python 2.7 (Again, search your repositories)
* A 3DS on 4.x with the mset exploit, or a 9.0-9.2.
* slot0x25KeyX.bin (Search the interwebz, because rulez disallow me from linking)
Put the hex number you found on the webz in a file called slot0x25KeyX.bin with your favorite hex editor. Copy the file to the tools directory.
* 3DS_Multi_Decryptor (or Decrypt9 if you're on 9.x) [thread]
The former contains prebuilt binaries in the github repo, the latter has a download link for prebuilt binaries in the thread.
To compile any of both yourself, grab devkitPRO (Just grab the perl updater and set variable, it's not difficult to install), and run "make" in the source directory.
Copy Launcher.dat and ctrKeyGen.py (or ncchinfo_gen.py if using Decrypt9) to your tools directory.
Optional (For firmware >=7.x roms): Copy MEX.py from 3DS_Multi_Decryptor to your tools directory.
* ctrtool and makerom (There are several versions on github, this is the most recently updated)
On linux, for makerom comment line 130 in ncch.c as it causes a segfault (details).
Run "make" in both directories, copy the binaries (named the same as their respective directories) to your tools directory.
* padxorer
Run "gcc -O3 padxorer.c -o padxorer" and copy the binary to the tools directory.
* Optional (for manual and download play): rom_tool [thread]
Just run "make" in the rom_tool directory and copy the resulting binary to the tools directory.
* Optional (If you don't want to create the rsf file yourself): rsfgen [post]
Also get dummy.rsf.
Just put rsfgen.py and dummy.rsf in the tools directory.
NOTE: It's inportant for dummy.rsf to use dos line endings. If you copy/pasted it instead of downloading it you may have problems. If the generated file by rsfgen.py looks weird, this may be the problem.
* Optional (To reinject the original headers into the rom): ExInjector [post]
Just put the file in the tools directory.
Now you should be ready for the action.
Create a new directory, place the tools directory inside and put your game there.
First, create ncchinfo.bin (Use ncchinfo_gen.py instead if you're using Decrypt9):
Code:
python2 tools/ctrKeyGen.py game.3ds && mv tools/ncchinfo.bin .
Now, grab a working Fat32-partitioned SD card (At least 2gb, but depends on game size).
Make sure slot0x25KeyX.bin has the right contents. If it doesn't, no program will tell you about it, and will continue generating your .cia happily.
Copy tools/Launcher.dat, tools/slot0x25KeyX.bin and ncchinfo.bin to the root of your SD card.
Pop it into your 3DS and launch the mset exploit (Or go to http://dukesrg.no-ip.org/3ds/go with the browser if using Decrypt9).
Choose "NCCH padgen" from the menu (I'm not sure about Decrypt9), and wait. This should take a while.
Pop the SD back into your PC, and copy all the *.Main.*.xorpad to some directory (I'll use "xorpads").
Now, extract the encrypted contents of your game:
Code:
tools/ctrtool -p --exheader=exheader.bin --romfs=romfs.bin --exefs=exefs.bin game.3ds
Optional: If you have a *.Main.exefs_7x.xorpad, the game is for formware 7.x or higher. You need to merge dem xorpads.
Code:
python2 tools/MEX.py exefs.bin xorpads/*.Main.exefs_norm.xorpad xorpads/*.Main.exefs_7x.xorpad xorpads/Main.exefs_norm.xorpad && rm xorpads/*.Main.exefs*.xorpad
Now, we have to decrypt the contents of the game:
Code:
array=(exheader exefs romfs); for item in ${array[@]}; do tools/padxorer $item.bin xorpads/*Main.$item*.xorpad; done
rm *.bin
rename .bin.out .bin *.out
Now, extract the exefs to obtain the icon and banner:
Code:
tools/ctrtool --exefsdir=exefs --decompresscode -t exefs exefs.bin
Now, create the rsf:
Code:
cp tools/dummy.rsf game.rsf
python2 tools/rsfgen.py --rsf game.rsf --rom game.3ds --exheader exheader.bin --regionfree exefs/icon.bin --spoof
The --regionfree option is optional if you want to patch regionfree.
NOTE: Check the generated game.rsf file. If it looks weird, your dummy.rsf probably doesn't use dos line endings. Download it with git (or zip download), or convert it with unix2dos or similar.
Optional: If you want the manual/download play, you need to extract the .cfa:
Code:
tools/rom_tool --extract=. game.3ds
rm -f *APPDATA.cxi *UPDATEDATA.cfa
Now, create the cxi:
Code:
tools/makerom -f cxi -o game.cxi -target t -rsf game.rsf -icon exefs/icon.bin -banner exefs/banner.bin -exefslogo -code exefs/code.bin -exheader exheader.bin -romfs romfs.bin
Optional: Inject original exheader
Code:
python2 tools/ExInjector.py -rom game.cxi -exheader exheader.bin -sd -fwspoof
NOTE: I've tried to use this with two roms, and it stuck on the 3ds logo. You may have a different experience, though.
Now, create the final cia:
Code:
tools/makerom -f cia -o game.cia -content game.cxi:0:0 -content $(echo *MANUAL.cfa):1:1 -content $(echo *DLP.cfa):2:2
It may warn you about the cia not going to be encrypted, but we want it unencrypted.
That's it! Copy, install, and play!
If you're having problems, or there's something wrong with this guide, please post it in this thread.
Appendix
How to use rxTools to make this process a bit faster when bulking:
Okay, so recently, this thing got released, called rxTools.
It's a toolkit with a lot of different functions, and one of them is bulk-decrypting .3ds games, thus making it unnecessary to screw around with xorpads.
I'm going to explain how to bulk this stuff, my style.
First of all, you're going to need all the requirements of the original tutorial, except for 3DS_Multi_Decryptor, MEX.py and padxorer.
Now, get rxTools from here, and put rxTools.dat on the root of your SD card, along with slot0x25KeyX.bin, and copy your 3ds games anywhere except inside the "Nintendo 3DS" directory.
Launch rxTools with the web exploit, and press the "Decrypt CTR Titles" option. This can take a while.
Turn off your 3DS, and copy the (now decrypted) .3ds file(s) to your working directory.
Now, follow the appendix on how to convert decrypted .3ds files.
The next step would be throwing a script together to bulk the conversion.
It's a toolkit with a lot of different functions, and one of them is bulk-decrypting .3ds games, thus making it unnecessary to screw around with xorpads.
I'm going to explain how to bulk this stuff, my style.
First of all, you're going to need all the requirements of the original tutorial, except for 3DS_Multi_Decryptor, MEX.py and padxorer.
Now, get rxTools from here, and put rxTools.dat on the root of your SD card, along with slot0x25KeyX.bin, and copy your 3ds games anywhere except inside the "Nintendo 3DS" directory.
Launch rxTools with the web exploit, and press the "Decrypt CTR Titles" option. This can take a while.
Turn off your 3DS, and copy the (now decrypted) .3ds file(s) to your working directory.
Now, follow the appendix on how to convert decrypted .3ds files.
The next step would be throwing a script together to bulk the conversion.
These kinds of files can be aquired in multiple ways, like rxTools, or converted CIAs you want to edit it's romfs. It's useful to be able to convert them.
You're going to need all the requirements of the original tutorial, except for 3DS_Multi_Decryptor, MEX.py and padxorer.
To convert a game, extract the (now decrypted) contents of your game like in the original tutorial (IMPORTANT: don't use the -p flag, this won't work), and follow the rest of it from the step where I show how to extract the exefs.
You're going to need all the requirements of the original tutorial, except for 3DS_Multi_Decryptor, MEX.py and padxorer.
To convert a game, extract the (now decrypted) contents of your game like in the original tutorial (IMPORTANT: don't use the -p flag, this won't work), and follow the rest of it from the step where I show how to extract the exefs.
Problem: When you get this error when trying to build a cxi:
Solution: Comment ExtSaveDataId in game.rsf
Code:
[EXHEADER ERROR] ExtSaveDataId is unavailable if AccessibleSaveDataIds is specified.
[EXHEADER ERROR] Failed to create ExHeader
Like, subscribe, comment, share, shill, give it as a present to your mom and feed it to your dog!