pushed too early

Ian Burgwin 2016-09-12 18:21:39 -07:00
parent 8e406e4ad4
commit 84f89b07a1

@ -1,36 +1,159 @@
### How to Dump and Decrypt 3DS Games
There are two methods to dump games: one involves dumping & decrypting games with Decrypt9WIP with 9.2 or arm9loaderhax, the other uses braindump on any system with Homebrew Launcher access.
#### Method 1: Decrypt9WIP
##### Required tools
- [Decrypt9WIP](https://github.com/d0k3Decrypt9WIP)
- 3DS system with 9.2.0-20 or lower, or arm9loaderhax
- SD card with enough space to dump the game card, 8GB or higher recommended
- SD card reader (preferred), or a way to use wireless file transfer
- **Only for systems below 7.0:** `slot0x25KeyX.bin` (you must find this yourself)
This guide focuses on how do dump games in Windows, but since all of the programs work on various operating systems, it should be fairly easy to figure out how to translate each of the steps into another operating system.
##### Instructions
1. Set up Decrypt9WIP using one of the various entry points. [Read its readme](https://github.com/d0k3/Decrypt9WIP#how-to-run-this--entry-points) on how to do this.
2. Create a folder at the root of the 3DS SD card called `files9`.
3. Create a folder inside `files9` called `D9Game`.
4. Insert your game card that you want to dump.
5. Choose "Gamecart Dumper Options".
6. Choose "Dump & Decrypt Cart (trim)".
7. Wait for the process to finish.
8. Your game will be inside `/files9/D9Game` and is immediately usable with Citra.
#### Tools required:
#### Method 2: braindump
##### Required tools
- [braindump](https://gbatemp.net/threads/braindump-userland-game-dumping.407332/)
- 3DS system with access to [the Homebrew Launcher](https://smealum.github.io/3ds/)
- SD card with enough space to dump the game card, 8GB or higher recommended
- SD card reader (preferred), or a way to use wireless file transfer
- [Homebrew Starter Kit](https://smealum.github.io/ninjhax2/starter.zip)
- [Brahma2](https://github.com/delebile/Brahma2)
- [Uncart](https://github.com/citra-emu/uncart)
- [Decrypt9](https://github.com/archshift/Decrypt9)
- [xorer](https://github.com/archshift/xorer)
- 3DS Hardware (N3DS, 3DS, 2DS) with firmware 9.2 or below, and some way of running userland code as listed on http://3dbrew.org/wiki/Homebrew_Exploits (and which aren't listed on 'Exploits without Homebrew Launcher')
- A SD Card big enough to contain the dumped games. 8GB or greater is recommended.
- A way to read SD Cards on a PC or an internet connection to transfer dumps over wifi.
- An installation of Python ([Python 2.7.9](https://www.python.org/downloads/release/python-279/) was used during the creation of this guide)
**For 3DSes with firmwares older than 7.x when decrypting a 7.x firmware or newer game**
- slot0x25KeyX.bin with the key. You have to create the file and find the key yourself.
**Note:** If you are trying to dump a digitally installed game, recent games (released after 9.6) will not dump properly yet.
- OR: 3DS with a way to load Homebrew (includes 4.1 to 11.0) and [braindump](https://gbatemp.net/threads/braindump-userland-game-dumping.407332/) (instructions on the page)
##### Instructions
1. Set up braindump by extracting the `braindump` folder to the `3ds` folder at the root of your 3DS SD card.
2. Enter the Homebrew Launcher using one of the various exploits.
3. Choose braindump, then select the game you want to dump. The inserted game card is the first one to appear.
4. Wait for the process to finish.
5. Your game will be at the root of the SD card and is immediately usable with Citra.
<br/>
#### **STEP 1 Preparing the SD card**
At this point, we need to download a lot of stuff and put it in the right spot.
- The [Homebrew Starter Kit](https://smealum.github.io/ninjhax2/starter.zip) - Note: this also contains the homebrew launcher and some homebrew, including an FTP client for sending files over to a computer without removing the SD card if you so desire. For more information, you can check out the guide on [The Homebrew Launcher website](http://smealum.github.io/3ds/).
- [Brahma2](https://github.com/delebile/Brahma2) must be downloaded and placed within sd:/3ds/brahma2.
- [Uncart](https://github.com/citra-emu/uncart) must be downloaded and placed within sd:/brahma.
- [Decrypt9](https://github.com/archshift/Decrypt9) must be downloaded and placed within sd:/brahma.
On N3DS units, it's possible to do this without removing the SD card! Within the N3DS Home Menu, hit the "System Settings" icon, select "Data Management" and then "Micro SD Management." From there, the N3DS will provide instructions on how to access the N3DS from your computer over wifi. Place the extracted contents in the locations mentioned above.
<br/>
#### **STEP 2 Dumping the Game**
Next you'll want to load Brahma from the Homebrew Launcher. Once that is loaded, you will select uncart. Uncart is the application that will dump the cartridge onto the SD card. Select dump cartridge and wait patiently for the game to dump. This can take quite a while on bigger games, so be patient! it will dump to sd:/<16-hex-digit title ID>.3ds; uncart will display the filename on screen while it dumps.
**NOTE:** If a game is greater than 2GiB, it will be split into multiple files when it dumps. Using generic names, it would be Game.3d0, Game.3d1 etc. Because the 3DS SD card is formatted FAT, you cannot combine these files on the SD card and must copy them onto another device. Most users are planning to copy these onto their computer anyway, and that will work fine.
On Windows 7, we can combine these files easily by putting both files into the same folder, opening up command prompt and navigating to that folder. We'll use bravely default (NTSC) as the example here.
```
Copy /b "00040000000FC500.3d0"+"00040000000FC500.3d1" "Bravely Default.3ds"
```
This will give you a single combined file that is your entire ROM dump under the name "Bravely Default". If you're certain you've done this correctly, you can delete the input files and just keep the .3ds produced.
NOTE: This ROM file will **never** need to be on your SD card after this point. If it's still on your SD card, you can copy it to your computer to save space for the next step.
<br/>
#### STEP 3 **Generating Xorpads**
This part can be a bit tricky, so please pay careful attention to every detail! If this part is messed up, you won't know until later!
For the purposes of this guide, think of the xorpad as a decryption key that will eventually decrypt your ROM for use in Citra.
**NOTE:** Python is required for this step. During the creation of this guide, [Python 2.7.9](https://www.python.org/downloads/release/python-279/) was used.
#### **Setting up Everything
- Download [Decrypt9](https://github.com/archshift/Decrypt9). Within your Decrypt9 folder, there will be a scripts folder with a few scripts in it. We only care about one, _ncchinfo_gen.py_. The others can be ignored.
- Open up the command prompt/terminal and navigate to the folder containing ncchinfo_gen.py. Alternatively, you on Windows, you can just hold shift and right click the background of the folder containing the file and hit "Open Command Window Here."
- Run ncchinfo_gen.py followed by a directory to your rom file. Alternatively, dragging your rom file onto the command window will automatically add the path and file location. If you did everything correct, it will look something like this.
```
ncchinfo_gen.py "D:\dump\Cubic Ninja.3ds"
```
If you have many games, you can input multiple of them to put many games in at once. NOTE: Make sure your SD card has enough space, the xorpads will amount to the same size as a game.
```
ncchinfo_gen.py "D:\dump\Cubic Ninja.3dS" "D:\dump\Pokemon X.3ds"
```
There are many ways to get the program running in the command prompt, so if you're familiar with how to use it, feel free to use the way you're most comfortable with.
<br/>
##### **EXTRA STEP FOR USERS ON < 7.x 3DS FIRMWARES**:
In the 7.x firmware, Nintendo added a new encryption scheme meant to force users to update to 7.x firmware and up to run the game. Those with a 3DS with a firmware less than 7.x can get around it, but they need to go through an additional step to create the encryption key manually.
First create an empty file named "slot0x25KeyX.bin". The simplest way to do this would be to right click in an explorer window, select create empty text file, and then rename it to "slot0x25KeyX.bin".
**Note**: This will not work if you have "Show known file extensions" disabled.
Then you must use a [hex editor](http://mh-nexus.de/en/hxd/) to put in the key. We cannot provide you with the key, you have to find it yourself unfortunately. Once you do have it, you can literally copy and paste it in on the first line. The hex editor will likely warn you that this will change the length of the file, hit accept and save the file. Then place it on the root of the SD Card. Since this key is universal, you only have to do this step once.
![HxD Key Example](http://i.imgur.com/Tm44cVM.jpg)
The line of FFs should be replaced with the key. It will fill out the whole line and nothing more.
<br/>
**Back to instructions everyone must follow**
Now that all of that is complete, we need to run [Decrypt9](https://github.com/archshift/Decrypt9).
- Run Brahma2 from the homebrew menu, and then select Decrypt9.
- There are several options, but we're just interested in generating xorpads. Hitting A will begin the process.
**Be warned**: this can take an extremely long time on bigger games, so beware! If you've completed this successfully, when you put the SD card back into the computer it'll have at least three xorpad files with fairly long names. If you have these files, congratulations, you can move onto the last step; if not, you'll have to repeat step 3 from the beginning.
<br/>
#### **STEP 4 Applying the Xorpads**
For the final step, we use the last program, [xorer](https://github.com/archshift/xorer) ([mirror](https://puu.sh/r6RRH/c2dee62b4c.zip)). If you don't have that program yet, download it and extract it into a folder. If you want to make your life easier, copy the xorpads off your SD card into this folder with the xorer program, otherwise you'll have an extremely long command with the paths to each file.
Then, using whichever method you prefer, navigate to that folder in command prompt so that you can run the program from command line. Next up we're going to give it a very specific command that will decrypt your 3DS file!
**NOTE:** If youre unsure you did everything correctly, backup the .3ds file! This will overwrite the encrypted one with a decrypted one.
xorer takes 5 inputs total. First make sure you have the program put in, if you've navigated to the folder, that just means typing in xorer so that it knows to run that program. Next up, have one space and navigate to (or drag and drop on) the 3DS dump. If we use the example for earlier, it will look like this currently.
```
xorer "D:\dump\Cubic Ninja.3ds"
```
So, now the beginning of the command is correct. Next we have to feed it all the xorpads. Add a space after the ROM dump and type "-e" and another space. Now find to the xorpad that has exheader in its name. You can either type out its name (if it's in the directory alongside the xorer program) or you can drag it into the command window (regardless of wherever it is at.)
Your command should now show something like this.
```
xorer "D:\dump\Cubic Ninja.3ds" -e "0004000000046500.Main.exheader.xorpad"
```
Now we repeat the step for the remaining commands. -x points to the exefs_norm.xorpad, and then -r points to the romfs_xorpad. For Cubic Ninja, the command would now look like this.
```
xorer "D:\dump\Cubic Ninja.3ds" -e "0004000000046500.Main.exheader.xorpad"
-x "0004000000046500.exefs_norm.xorpad" -r "0004000000046500.romfs.xorpad"
```
Now all we have to do is set the output file. This is what the finalized command will look like for most games, except replaced with your file names.
```
xorer "D:\dump\Cubic Ninja.3ds" -e "0004000000046500.Main.exheader.xorpad"
-x "0004000000046500.exefs_norm.xorpad" -r "0004000000046500.romfs.xorpad" -o CubicNinjaDecrypted.cci
```
**For 7.x or newer firmware games**
For newer games, the command is slightly different. We have to add one more command to give it the 7.x key. This is noted with the -7 command and placing in the exefs_7x.xorpad beyond it.
```
xorer Pokemon.3ds -e 0004003000009702.Main.exheader.xorpad
-x 0004003000009702.Main.exefs_norm.xorpad -7 0004003000009702.Main.exefs_7x.xorpad
-r 0004003000009702.Main.romfs.xorpad -o Pokemon.cci
```
Hit enter, and if it doesn't error out, it worked! The dumped ROM can now be used in Citra.