3dstool included samples - ihaveamac/3DS-rom-tools GitHub Wiki

sample:
# extract cci
3dstool -xvt017f cci 0.cxi 1.cfa 7.cfa input.3ds --header ncsdheader.bin

# extract cxi without encryption
3dstool -xvtf cxi 0.cxi --header ncchheader.bin --exh exh.bin --logo logo.bcma.lz --plain plain.bin --exefs exefs.bin --romfs romfs.bin

# extract cxi with AES-CTR encryption
3dstool -xvtf cxi 0.cxi --header ncchheader.bin --exh exh.bin --logo logo.bcma.lz --plain plain.bin --exefs exefs.bin --romfs romfs.bin --key 00000000000000000000000000000000

# extract cxi with xor encryption
3dstool -xvtf cxi 0.cxi --header ncchheader.bin --exh exh.bin --logo logo.bcma.lz --plain plain.bin --exefs exefs.bin --romfs romfs.bin --exh-xor 000400000XXXXX00.Main.exheader.xorpad --exefs-xor 000400000XXXXX00.Main.exefs_norm.xorpad --romfs-xor 000400000XXXXX00.Main.romfs.xorpad

# extract cxi with 7.x xor encryption
3dstool -xvtf cxi 0.cxi --header ncchheader.bin --exh exh.bin --logo logo.bcma.lz --plain plain.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

# extract cxi with 7.x auto encryption
3dstool -xvtf cxi 0.cxi --header ncchheader.bin --exh exh.bin --logo logo.bcma.lz --plain plain.bin --exefs exefs.bin --romfs romfs.bin --exh-xor 000400000XXXXX00.Main.exheader.xorpad --exefs-xor 000400000XXXXX00.Main.exefs_norm.xorpad --exefs-top-auto-key --romfs-auto-key

# extract cfa without encryption
3dstool -xvtf cfa 1.cfa --header ncchheader.bin --romfs romfs.bin

# extract cfa with AES-CTR encryption
3dstool -xvtf cfa 1.cfa --header ncchheader.bin --romfs romfs.bin --key 00000000000000000000000000000000

# extract cfa with xor encryption
3dstool -xvtf cfa 1.cfa --header ncchheader.bin --romfs romfs.bin --romfs-xor 000400000XXXXX00.Manual.romfs.xorpad

# extract exefs without Backward LZ77 uncompress
3dstool -xvtf exefs exefs.bin --header exefsheader.bin --exefs-dir exefs

# extract exefs with Backward LZ77 uncompress
3dstool -xuvtf exefs exefs.bin --header exefsheader.bin --exefs-dir exefs

# extract romfs
3dstool -xvtf romfs romfs.bin --romfs-dir romfs

# extract banner
3dstool -xvtf banner banner.bnr --banner-dir banner

# create cci with pad 0xFF
3dstool -cvt017f cci 0.cxi 1.cfa 7.cfa output.3ds --header ncsdheader.bin

# create cci without pad
3dstool -cvt017f cci 0.cxi 1.cfa 7.cfa output.3ds --header ncsdheader.bin --not-pad

# create cxi without encryption and calculate hash
3dstool -cvtf cxi 0.cxi --header ncchheader.bin --exh exh.bin --logo logo.bcma.lz --plain plain.bin --exefs exefs.bin --romfs romfs.bin --not-update-exh-hash --not-update-exefs-hash --not-update-romfs-hash

# create cxi with AES-CTR encryption and calculate hash
3dstool -cvtf cxi 0.cxi --header ncchheader.bin --exh exh.bin --logo logo.bcma.lz --plain plain.bin --exefs exefs.bin --romfs romfs.bin --key 00000000000000000000000000000000

# create cxi with xor encryption and calculate hash
3dstool -cvtf cxi 0.cxi --header ncchheader.bin --exh exh.bin --logo logo.bcma.lz --plain plain.bin --exefs exefs.bin --romfs romfs.bin --exh-xor 000400000XXXXX00.Main.exheader.xorpad --exefs-xor 000400000XXXXX00.Main.exefs_norm.xorpad --romfs-xor 000400000XXXXX00.Main.romfs.xorpad

# create cxi with 7.x xor encryption and calculate hash
3dstool -cvtf cxi 0.cxi --header ncchheader.bin --exh exh.bin --logo logo.bcma.lz --plain plain.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

# create cxi with 7.x auto encryption and calculate hash
3dstool -cvtf cxi 0.cxi --header ncchheader.bin --exh exh.bin --logo logo.bcma.lz --plain plain.bin --exefs exefs.bin --romfs romfs.bin --exh-xor 000400000XXXXX00.Main.exheader.xorpad --exefs-xor 000400000XXXXX00.Main.exefs_norm.xorpad --exefs-top-auto-key --romfs-auto-key

# create cfa without encryption and calculate hash
3dstool -cvtf cfa 1.cfa --header ncchheader.bin --romfs romfs.bin --not-update-romfs-hash

# create cfa with AES-CTR encryption and calculate hash
3dstool -cvtf cfa 1.cfa --header ncchheader.bin --romfs romfs.bin --key 00000000000000000000000000000000

# create cfa with xor encryption and calculate hash
3dstool -cvtf cfa 1.cfa --header ncchheader.bin --romfs romfs.bin --romfs-xor 000400000XXXXX00.Main.romfs.xorpad

# create exefs without Backward LZ77 compress
3dstool -cvtf exefs exefs.bin --header exefsheader.bin --exefs-dir exefs

# create exefs with Backward LZ77 compress
3dstool -czvtf exefs exefs.bin --header exefsheader.bin --exefs-dir exefs

# create romfs without reference
3dstool -cvtf romfs romfs.bin --romfs-dir romfs

# create romfs with reference
3dstool -cvtf romfs romfs.bin --romfs-dir romfs --romfs original_romfs.bin

# create banner
3dstool -cvtf banner banner.bnr --banner-dir banner

# encrypt file with AES-CTR encryption, standalone
3dstool -evf file.bin --key 00000000000000000000000000000000 --counter 00000000000000000000000000000000

# encrypt file with xor encryption, standalone
3dstool -evf file.bin --xor xor.bin

# uncompress file with Backward LZ77, standalone
3dstool -uvf code.bin --compress-type blz --compress-out code.bin

# compress file with Backward LZ77, standalone
3dstool -zvf code.bin --compress-type blz --compress-out code.bin

# uncompress file with LZ77, standalone
3dstool -uvf input.lz --compress-type lz --compress-out output.bin

# compress file with LZ77, standalone
3dstool -zvf input.bin --compress-type lz --compress-out output.lz

# compress file with LZ77 and align to 4 bytes, standalone
3dstool -zvf input.bin --compress-type lz --compress-out output.lz --compress-align 4

# uncompress file with LZ77Ex, standalone
3dstool -uvf logo.bcma.lz --compress-type lzex --compress-out logo.bcma

# compress file with LZ77Ex, standalone
3dstool -zvf logo.bcma --compress-type lzex --compress-out logo.bcma.lz

# uncompress file with Huffman 4bits, standalone
3dstool -uvf input.bin --compress-type h4 --compress-out output.bin

# compress file with Huffman 4bits, standalone
3dstool -zvf input.bin --compress-type h4 --compress-out output.bin

# uncompress file with Huffman 8bits, standalone
3dstool -uvf input.bin --compress-type h8 --compress-out output.bin

# compress file with Huffman 8bits, standalone
3dstool -zvf input.bin --compress-type h8 --compress-out output.bin

# uncompress file with RunLength, standalone
3dstool -uvf input.bin --compress-type rl --compress-out output.bin

# compress file with RunLength, standalone
3dstool -zvf input.bin --compress-type rl --compress-out output.bin

# uncompress file with Yaz0, standalone
3dstool -uvf input.szs --compress-type yaz0 --compress-out output.sarc

# compress file with Yaz0, standalone
3dstool -zvf input.sarc --compress-type yaz0 --compress-out output.szs

# compress file with Yaz0 and set the alignment property, standalone
3dstool -zvf input.sarc --compress-type yaz0 --compress-out output.szs --yaz0-align 128

# trim cci without pad
3dstool --trim -vtf cci input.3ds

# trim cci reserve partition 0~2
3dstool --trim -vtf cci input.3ds --trim-after-partition 2

# pad cci with 0xFF
3dstool --pad -vtf cci input.3ds

# create patch file without optimization
3dstool --diff -v --old old.bin --new new.bin --patch-file patch.3ps

# create patch file with cci optimization
3dstool --diff -vt cci --old old.3ds --new new.3ds --patch-file patch.3ps

# create patch file with cxi optimization
3dstool --diff -vt cxi --old old.cxi --new new.cxi --patch-file patch.3ps

# create patch file with cfa optimization
3dstool --diff -vt cfa --old old.cfa --new new.cfa --patch-file patch.3ps

# apply patch file
3dstool --patch -vf input.bin --patch-file patch.3ps
⚠️ **GitHub.com Fallback** ⚠️