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.

Requirements

  • 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

Useful notes

  • 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.

Method 1: Decrypted or zero-key encrypted CCI with ctrtool

  1. Put your CCI in its own folder.
  2. 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.3ds

Explanation of possible arguments for this situation:

  • -n part or --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.

Method 2: Decrypted CCI with 3dstool

  1. Put your CCI in its own folder.
  2. 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.cfa

Explanation of possible arguments for this situation:

  • -x or --extract - Extract file
  • -v or --verbose - Print more information
  • -t or --type - optional, Type of file
  • -f or --file - required, Target file
  • --header - File to save the NCSD header to
  • -0 or --partition0 - Save Partition 0 (Game Executable)
  • -1 or --partition1 - Save Partition 1 (Manual)
  • -2 or --partition2 - Save Partition 2 (Download Play Child container)
  • -6 or --partition6 - Save Partition 6 (New3DS Update Data)
  • -7 or --partition7 - Save Partition 7 (Old3DS Update Data)
  1. 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.bin

Explanation of possible arguments for this situation:

  • -x or --extract - Extract file
  • -v or --verbose - Print more information
  • -t or --type - optional, Type of file
  • -f or --file - required, Target file
  • --romfs - File to save the RomFS to
  • --exefs - File to save the ExeFS to
  • --exh or --extendedheader - File to save the Extended Header to
  • --header - File to save the NCCH header to
  • --logo or --logoregion - File to save the Logo to
  • --plain or --plainregion - File to save the Plain region to
  1. 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
  1. Decompress the code.bin.
3dstool -uvf exefs/code.bin --compress-type blz --compress-out decompressed_code.bin

Method 3: Encrypted CCI with 3dstool, using XORpads

  1. Put your CCI and XORpads in a folder.
  2. Extract the CXI/CFA from the CCI.
3dstool -xvt012f cci game.cxi manual.cfa dlpchild.cfa game.3ds

Explanation of possible arguments for this situation:

  • -x or --extract - Extract file
  • -v or --verbose - Print more information
  • -t or --type - optional, Type of file
  • -f or --file - required, Target file
  • --header - File to save the NCSD header to
  • -0 or --partition0 - Save Partition 0 (Game Executable)
  • -1 or --partition1 - Save Partition 1 (Manual)
  • -2 or --partition2 - Save Partition 2 (Download Play Child container)
  • -6 or --partition6 - Save Partition 6 (New3DS Update Data)
  • -7 or --partition7 - Save Partition 7 (Old3DS Update Data)
  1. 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.xorpad

If 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.xorpad

Explanation of possible arguments for this situation:

  • -x or --extract - Extract file
  • -v or --verbose - Print more information
  • -t or --type - optional, Type of file
  • -f or --file - required, Target file
  • --romfs - File to save the RomFS to
  • --exefs - File to save the ExeFS to
  • --exh or --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-xor or --extendedheader-xor - XORpad for Extended Header
  • --header - File to save the NCCH header to
  • --logo or --logoregion - File to save the Logo to
  • --plain or --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
  1. 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
  1. Decompress the code.bin.
3dstool -uf exefs/code.bin --compress-type blz --compress-out decompressed_code.bin
⚠️ **GitHub.com Fallback** ⚠️