Files
threeSD/dist/threeSDumper.gm9
T
Pengfei 85fff614d3 Support for multiple NANDs
Preliminary support is added for multiple NANDs. ticket.db, title.db and seed.db will be merged, while the first NAND will be used for system titles and data.

Future changes to the frontend will allow selecting NANDs.
2021-08-30 22:33:24 +08:00

114 lines
2.7 KiB
Plaintext

# Copyright 2019 threeSD Project
# Licensed under GPLv2 or any later version
# Refer to the license.txt file included.
# GM9 Script for dumping necessary files automatically.
set PREVIEW_MODE "threeSD Dumper\nby zhaowenlan1779"
if not ask "Execute threeSD Dumper?\n \nRequires GodMode9 v2.0.0\nYou are on $[GM9VER]\n \nRequired Space: ~400MB for each NAND"
goto Exit
end
set PREVIEW_MODE "threeSD Dumper\nby zhaowenlan1779\n \nWorking..."
set OUT "0:/threeSD"
if exist $[OUT]
rm $[OUT]
end
mkdir $[OUT]
# === General data (independent of NANDs)
# Version
dumptxt $[OUT]/version.txt 4
# bootrom
if exist "M:/boot9.bin"
cp -w -n "M:/boot9.bin" $[OUT]/boot9.bin
elif exist "0:/3DS/boot9.bin"
cp -w -n "0:/3DS/boot9.bin" $[OUT]/boot9.bin
else
echo "ERROR: \nboot9.bin not found. \nIf you use fastboot3ds, hold HOME while booting, \nand go to Miscellaneous... > Dump bootroms & OTP. \nWhen finished, simply execute this script again."
goto Exit
end
# Secret sector (N3DS only)
if chk $[ONTYPE] "N3DS"
cp -w -n "S:/sector0x96.bin" $[OUT]/sector0x96.bin
end
# === NANDs
# Start with SysNAND
set NAND "1:"
set NAND_NAME "Sys"
set ID0 $[SYSID0]
@Loop
set PREVIEW_MODE "threeSD Dumper\nby zhaowenlan1779\n \nWorking ($[NAND_NAME])..."
set OUT "0:/threeSD/$[NAND_NAME]"
mkdir $[OUT]
# movable.sed
cp -w -n $[NAND]/private/movable.sed $[OUT]/movable.sed
# certs.db
if chk $[RDTYPE] "devkit"
echo "WARNING: \nDev kit detected. \nCIA building will not be usable."
else
cp -w -n $[NAND]/dbs/certs.db $[OUT]/certs.db
end
# ticket.db
cp -w -n $[NAND]/dbs/ticket.db $[OUT]/ticket.db
# title.db
cp -w -n $[NAND]/dbs/title.db $[OUT]/title.db
# seeddb.bin
# Note: this contains both SysNAND and EmuNAND seeds when built, but only the current EmuNAND
if exist 0:/gm9/out/seedd.bin
rm 0:/gm9/out/seeddb.bin
end
sdump -o -s -w seeddb.bin
if not exist 0:/gm9/out/seeddb.bin
echo "WARNING: \nseeddb.bin couldn't be built. \nThis may be because your system \ndoes not have any seeds. \nOtherwise, imported games may fail \nto run if they use seed encryption."
else
cp -w -n "0:/gm9/out/seeddb.bin" $[OUT]/seeddb.bin
rm "0:/gm9/out/seeddb.bin"
end
# data
cp -w -n $[NAND]/data/$[ID0] $[OUT]/data
# title
cp -w -n $[NAND]/title $[OUT]/title
# Loop Control
if chk $[NAND] "1:"
# Start EmuNAND
if not exist "4:/title"
goto Finish
end
set NAND "4:"
else
# Next EmuNAND
set LASTEMU $[EMUBASE]
nextemu
if chk $[EMUBASE] $[LASTEMU]
# All EmuNANDs done
goto Finish
end
end
set NAND_NAME "Emu$[EMUBASE]"
set ID0 $[EMUID0]
goto Loop
@Finish
set PREVIEW_MODE "threeSD Dumper\nby zhaowenlan1779\n \nSuccess!"
if ask "Successfully dumped necessary\nfiles for threeSD.\n \nPower off now?"
poweroff
end
@Exit