Extract a game or application in .3ds or .cci format - ihaveamac/3DS-rom-tools GitHub Wiki
This guide explains how you can extract the contents out of a CTR Cart Image (.3ds/.cci), an NCSD container, decrypted or using or XORpads.
- A decrypted CCI, the recommended option
or XORpads for an encrypted CCI (zero-key encrypted CCIs do not need decryption) -
ctrtool
If you are not using a 64-bit operating system, you must build the source yourself for now. - 3dstool, required if using XORpads
- Basic knowledge of the Terminal/Command Line
-
NCCH partitions of a CCI
Partition Use Type 0 Game Executable [[CXI 1 Manual [[CFA 2 Download Play Child container [[CFA 6 New3DS Update Data [[CFA 7 Old3DS Update Data [[CFA 3, 4, and 5 do exist, but don't usually contain anything.
- Put your CCI in its own folder.
- Extract the contents of the CCI. For example, to extract the ExeFS and RomFS to directories from first NCCH partition:
ctrtool --exefsdir=exefs --romfsdir=romfs --exheader=exheader.bin game.3dsExplanation of possible arguments for this situation:
-
-n partor--ncch=part- NCCH partition to use (use the table above), default 0 -
--exheader=file- File to save the Extended Header to -
--logo=file- File to save the Logo to -
--plainrgn=file- File to save the Plain region to -
--exefs=file- File to save the ExeFS to -
--exefsdir=dir- Directory to save the ExeFS contents to -
--romfs=file- File to save the RomFS to -
--romfsdir=dir- Directory to save the RomFS contents to -
--listromfs- List RomFS contents
Note: ctrtool can't extract the NCCH partition as a single file or the header. Use 3dstool to extract the CXI/CFA from the CCI, and then the header.
- Put your CCI in its own folder.
- Extract the CXI/CFAs of the CCI. For example, to extract the Game Executable and Manual:
3dstool -xvtf cci game.3ds --header ncsdheader.bin -0 game.cxi -1 manual.cfa -2 dlpchild.cfaExplanation of possible arguments for this situation:
-
-xor--extract- Extract file -
-vor--verbose- Print more information -
-tor--type- optional, Type of file -
-for--file- required, Target file -
--header- File to save the NCSD header to -
-0or--partition0- Save Partition 0 (Game Executable) -
-1or--partition1- Save Partition 1 (Manual) -
-2or--partition2- Save Partition 2 (Download Play Child container) -
-6or--partition6- Save Partition 6 (New3DS Update Data) -
-7or--partition7- Save Partition 7 (Old3DS Update Data)
- Extract the contents the CXI. For example, to extract the ExHeader, ExeFS and RomFS from the Game Executable:
3dstool -xvtf cxi game.cxi --header ncchheader.bin --exh exheader.bin --exefs exefs.bin --romfs romfs.bin --logo logo.bcma.lz --plain plain.binExplanation of possible arguments for this situation:
-
-xor--extract- Extract file -
-vor--verbose- Print more information -
-tor--type- optional, Type of file -
-for--file- required, Target file -
--romfs- File to save the RomFS to -
--exefs- File to save the ExeFS to -
--exhor--extendedheader- File to save the Extended Header to -
--header- File to save the NCCH header to -
--logoor--logoregion- File to save the Logo to -
--plainor--plainregion- File to save the Plain region to
- Extract the contents of the ExeFS and RomFS.
3dstool -xvtf romfs romfs.bin --romfs-dir romfs
3dstool -xvtf exefs exefs.bin --exefs-dir exefs --header exefsheader.bin- Decompress the code.bin.
3dstool -uvf exefs/code.bin --compress-type blz --compress-out decompressed_code.bin- Put your CCI and XORpads in a folder.
- Extract the CXI/CFA from the CCI.
3dstool -xvt012f cci game.cxi manual.cfa dlpchild.cfa game.3dsExplanation of possible arguments for this situation:
-
-xor--extract- Extract file -
-vor--verbose- Print more information -
-tor--type- optional, Type of file -
-for--file- required, Target file -
--header- File to save the NCSD header to -
-0or--partition0- Save Partition 0 (Game Executable) -
-1or--partition1- Save Partition 1 (Manual) -
-2or--partition2- Save Partition 2 (Download Play Child container) -
-6or--partition6- Save Partition 6 (New3DS Update Data) -
-7or--partition7- Save Partition 7 (Old3DS Update Data)
- Extract the contents of the CXI using the XORpads. For example...
If you have one ExeFS XORpad (
000400000XXXXX00.Main.exefs_norm.xorpad):
3dstool -xvtf cxi game.cxi --exh exheader.bin --exefs exefs.bin --romfs romfs.bin --logo logo.bcma.lz --plain plain.bin --exh-xor 000400000XXXXX00.Main.exheader.xorpad --exefs-xor 000400000XXXXX00.Main.exefs_norm.xorpad --romfs-xor 000400000XXXXX00.Main.romfs.xorpadIf you have two ExeFS XORpads (000400000XXXXX00.Main.exefs_norm.xorpad and 000400000XXXXX00.Main.exefs_7x.xorpad):
3dstool -xvtf cxi game.cxi --exh exheader.bin --exefs exefs.bin --romfs romfs.bin --exh-xor 000400000XXXXX00.Main.exheader.xorpad --exefs-xor 000400000XXXXX00.Main.exefs_norm.xorpad --exefs-top-xor 000400000XXXXX00.Main.exefs_7x.xorpad --romfs-xor 000400000XXXXX00.Main.romfs.xorpadExplanation of possible arguments for this situation:
-
-xor--extract- Extract file -
-vor--verbose- Print more information -
-tor--type- optional, Type of file -
-for--file- required, Target file -
--romfs- File to save the RomFS to -
--exefs- File to save the ExeFS to -
--exhor--extendedheader- File to save the Extended Header to -
--exefs-xor- XORpad for ExeFS -
--exefs-top-xor- XORpad for ExeFS (7.x/9.3/9.6) -
--romfs-xor- XORpad for RomFS -
--exh-xoror--extendedheader-xor- XORpad for Extended Header -
--header- File to save the NCCH header to -
--logoor--logoregion- File to save the Logo to -
--plainor--plainregion- File to save the Plain region to
Possible XORpads (all beginning with 000400000XXXXX00), assuming ncchinfo_gen from this repository was used:
-
.Main.exheader.xorpad- Game Executable ExHeader -
.Main.exefs_norm.xorpad- Game Executable ExeFS -
.Main.exefs_7x.xorpad- Game Executable ExeFS (7.x/9.3/9.6) -
.Main.romfs.xorpad- Game Executable RomFS -
.Manual.romfs.xorpad- Manual RomFS -
.DownloadPlay.romfs.xorpad- Download Play Child container RomFS -
.N3DSUpdateData.romfs.xorpad- New3DS Update Data RomFS -
.O3DSUpdateData.romfs.xorpad- Old3DS Update Data RomFS
- Extract the contents of the ExeFS and RomFS if needed.
3dstool -xvtf romfs romfs.bin --romfs-dir romfs
3dstool -xvtf exefs exefs.bin --exefs-dir exefs --header exefsheader.bin- Decompress the code.bin.
3dstool -uf exefs/code.bin --compress-type blz --compress-out decompressed_code.bin