Last active
January 25, 2023 10:18
-
-
Save noirscape/291233cb5943f58f99d6715e6ae6d051 to your computer and use it in GitHub Desktop.
CIA extraction scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script cleans up all the remaining files. | |
# Created by Ev1l0rd | |
echo "WARNING!" | |
echo "This will remove all following files/folders:" | |
echo "exefs/*" | |
echo "romfs/*" | |
echo "exefsheader.bin" | |
echo "plain.bin" | |
echo "contents.*" | |
echo "logo.bcma.lz" | |
read -p "If you are sure, press the [Enter] key to continue, or [^C] to exit." | |
rm -f exefsheader.bin plain.bin contents.* logo.bcma.lz | |
rm -r -f exefs romfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Simple extracting script for CIA files. | |
# Make sure only one CIA file is in the current directory! | |
# Otherwise the script will do weird things. | |
# Credit: Ev1l0rd | |
ctrtool --contents=contents *.cia | |
ctrtool --exheader=exheader.bin --romfsdir=romfs --logo=logo.bcma.lz --plainrgn=plain.bin --exefs exefs.bin contents.0000.00000000 | |
3dstool -xvtf cxi contents.0000.00000000 --header ncchheader.bin | |
3dstool -xvtf exefs exefs.bin --exefs-dir exefs --header exefsheader.bin | |
# exefs is removed, because it is only needed to get the header. | |
rm exefs.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Simple extracting script for CIA files. | |
# Make sure only one CIA file is in the current directory! | |
# Otherwise the script will do weird things. | |
# This variant skips the nccheader and exheader. | |
# Credit: Ev1l0rd | |
ctrtool --contents=contents *.cia | |
ctrtool --romfsdir=romfs --logo=logo.bcma.lz --plainrgn=plain.bin --exefs exefs.bin contents.0000.00000000 | |
3dstool -xvtf exefs exefs.bin --exefs-dir exefs --header exefsheader.bin | |
# exefs is removed, because it is only needed to get the header. | |
rm exefs.bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Simple repacking script | |
# Created by Ev1l0rd | |
# Output filename prompt | |
read -rp "Enter the output CIA filename (without the extension): " output | |
# First we remove any existing exefs/romfs files. | |
rm exefs.bin romfs.bin | |
# Now we repack the fs's | |
3dstool -cvtf exefs exefs.bin --exefs-dir exefs/ --header exefsheader.bin | |
3dstool -cvtf romfs romfs.bin --romfs-dir romfs/ | |
# Now we create a temporary cxi. | |
3dstool -cvtf cxi tmp.cxi --header ncchheader.bin --exh exheader.bin --logo logo.bcma.lz --plain plain.bin --exefs exefs.bin --romfs romfs.bin | |
# And finally, we create the CIA. | |
makerom -f cia -o $output.cia -content tmp.cxi:0:0 | |
# Removing unneeded files | |
rm exefs.bin romfs.bin tmp.cxi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment