Extract a game or application in .cia format - ihaveamac/3DS-rom-tools GitHub Wiki
This guide explains how you can extract the contents out of a decrypted CTR Importable Archive (CIA).
- A decrypted CIA
-
ctrtool
If you are not using a 64-bit operating system, you must build the source yourself for now. - Basic knowledge of the Terminal/Command Line
-
Content Indexes for a CIA (i.e.
XXXX
incontents.XXXX.00000000
)
Downloadable Content (including Themes) do not follow this format. Some system titles also only use a CFA as the first index.Index Use Type 0 Game Executable [[CXI 1 Manual [[CFA 2 Download Play Child container [[CFA
- Put your CIA in its own folder.
- Extract the contents of the CIA. For example, to extract the contents such as Game Executable and Manual:
ctrtool --contents=contents game.cia
Explanation of possible arguments for this situation:
-
--certs=file
- File to save the Certificate chain to -
--tik=file
- File to save the Ticket to -
--tmd=tmd
- File to save the TMD to -
--contents=file
- File to save the Contents to - in most cases this is all you need -
--meta=file
- File to save the Meta region to- This feature is broken on the latest ctrtool release (0.15), it extracts "Contents" instead. If possible, build ctrtool from source, since the bug was fixed since then.
This will create files with names like contents.0000.xxxxxxxx
.
Contents filename format: contents.XXXX.YYYYYYYY
-
contents
- Filename given to--contents=file
-
XXXX
- Content index (see "Useful notes" above) -
YYYYYYYY
- Content ID
- Extract the contents of the CXI. For example, to extract the ExeFS and RomFS from the Game Executable:
ctrtool --exheader=exheader.bin --exefsdir=exefs --romfsdir=romfs --logo=logo.bcma.lz --plainrgn=plain.bin contents.0000.xxxxxxxx
If you get "Unknown file", your CIA might not be decrypted.
Explanation of possible arguments for this situation:
-
--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
For the purposes of these guides, the contents are referred to by different filenames.
-
contents.0000.xxxxxxxx
→game.cxi
-
contents.0001.xxxxxxxx
→manual.cfa
-
contents.0002.xxxxxxxx
→dlpchild.cfa
Note: ctrtool can't extract the NCCH header. You can save the first 0x200 (512) bytes of it to a file, or use 3dstool on the contents.
3dstool -xvtf cxi contents.0000.xxxxxxxx --header ncchheader.bin
Note: ctrtool can't extract the ExeFS header. You can save the first 0x200 (512) bytes of it to a file, use 3dstool on an extracted ExeFS file.
3dstool -xvtf exefs exefs.bin --exefs-dir exefs --header exefsheader.bin
You must also extract the ExeFS contents or you might get a segfault.