Rebuilding a game or application in .cia format - ihaveamac/3DS-rom-tools GitHub Wiki
This guide explains how you can rebuild a CTR Importable Archive (CIA) from the extracted contents of another CIA.
This guide is focused on rebuilding contents that were already extracted from a CIA. If you're rebuilding based off a CCI (.3ds/.cci), at the moment it would be easier to convert it to CIA using a tool like 3dsconv first.
This page is still a work in progress, and not everything on it has been fully tested.
- Work in progress
-
ctrtool and makerom
If you are not using a 64-bit operating system, you must build the source yourself for now. - 3dstool
- A 3DS system with signature patches to install "un-legit" CIA files
- An extracted game's contents. You need:
- an NCCH header,
- an ExHeader
- a Logo region (in pre-5.0.0-11 games, this is in the ExeFS)
- an ExeFS
- a RomFS
- 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 -
Small note: If you are rebuilding a title to be installed to NAND, you must encrypt NCCH first with Decrypt9, after rebuilding the CIA. Place your CIA in
/files9
, then go to "Game Decryptor Options", "CIA File Options..." and "CIA Encryptor (NCCH)".
Warning: This is currently not fully tested.
- Make sure you have extracted:
- the CIA's contents,
- the NCCH header, ExHeader, Logo region, Plain region, ExeFS and RomFS have been extracted from the first content (Game Executable),
- Note that the Logo region is inside the ExeFS for pre-5.0.0-11 applications.
- the ExeFS header extracted (if the ExeFS contents were extracted at all),
See Extract .cia for details on extracting.
- If you want to edit the title ID, it needs to be edited in the NCCH header and ExHeader. For other contents (CFAs) besides Game Executable, the CFA can be edited directly instead.
- If the ExeFS needs to be rebuilt, use 3dstool to rebuild:
3dstool -cvtf exefs exefs.bin --exefs-dir exefs/ --header exefsheader.bin
- If the RomFS needs to be rebuilt, use 3dstool to rebuild:
3dstool -cvtf romfs romfs.bin --romfs-dir romfs/
- Use 3dstool to rebuild the CXI. For example:
3dstool -cvtf cxi game.cxi --header ncchheader.bin --exh exheader.bin --logo logo.bcma.lz --plain plain.bin --exefs exefs.bin --romfs romfs.bin
Explanation of possible arguments for this situation:
-
-c
or--create
- Create file -
-v
or--verbose
- Print more information -
-t
or--type
- optional, Type of file -
-f
or--file
- required, Target file -
--header
- NCCH header to use -
--exh
or--extendedheader
- Extended Header to use -
--logo
or--logoregion
- Logo to use (only for 5.0.0-11+ applications) -
--plain
or--plainregion
- Plain region to use -
--romfs
- RomFS to use -
--exefs
- ExeFS to use
- Use makerom to rebuild the CIA with the contents. Include any others you might want, with the appropriate index.
For example, to include just the Game Executable:
makerom -f cia -o game.cia -content game.cxi:0:0
...or to include the Manual and Download Play child container as well:
makerom -f cia -o game.cia -content game.cxi:0:0 -content manual.cfa:1:1 -content dlpchild.cfa:2:2
Explanation of possible arguments for this situation:
-
-f
- Format to save as -
-o
- File to save to -
-content file:index:id
- Content to include, "id
" not required -
-ver
- Title Version, accepts decimal and hex -
-major
- Major version -
-minor
- Minor version -
-micro
- Micro version