Tutorial  Updated

How To: Dump 3DS Carts to CIA, 3DS to CIA, Dump Private Headers & DS Carts

The latest release of Hourglass9//Decrypt9WIP, now allows us to dump our physical 3DS and NDS//DSi Games, as well as our Private Headers from our 3DS games~!
This guide was made for MenuHax and A9LH users, alike~ So you should be good, regardless of your setup~



~Setting Up Hourglass9 with Luma3DS (A9LH-Only)~
As of the latest revision of Plailect's Guide, you should have Hourglass9 on your Start Key, effectively replacing Uncart from previous revisions of the guide. However, for the purpose of this guide, I'll still assume you don't have the latest version. I'll also be making the assumption you are using Luma3DS.
Adapt the guide to whatever CFW or BootManager you are using~ Should be easy enough to figure out by looking at the documentation of your given CFW or BootManager~

Files we'll need:
Latest release of Hourglass9: https://github.com/d0k3/Hourglass9/releases/
aeskeydb.bin (Somewhere here: https://3ds.guide/installing-arm9loaderhax)

Note: I recommend that you delete Uncart, since Hourglass9 now makes it effectively useless.

1. Copy Hourglass9.bin from the Hourglass9 zip to the /luma/payloads/ folder on your SD card.
2. In the /luma/payloads folder, rename Hourglass9.bin to start_Hourglass9.bin
Note: You can change the button behavior to whatever you want that Luma3DS' payload chainloader allows, just look at the wiki for other button options.
Link: https://github.com/AuroraWright/Luma3DS/wiki/Other-features-and-notes#payload-chainloading
3. Once you've gotten aeskeydb.bin, make sure to copy it to the /files9/ folder on your SD card. (If /files9/ does not exist, make one now, and put the aeskeydb.bin there)
4. With the above recommendation, hold the Start key time at boot time to load Hourglass9.



~Setting Up Decrypt9WIP with Luma3DS (A9LH)~
Certain sections of this guide only work with Decrypt9WIP. Sooooooooo, putting this here for people who need to setup Decrypt9WIP for those sections~ Otherwise, skip this~
Adapt the guide to whatever CFW or BootManager you are using~ Should be easy enough to figure out by looking at the documentation of your given CFW or BootManager~

Files we'll need:
Latest release of Decrypt9WIP: https://github.com/d0k3/Decrypt9WIP/releases
aeskeydb.bin (Somewhere here: https://3ds.guide/installing-arm9loaderhax)

Note: I do not recommend replacing Decrypt9WIP with Hourglass9, as Hourglass9 is still a much safer and simpler way of restoring//managing NAND backups on A9LH setups.

1. Copy Decrypt9WIP.bin from the Decrypt9WIP zip to the /luma/payloads/ folder on your SD card.
2. In the /luma/payloads folder, rename Decrypt9WIP.bin to x_Decrypt9WIP.bin
Note: You can change the button behavior to whatever you want that Luma3DS' payload chainloader allows, just look at the wiki for the other options.
Link: https://github.com/AuroraWright/Luma3DS/wiki/Other-features-and-notes#payload-chainloading
3. Once you've gotten aeskeydb.bin, make sure to copy it to the /files9/ folder on your SD card. (If /files9/ does not exist, make one now, and put the aeskeydb.bin there)
4. With the above recommendation, hold the X key time at boot time to load Decrypt9WIP.





~Setting Up Decrypt9WIP (MenuHax)~
I'll assume you don't have the latest version.
If you have followed my adapted MenuHax Guide, then you should have a CtrBootManager entry for Decrypt9WIP, just updating it is enough.
If you didn't follow my adapted MenuHax Guide, you'll have to figure out how to launch it with whatever version//method you are using. However it should be pretty similar and easy to figure out.

Files we'll need:
Latest release of Decrypt9WIP: https://github.com/d0k3/Decrypt9WIP/releases
aeskeydb.bin (Somewhere here: https://3ds.guide/installing-arm9loaderhax)

1. Copy the Decrypt9WIP folder from the Decrypt9WIP zip to the /3ds/ folder on your SD card.
2. Once you've gotten aeskeydb.bin, make a /files9/ folder, and make sure to copy aeskeydb.bin to the /files9/ folder on your SD card
3. Depending on your MenuHax setup, will depend on how you launch Decrypt9WIP.
For some users, they'll need to load up the Homebrew Launcher then launch Decrypt9WIP from there.
Assuming you used my adapted MenuHax Guide, you should be able to use CtrBootManager to launch Decrypt9WIP.
Figure out the method of how your MenuHax Setup launches Decrypt9WIP and you should be good to go~





~Dump 3DS Cart to .CIA~
The latest version of both Hourglass9 or Decrypt9WIP support dumping our physical 3DS cartridges directly to .CIA format. No PC needed~!

1. Open up Hourglass9//Decrypt9WIP.
2. Go to "Gamecart Dumper Options"
3. Select "Dump Cart to CIA"
4. Let it finish and done~! It's that easy~ ^_^ Just use your favorite CIA Installer, like FBI, and that's it~!
5. You can find the created CIA file(s) under your files9 folder. Enjoy!




~Dump 3DS Cart to .3DS format~
The latest version of both Hourglass9 or Decrypt9WIP support dumping our physical 3DS cartridges to four .3DS types (Encrypted-full, Encrypted-trim, Decrypted-full, Decrypted-trim)
Taken from the README
*Dump Cart (full): This feature dumps the full, unaltered data from the inserted cartridge. For 4GB cartridges, the last sector is silently discarded, because the FAT32 file system can't handle files equal or above 4GB. This feature also handles NTR/TWL cartridges (aka. NDS and DSi crtridges).
*Dump Cart (trim): Same as the above feature, but discards the unused padding for smaller output and faster processing. Using this is recommended unless the padding is required for digital preservation purposes.
*Dump & Decrypt Cart (full): Same as 'Dump Cart (full)', but also decrypts the cartridge data on-the-fly. Decrypted cartridge data is required for emulators and recommended for CIA conversion. The recommended CIA conversion tool is 3dsconv. NTR/TWL cartridges are not encrypted and thus won't be decrypted.
*Dump & Decrypt Cart (trim): Same as above, but discards the unused padding for smaller output and faster processing. This is recommended over the above feature.


1. Open up Hourglass9//Decrypt9WIP.
2. Go to "Gamecart Dumper Options"
3. Select between the four options: "Dump Cart (full)" ; "Dump Cart (trim)" ; "[Dump & Decrypt Cart (full)" ; "Dump & Decrypt Cart (trim)" - Depending on your needs and from the descriptions given above.
4. Let it finish and done~! If you want to convert your .3DS dump to .CIA, you must use Decrypt9WIP, so A9LH users will need to set that up, but read on if you want to see how it works~!
5. You can find the created 3DS file(s) under your files9 folder. Enjoy!




~Converting .3DS to .CIA (On 3DS)~
The latest version of Decrypt9WIP supports converting .3DS dumps to .CIA~

1. Make sure all the .3DS dumps that you want to convert to CIA are in the /files9/ directory of your SD Card.
2. Open up Decrypt9WIP.
3. Go to "Content Decryptor Options"
4. Go to "NCCH/NCSD File Options..."
5. Go to "NCCH/NCSD to CIA Converter"
6. Let it finish and done~! It's that easy~ ^_^ Just use your favorite CIA Installer, like FBI, and that's it~!
7. You can find the converted CIA file(s) under your files9 folder. Enjoy!




~Converting Encrypted .3DS to Decrypted .3DS~
If you dumped your .3DS files using either "Dump Cart (full)" or "Dump Cart (trim)"; Then your dumps are Encrypted, the following steps are for people who want to make them Decrypted dumps without redumping, however you'll need to use Decrypt9WIP.

1. Make sure all the Encrypted .3DS dumps that you want to convert to Decrypted .3DS dumps are in the /files9/D9Game directory of your SD Card.
2. Open up Decrypt9WIP.
3. Go to "Content Decryptor Options"
4. Go to "NCCH/NCSD File Options..."
5. Go to "NCCH/NCSD Decryptor"
6. Let it finish and done~! Your Encrypted .3DS dumps are now fully Decrypted .3DS dumps~





~Converting Decrypted .3DS to .CIA (On Windows-PC)~
If you dumped your .3DS files using either "Dump & Decrypt Cart (full)" or "Dump & Decrypt Cart (trim)" ; Then converting to .CIA is pretty simple on a PC. Since these .3DS dumps have been decrypted.
Or if you converted Encrypted .3DS to Decrypted .3DS, then converting to .CIA is also pretty simple on a PC.
This part, will assume you are using a 64-bit Windows PC.
Linux and Mac users will have to look into using 3dsconv through python2.7 (Should be easy to figure out)

Files we'll need:
3dsconv: https://github.com/ihaveamac/3dsconv/releases

1. Download 3dsconv.exe and place it any folder//directory that you want to use as the working directory for the 3DS to CIA conversion.
2. Copy over your 3DS file dumps to the same working directory as 3dsconv.exe (They'll probably be named after the Product ID of the game you dumped)
3. If you dumped your 3DS games as decrypted, then it's a simple drag-and-drop of your decrypted .3ds files onto the 3dsconv.exe, it'll process them and convert the to .CIA (The .CIA converted files will be in the same directory as the .3DS files were)
4. And that's basically it, you're done~! Just drag-and-drop the .CIA files back to your SD Card and install them with your favorite CIA Installer, like FBI.





~Converting Encrypted .3DS to .CIA (On Windows-PC)~
If you dumped your .3DS files using either "Dump Cart (full)" or "Dump Cart (trim)" ; Then converting to .CIA is a bit more involved, since these dumps are Encrypted, we'll need to generate XORPads with Decrypt9WIP to convert them.
This part, will assume you are using a 64-bit Windows PC.
Linux and Mac users will have to look into using 3dsconv through python2.7 (Should be easy to figure out)

Files we'll need:
3dsconv: https://github.com/ihaveamac/3dsconv/releases

1. Download 3dsconv.exe and place it any folder//directory that you want to use as the working directory for the 3DS to CIA conversion.
2. Copy over your 3DS file dumps to the same working directory as 3dsconv.exe (They'll probably be named after the Product ID of the game you dumped)
3. If you dumped your 3DS games as encrypted, then we need to use the command prompt to get our ncchinfo.bin for use with Decrypt9WIP to get our xorpads.
4. On the same directory where 3dsconv.exe and your .3DS dumps are, Shift-RightClick and select "Open command window here"
5. This should have opened a command prompt window with the focus on that working directory of our files.
6. Type in "3dsconv.exe --gen-ncchinfo *.3ds" (This will generate a ncchinfo of all .3ds files in that directory.)
7. Copy and paste the ncchinfo.bin to the root of your SD Card (can also be placed inside the /files9 folder) and insert it into your 3DS.
8. Open up Decrypt9WIP.
9. Go to "XORpad Generator" then to "NCCH Padgen" ~ Now watch it generate//create your xorpads~!
10. Once it's done, make sure it has a "succeeded!" message, once you see that, go ahead and press B to return to the menu.
11. Press dpad left + start to power off.
12. Remove your SD Card from your 3DS, and insert it into your Computer and copy all the files that end with .xorpad to the same working directory as 3dsconv.exe and your .3ds dumps.
13. With all that done, it's now a simple drag-and-drop of your encrypted .3ds files onto the 3dsconv.exe, it'll process them and convert the to .CIA (The .CIA converted files will be in the same directory as the .3DS files were)
14. And that's basically it, you're done~! Just drag-and-drop the .CIA files back to your SD Card and install them with your favorite CIA Installer, like FBI.





~Creating .CIA file(s) from installed content//game(s) (On 3DS)~
The latest version of both Hourglass9 or Decrypt9WIP support creating a .CIA from an already installed game.

Use http://www.3dsdb.com/ to figure out what the title ID is for the game you want to build a .CIA for. Or use FBI, under Titles to find out that title ID.


1. Open up Hourglass9 -> Miscellaneous Options -> SysNAND title to CIA or EmuNAND title to CIA (depending on which NAND the 3DS game was tied to)
2. Use the arrow keys (right-left and down-up) and find the title ID for your game.
I'll use Pokemon Moon as an example, which the title id is: 0004000000175E00 - it'll be displayed in Hourglass9 as /title/00040000/00175E00
3. Once you've found and selected the folder that matchedd the title ID for your game, press A.
4. It will now attempt to build the CIA
5. You can find the created CIA file under your files9 folder. Enjoy!

1. Open up Decrypt9WIP -> Content Decryptor Options -> CIA Builder Options -> CIA Builder (SysNAND/decr.) or CIA Builder (EmuNAND/decr.)(depending on which NAND the 3DS game was tied to)
2. Use the arrow keys (right-left and down-up) and find the title ID for your game.
I'll use Pokemon Moon as an example, which the title id is: 0004000000175E00 - it'll be displayed in Decrypt9WIP as /title/00040000/00175E00
3. Once you've found and selected the folder that matchedd the title ID for your game, press A.
4. It will now attempt to build the CIA
5. You can find the created CIA file(s) under your files9 folder. Enjoy!





~Dumping//Extracting our Private Header(s)~
The latest version of both Hourglass9 or Decrypt9WIP support dumping//extracting our Private Headers. However, they are only really useful and important for flashcard users, but I've added this for the people who want to and need this~

1. Open up Decrypt9WIP//Hourglass9.
2. Go to "Gamecart Dumper Options" and select "Dump Private Header"
3. And that's it~ It'll dump it to your SD Card named something along the lines of ProductID-private.bin
4. For the Unique ID value, it'll be displayed on the screen when dumping your header. You can go ahead and note it down. Or take the more sane approach, which I'll describe in the next couple of steps.
5. Once done, make sure it has a "succeeded!" message, once you see that, go ahead and press B to return to the menu.
6. Press dpad left + start to power off.
7. Copy your private-header.bin from the /files9 folder to somewhere safe, or if you actually wanted the .bin, just use it however you plan to.
8. Open the Decrypt9.log//Hourglass9.log with Notepad++ or with WordPad or with whatever txt editor you want (It'll look jumbled up in normal Notepad on Windows - I don't recommend you use that)
9. Look for the Unique ID entry, and there it is~! Now copy and keep it somewhere safe and use it for whatever you were going to do with it~





~Dump NDS//DSi Carts to .NDS format~
The latest version of both Hourglass9 or Decrypt9WIP support dumping our physical DS cartridges to .NDS format~ (Either full or trimmed)
Taken from the README:
Dump Cart (full): This feature dumps the full, unaltered data from the inserted cartridge. For 4GB cartridges, the last sector is silently discarded, because the FAT32 file system can't handle files equal or above 4GB. This feature also handles NTR/TWL cartridges (aka. NDS and DSi crtridges).
Dump Cart (trim): Same as the above feature, but discards the unused padding for smaller output and faster processing. Using this is recommended unless the padding is required for digital preservation purposes.
Dump & Decrypt Cart (full): Same as 'Dump Cart (full)', but also decrypts the cartridge data on-the-fly. Decrypted cartridge data is required for emulators and recommended for CIA conversion. The recommended CIA conversion tool is 3dsconv. NTR/TWL cartridges are not encrypted and thus won't be decrypted.
Dump & Decrypt Cart (trim): Same as above, but discards the unused padding for smaller output and faster processing. This is recommended over the above feature.
Dump Cart to CIA: Use this to directly dump an inserted cartridge to a fully decrypted CIA file, which can be installed to a patched system using CIA installer software like FBI. For most users, this type of dump will be the most convenient. NTR/TWL cartridges can't be dumped to a CIA file.


1. Open up Decrypt9WIP//Hourglass9.
2. Go to "Gamecart Dumper Options"
3. Select between either: "Dump Cart (full)" or "Dump Cart (trim)" (Since NTR/TWL cartridges aren't encrypted, the decrypted options won't do anything different.)
4. Let it finish and done~! Use your .NDS dumps anyway you want~ ^_^
5. Your .NDS dumps should be in the files9 folder.
 
Last edited by Temptress Cerise,

Jayro

MediCat USB Dev
Developer
Joined
Jul 23, 2012
Messages
12,982
Trophies
4
Location
WA State
Website
ko-fi.com
XP
17,019
Country
United States
Still waiting for a .3DS to .CIA conversion app on the 3DS side of things, meaning no computer required to copy my carts to my sysnand and play them... Simple cart dumping to a readily-installable .CIA is my goal, and hopefully somebody will eventually pull through.
 

Temptress Cerise

Miss Magic~ <3
OP
Member
Joined
May 1, 2016
Messages
2,242
Trophies
1
XP
2,336
Country
United States
Still waiting for a .3DS to .CIA conversion app on the 3DS side of things, meaning no computer required to copy my carts to my sysnand and play them... Simple cart dumping to a readily-installable .CIA is my goal, and hopefully somebody will eventually pull through.
I would not be surprised if d0k3 is already working on it. :P
 
  • Like
Reactions: Jayro

d0k3

3DS Homebrew Legend
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
Nice, new tuts! It may have already pointed out, but you can drag and drop .3ds files on 3dsconv.exe just fine. No need to bother standard users with entering stuff on the command line!
 
  • Like
Reactions: Temptress Cerise

Temptress Cerise

Miss Magic~ <3
OP
Member
Joined
May 1, 2016
Messages
2,242
Trophies
1
XP
2,336
Country
United States
Nice, new tuts! It may have already pointed out, but you can drag and drop .3ds files on 3dsconv.exe just fine. No need to bother standard users with entering stuff on the command line!
Yus~ I included steps for both, Decypted and Encrypted. The steps are just a tad longer for people who have Encrypted 3DS dumps~ ^_^ I guess I could have shown people how to decrypt their dumps using Decrypt9, without the need for xorpads, but I don't think that's the best option, especially for N3DS users, who some would have to use wireless transfer to push their Encrypted 3DS dumps to their 3DS, and then back to convert, only to push the converted CIA back. While, getting xorpads would be a faster and more convenient method for N3DS users. I think.

Edit: You rock~ <3
 
  • Like
Reactions: d0k3

ihaveahax

Well-Known Member
Member
Joined
Apr 20, 2015
Messages
6,069
Trophies
2
XP
7,830
Country
United States
just a small note, makerom isn't needed anymore. I managed to figure out what I could get away with not updating in the CIA format and now the script builds the CIA itself entirely. :)

I've only tested it with two games so far, both encrypted and decrypted. please tell me if anything goes wrong, including game name.

https://github.com/ihaveamac/3dsconv/releases/tag/v3.0
 
  • Like
Reactions: Temptress Cerise

d0k3

3DS Homebrew Legend
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
just a small note, makerom isn't needed anymore. I managed to figure out what I could get away with not updating in the CIA format and now the script builds the CIA itself entirely. :)

I've only tested it with two games so far, both encrypted and decrypted. please tell me if anything goes wrong, including game name.

https://github.com/ihaveamac/3dsconv/releases/tag/v3.0
Whoa, makerrom is not needed anymore? Is this all in that commit?
https://github.com/ihaveamac/3dsconv/commit/fc67c69ed580f98f64999448543239a62cfcb9f7
 
  • Like
Reactions: ihaveahax

ihaveahax

Well-Known Member
Member
Joined
Apr 20, 2015
Messages
6,069
Trophies
2
XP
7,830
Country
United States
Whoa, makerrom is not needed anymore? Is this all in that commit?
https://github.com/ihaveamac/3dsconv/commit/fc67c69ed580f98f64999448543239a62cfcb9f7
you could see this for all of the commits, though most is in that one: https://github.com/ihaveamac/3dsconv/compare/f640f3fce1dffaec495f5072b749d21a153ee4ff...master

I basically hard-coded the certificate chain (it doesn't change on any CIA), a template ticket to write the title ID to, and a partial TMD to write content count, save data size, title ID, hashes, etc...

after testing it with encrypted + decrypted games, it works including the Manual on both.

code's probably bad in some places, but it works on my machine. took a few hours to figure out what to do and what order.

it's also faster, since it writes to the CIA immediately and calculates hashes while it does that.
 
Last edited by ihaveahax,
  • Like
Reactions: Temptress Cerise

d0k3

3DS Homebrew Legend
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
you could see this for all of the commits, though most is in that one: https://github.com/ihaveamac/3dsconv/compare/f640f3fce1dffaec495f5072b749d21a153ee4ff...master

I basically hard-coded the certificate chain (it doesn't change on any CIA), a template ticket to write the title ID to, and a partial TMD to write content count, save data size, title ID, hashes, etc...

after testing it with encrypted + decrypted games, it works including the Manual on both.

code's probably bad in some places, but it works on my machine. took a few hours to figure out what to do and what order.

it's also faster, since it writes to the CIA immediately and calculates hashes while it does that.
This is great stuff! I'm actually thinking about adding this to D9 now. Don't worry, it won't make your tool obsolete, cause obviously doing it in D9 will be slow as hell.
 

ihaveahax

Well-Known Member
Member
Joined
Apr 20, 2015
Messages
6,069
Trophies
2
XP
7,830
Country
United States
This is great stuff! I'm actually thinking about adding this to D9 now. Don't worry, it won't make your tool obsolete, cause obviously doing it in D9 will be slow as hell.
oh of course, I was thinking "if this works, decrypt9 could dump directly to cia" when doing this. I have no issue if it "makes my tool obsolete", that's just how things work. :P

again, my code is probably not very good, especially since I was kind of tired. if something doesn't make sense, I can try to help with what's going on.

first thing you'll probably want to do is decode the block of text(it's base64), then decompress it. I used zlib for that. then add 2412 "00" bytes to the end (these aren't here at fist just so it compresses better). now you have the cert chain, template ticket, and partial TMD (doesn't have content chunk records at the end, since the size of this varies).

I hope this makes sense.... I'm tired-ish lol
 
Last edited by ihaveahax,
  • Like
Reactions: Temptress Cerise

Temptress Cerise

Miss Magic~ <3
OP
Member
Joined
May 1, 2016
Messages
2,242
Trophies
1
XP
2,336
Country
United States
just a small note, makerom isn't needed anymore. I managed to figure out what I could get away with not updating in the CIA format and now the script builds the CIA itself entirely. :)

I've only tested it with two games so far, both encrypted and decrypted. please tell me if anything goes wrong, including game name.

https://github.com/ihaveamac/3dsconv/releases/tag/v3.0
Guide updated (makerom removed).

Games tested.
Pokemon Alpha Sapphire (Decrypted Dump)
Pokemon Omega Ruby (Decrypted Dump)
Pokemon Y (Encrypted Dump)
Etrian Odyssey IV (Encrypted Dump)
Etrian Odyssey Untold (Encrypted Dump)
Fire Emblem Fates (Encrypted Dump)
Freakyforms Deluxe (Encrypted Dump)

Everything seems to have converted just fine. Haven't actually attempted to install the .CIAs these spit out, I guess I'll do that tonight for some of these games, though doubt I'll have problem installing them. ^_^

This is great stuff! I'm actually thinking about adding this to D9 now. Don't worry, it won't make your tool obsolete, cause obviously doing it in D9 will be slow as hell.
Think some people would appreciate being able to dump .3ds and convert right to .cia, even if it's super slow and time consuming. ^_^

I personally prefer dumping and storing my .3ds dumps, then converting when I want to. ^_^
 
  • Like
Reactions: d0k3

d0k3

3DS Homebrew Legend
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
oh of course, I was thinking "if this works, decrypt9 could dump directly to cia" when doing this. I have no issue if it "makes my tool obsolete", that's just how things work. :P

again, my code is probably not very good, especially since I was kind of tired. if something doesn't make sense, I can try to help with what's going on.

first thing you'll probably want to do is decode the block of text(it's base64), then decompress it. I used zlib for that. then add 2412 "00" bytes to the end (these aren't here at fist just so it compresses better). now you have the cert chain, template ticket, and partial TMD (doesn't have content chunk records at the end, since the size of this varies).

I hope this makes sense.... I'm tired-ish lol
What are you using for the title key, btw? Riku did use one and the same titlekey for every CIA, which might be a bad idea (easy to detect illegit CIAs). A randomized titlekey maybe better, especially since you don't actually use a titlekey in these CIAs. Not completely sure, though.
 

ihaveahax

Well-Known Member
Member
Joined
Apr 20, 2015
Messages
6,069
Trophies
2
XP
7,830
Country
United States
What are you using for the title key, btw? Riku did use one and the same titlekey for every CIA, which might be a bad idea (easy to detect illegit CIAs). A randomized titlekey maybe better, especially since you don't actually use a titlekey in these CIAs. Not completely sure, though.
00000000000000000000000000000000 every time, in the "template". I can try adding a randomized titlekey if you'd like.
 
Last edited by ihaveahax,

d0k3

3DS Homebrew Legend
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
00000000000000000000000000000000 every time, in the "template". I can try adding a randomized titlekey if you'd like.
Nah, maybe leave that be. This hasn't been any real problem with Riku converted roms in the past, and it most likely will never be with yours.
 

ihaveahax

Well-Known Member
Member
Joined
Apr 20, 2015
Messages
6,069
Trophies
2
XP
7,830
Country
United States
This is great stuff! I'm actually thinking about adding this to D9 now. Don't worry, it won't make your tool obsolete, cause obviously doing it in D9 will be slow as hell.
actually now I have to ask, how would it be "slow as hell"? it would just dump (and maybe decrypt) the partitions directly to a CIA file and calculate the content hashes while dumping, not dump partitions then create a CIA from them. then when it's done, edit the ticket/tmd/etc for a few sha256 hashes, add save data size from exheader, etc. if anything it should be just as fast as normally dumping. unless I'm missing something...
 

d0k3

3DS Homebrew Legend
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
actually now I have to ask, how would it be "slow as hell"? it would just dump (and maybe decrypt) the partitions directly to a CIA file and calculate the content hashes while dumping, not dump partitions then create a CIA from them. then when it's done, edit the ticket/tmd/etc for a few sha256 hashes, add save data size from exheader, etc. if anything it should be just as fast as normally dumping. unless I'm missing something...
You do miss something... Actually, decrypting NCCHs on the fly is not a straightforward process, and calculating SHA on the fly would only make things more complicated (no guarantees it is possible at all). Also, think about cases where users already have 3DS files - your tool would be x times faster in those cases.
 

ihaveahax

Well-Known Member
Member
Joined
Apr 20, 2015
Messages
6,069
Trophies
2
XP
7,830
Country
United States
You do miss something... Actually, decrypting NCCHs on the fly is not a straightforward process, and calculating SHA on the fly would only make things more complicated (no guarantees it is possible at all). Also, think about cases where users already have 3DS files - your tool would be x times faster in those cases.
for existing dumps, of course PC is faster.

but for dumping cards, does it actually need to dump decrypted to a CIA? since this happens on the 3DS, you can probably read the encrypted contents just fine. the only parts that need modification are the bit in the exheader, and the exheader hash in the NCCH header. the rest doesn't need to be decrypted.

I mean, these are just my thoughts. I'm not entirely sure if it's possible exactly this way, you know more about how this could work than me.
 

d0k3

3DS Homebrew Legend
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
for existing dumps, of course PC is faster.

but for dumping cards, does it actually need to dump decrypted to a CIA? since this happens on the 3DS, you can probably read the encrypted contents just fine. the only parts that need modification are the bit in the exheader, and the exheader hash in the NCCH header. the rest doesn't need to be decrypted.

I mean, these are just my thoughts. I'm not entirely sure if it's possible exactly this way, you know more about how this could work than me.
I'll look into it :). Tbh, another possible issue I see with this is the cert... Idk if it's okay to include this (copyright issues), and I need to pay attention (as D9 by now has received a lot of attention). Could be solved with an external file, of course... Anyways, more later.
 

ihaveahax

Well-Known Member
Member
Joined
Apr 20, 2015
Messages
6,069
Trophies
2
XP
7,830
Country
United States
I'll look into it :). Tbh, another possible issue I see with this is the cert... Idk if it's okay to include this (copyright issues), and I need to pay attention (as D9 by now has received a lot of attention). Could be solved with an external file, of course... Anyways, more later.
the certificate chain is the same for every CIA i've seen from makerom and (I think) make_cdn_cia. these two tools get shared around all the time, on gbatemp included. i'm fairly sure it's fine. but, up to you.
 

d0k3

3DS Homebrew Legend
Member
Joined
Dec 3, 2004
Messages
2,786
Trophies
1
XP
3,896
Country
Germany
the certificate chain is the same for every CIA i've seen from makerom and (I think) make_cdn_cia. these two tools get shared around all the time, on gbatemp included. i'm fairly sure it's fine. but, up to you.
Could you perhaps provide the decompressed helper file? I know, this is lazy, but you're bound to have it lying around somewhere anyways, and I could save an hour or so figuring out how to decompress it myself. I might have more questions later, ofc, too.
 

ihaveahax

Well-Known Member
Member
Joined
Apr 20, 2015
Messages
6,069
Trophies
2
XP
7,830
Country
United States
Could you perhaps provide the decompressed helper file? I know, this is lazy, but you're bound to have it lying around somewhere anyways, and I could save an hour or so figuring out how to decompress it myself. I might have more questions later, ofc, too.
like magic...

this is basically what I used, for future reference:
Code:
#!/usr/bin/env python2
import zlib

ciainfo = """
<base64 encoded string>
"""

with open("decoded.bin", "wb") as f:
    f.write(zlib.decompress(ciainfo.decode('base64')) + ("\x00" * 2412))  # encoded string doesn't include the zeros at the end to compress better
sure, ask anything you need/want.

just a reminder: this contains the cert chain, template ticket with blank titlekey/title id, and incomplete template ticket (doesn't include Content chunk records, since this varies in size it's added manually)
 

Attachments

  • decoded.bin.zip
    2.2 KB · Views: 214
Last edited by ihaveahax,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    BakerMan @ BakerMan: @salazarcosplay yeah cod's still up