veritas06
12/2/2017 - 7:07 PM

[3DS Custom Firmware Scripts] A copy of the GM9 scripts used in DS CFW #Nintendo #Homebrew #3DS #2DS

[3DS Custom Firmware Scripts] A copy of the GM9 scripts used in DS CFW #Nintendo #Homebrew #3DS #2DS

# Luma3DS CTRNAND Setup script
# last changed: 20170716
# author: ihaveamac

set SUCCESSMSG "Luma3DS copied successfully"

ask "This will copy Luma3DS to your CTRNAND,\nallowing for the system to work without\nan SD card.\n\nContinue?"

allow 1:/

# remove existing files just in case
rm -o -s 1:/boot.firm
rm -o -s 1:/rw/luma

# copy specific files over
cp 0:/boot.firm 1:/boot.firm
mkdir 1:/rw/luma
cp 0:/luma/payloads 1:/rw/luma/payloads
cp 0:/luma/config.bin 1:/rw/luma/config.bin
# last changed: 20171107
# author: Some1CP
 
set SUCCESSMSG "Cleanup completed successfully"
set ERRORMSG "Cleanup failed"
 
ask "This will clean the final setup files from your SD.\n\nContinue?"
 
#allow SD modifications
allow -a 0:/
 
# remove existing files
 #2xrsa
rm -o -s 0:/arm9.bin
rm -o -s 0:/arm11.bin
 
#Cubic Ninja
rm -o -s 0:/ntr.bin
 
#Soundhax
rm -o -s 0:/soundhax-usa-o3ds.m4a
rm -o -s 0:/soundhax-usa-n3ds.m4a
rm -o -s 0:/soundhax-eur-o3ds.m4a
rm -o -s 0:/soundhax-eur-n3ds.m4a
rm -o -s 0:/soundhax-jpn-o3ds.m4a
rm -o -s 0:/soundhax-jpn-n3ds.m4a
rm -o -s 0:/soundhax-kor-o3ds.m4a
rm -o -s 0:/soundhax-kor-n3ds.m4a
rm -o -s 0:/otherapp.bin
rm -o -s 0:/3ds/safehax.3dsx
rm -o -s 0:/3ds/udsploit.3dsx
rm -o -s 0:/safehaxpayload.bin

#mset
rm -o -s 0:/Launcher.dat
rm -o -s 0:/SafeB9SInstaller.dat
 
#DSiWareHax
rm -o -s 0:/public.sav
rm -o -s 0:/boot.nds
rm -o -s 0:/savedata
rm -o -s 0:/sudoku_v0.app
rm -o -s 0:/4swords.app
 
#ntrboot_flasher
rm -o -s 0:/luma/payloads/ntrboot_flasher.firm
rm -o -s 0:/ntrboot
rm -o -s 0:/ntrboot.firm
 
#Common files
rm -o -s 0:/boot9strap
rm -o -s 0:/cias
rm -o -s 0:/gm9/scripts/setup_ctrnand_luma3ds.gm9
rm -o -s 0:/gm9/scripts/cleanup_sd_card.gm9

#A9LH files

rm -o -s 0:/arm9loaderhax.bin
rm -o -s 0:/files9/aeskeydb.bin
 
set ERRORMSG "Cleanup completed successfully"
# SysNAND safe restore GM9 script
# This will restore a backup from 0:/gm9/out, expecting the name scheme from the backup scripts
# author: Kazuma77

set SUCCESSMSG "Successfully Restored SysNAND."

set ERRORMSG "No qualifying exploit was found.\nAborting to avoid bricking the unit."
chk -u $[HAX] ""

set ERRORMSG "Safe restore is not available on\nntrboot. Aborting to avoid a brick."
chk -u $[HAX] "ntrboot"

set ERRORMSG "SysNAND not changed."
filesel "Select NAND Backup." $[GM9OUT]/*nand_???.bin NANDBAK
ask "Safe restore\n$[NANDBAK]\nto SysNAND?"
allow S:/ctrnand_full.bin
allow S:/twln.bin
allow S:/twlp.bin

set ERRORMSG "Not a valid NAND backup."
imgmount $[NANDBAK]
find I:/ctrnand_full.bin NULL
find I:/twln.bin NULL
find I:/twlp.bin NULL

# Uncomment the "verify" line below to enable verification.
# I left it out since the firm partitions are not being touched.
# If you do not want the script to even try to recover content from a bricked image, enable it.
#verify I:/nand_minsize.bin

set ERRORMSG "An error occurred during the transfer.\nPlease try again."
cp -w -n I:/ctrnand_full.bin S:/ctrnand_full.bin
cp -w -n I:/twln.bin S:/twln.bin
cp -w -n I:/twlp.bin S:/twlp.bin
imgumount
# SysNAND full restore GM9 script
# This will restore a backup from 0:/gm9/out, expecting the name scheme from the backup scripts
# author: Kazuma77

set SUCCESSMSG "Successfully Restored SysNAND."

set ERRORMSG "This script requires ntrboot to run."
chk $[HAX] "ntrboot"

set ERRORMSG "SysNAND not changed."
filesel "Select NAND Backup." $[GM9OUT]/*nand_???.bin NANDBAK
ask "WARNING:\nSystem exploit will not be protected.\nNEVER use an EmuNAND image with this\nscript - it may brick your device.\n \nFully restore\n$[NANDBAK]\nto SysNAND?"

allow S:/nand.bin
set ERRORMSG "Not a valid NAND backup."
imgmount $[NANDBAK]
verify I:/nand_minsize.bin

set ERRORMSG "An error occurred during the transfer\nPlease try again."
inject -n I:/nand_minsize.bin S:/nand.bin@0
imgumount
# EmuNAND restore GM9 script
# This will restore a backup from 0:/gm9/out, expecting the name scheme from the backup scripts
# author: Kazuma77

set SUCCESSMSG "Successfully Restored EmuNAND."

set ERRORMSG "EmuNAND not changed."
filesel "Select NAND Backup." $[GM9OUT]/*nand_???.bin NANDBAK
ask "Restore\n$[NANDBAK]\nto EmuNAND?"
allow E:/nand.bin

set ERRORMSG "Not a valid NAND backup."
imgmount $[NANDBAK]
find I:/nand_minsize.bin NULL

# Uncomment the "verify" line below to enable verification.
# I left it out since EmuNAND isn't vital.
# Besides, EmuNANDs don't even use their firm partitions.
#verify I:/nand_minsize.bin

set ERRORMSG "An error occurred during the transfer\nPlease try again."
inject -n I:/nand_minsize.bin E:/nand.bin@0
imgumount
# # # # # # # # # # # #
# Backup EmuNAND.gm9  #
# # # # # # # # # # # #
# EmuNAND backup GM9 script
# This will create a backup named [DATESTAMP]_[SERIAL]_emunand_???.bin
# author: d0k3

set ERRORMSG   "EmuNAND backup failed"
set SUCCESSMSG "EmuNAND backup success"

ask "Create a EmuNAND backup in $[GM9OUT]?"
findnot $[GM9OUT]/$[DATESTAMP]_$[SERIAL]_emunand_???.bin OUTPATH
cp -h E:/nand_minsize.bin $[OUTPATH]
echo "Backup created successfully:\n$[OUTPATH]"

# # # # # # # # # # # #
# Backup SysNAND.gm9  #
# # # # # # # # # # # #
# SysNAND backup GM9 script
# This will create a backup named [DATESTAMP]_[SERIAL]_sysnand_???.bin
# author: d0k3

set ERRORMSG   "SysNAND backup failed"
set SUCCESSMSG "SysNAND backup success"

ask "Create a SysNAND backup in $[GM9OUT]?"
findnot $[GM9OUT]/$[DATESTAMP]_$[SERIAL]_sysnand_???.bin OUTPATH
cp -h S:/nand_minsize.bin $[OUTPATH]
echo "Backup created successfully:\n$[OUTPATH]"

# # # # # # # # # # # #
# cleanup_sd_card.gm9 #
# # # # # # # # # # # #
# last changed: 20171107
# author: Some1CP
 
set SUCCESSMSG "Cleanup completed successfully"
set ERRORMSG "Cleanup failed"
 
ask "This will clean the final setup files from your SD.\n\nContinue?"
 
#allow SD modifications
allow -a 0:/
 
# remove existing files
 #2xrsa
rm -o -s 0:/arm9.bin
rm -o -s 0:/arm11.bin
 
#Cubic Ninja
rm -o -s 0:/ntr.bin
 
#Soundhax
rm -o -s 0:/soundhax-usa-o3ds.m4a
rm -o -s 0:/soundhax-usa-n3ds.m4a
rm -o -s 0:/soundhax-eur-o3ds.m4a
rm -o -s 0:/soundhax-eur-n3ds.m4a
rm -o -s 0:/soundhax-jpn-o3ds.m4a
rm -o -s 0:/soundhax-jpn-n3ds.m4a
rm -o -s 0:/soundhax-kor-o3ds.m4a
rm -o -s 0:/soundhax-kor-n3ds.m4a
rm -o -s 0:/otherapp.bin
rm -o -s 0:/3ds/safehax.3dsx
rm -o -s 0:/3ds/udsploit.3dsx
rm -o -s 0:/safehaxpayload.bin

#mset
rm -o -s 0:/Launcher.dat
rm -o -s 0:/SafeB9SInstaller.dat
 
#DSiWareHax
rm -o -s 0:/public.sav
rm -o -s 0:/boot.nds
rm -o -s 0:/savedata
rm -o -s 0:/sudoku_v0.app
rm -o -s 0:/4swords.app
 
#ntrboot_flasher
rm -o -s 0:/luma/payloads/ntrboot_flasher.firm
rm -o -s 0:/ntrboot
rm -o -s 0:/ntrboot.firm
 
#Common files
rm -o -s 0:/boot9strap
rm -o -s 0:/cias
rm -o -s 0:/gm9/scripts/setup_ctrnand_luma3ds.gm9
rm -o -s 0:/gm9/scripts/cleanup_sd_card.gm9

#A9LH files

rm -o -s 0:/arm9loaderhax.bin
rm -o -s 0:/files9/aeskeydb.bin
 
set ERRORMSG "Cleanup completed successfully"

# # # # # # # # # # # #
# Restore EmuNAND.gm9 #
# # # # # # # # # # # #
# EmuNAND restore GM9 script
# This will restore a backup from 0:/gm9/out, expecting the name scheme from the backup scripts
# author: Kazuma77

set SUCCESSMSG "Successfully Restored EmuNAND."

set ERRORMSG "EmuNAND not changed."
filesel "Select NAND Backup." $[GM9OUT]/*nand_???.bin NANDBAK
ask "Restore\n$[NANDBAK]\nto EmuNAND?"
allow E:/nand.bin

set ERRORMSG "Not a valid NAND backup."
imgmount $[NANDBAK]
find I:/nand_minsize.bin NULL

# Uncomment the "verify" line below to enable verification.
# I left it out since EmuNAND isn't vital.
# Besides, EmuNANDs don't even use their firm partitions.
#verify I:/nand_minsize.bin

set ERRORMSG "An error occurred during the transfer\nPlease try again."
inject -n I:/nand_minsize.bin E:/nand.bin@0
imgumount

# # # # # # # # # # # # # # # #
# Restore SysNAND (Full).gm9  #
# # # # # # # # # # # # # # # #
# SysNAND full restore GM9 script
# This will restore a backup from 0:/gm9/out, expecting the name scheme from the backup scripts
# author: Kazuma77

set SUCCESSMSG "Successfully Restored SysNAND."

set ERRORMSG "This script requires ntrboot to run."
chk $[HAX] "ntrboot"

set ERRORMSG "SysNAND not changed."
filesel "Select NAND Backup." $[GM9OUT]/*nand_???.bin NANDBAK
ask "WARNING:\nSystem exploit will not be protected.\nNEVER use an EmuNAND image with this\nscript - it may brick your device.\n \nFully restore\n$[NANDBAK]\nto SysNAND?"

allow S:/nand.bin
set ERRORMSG "Not a valid NAND backup."
imgmount $[NANDBAK]
verify I:/nand_minsize.bin

set ERRORMSG "An error occurred during the transfer\nPlease try again."
inject -n I:/nand_minsize.bin S:/nand.bin@0
imgumount

# # # # # # # # # # # # # # # #
# Restore SysNAND (Safe).gm9  #
# # # # # # # # # # # # # # # #
# SysNAND safe restore GM9 script
# This will restore a backup from 0:/gm9/out, expecting the name scheme from the backup scripts
# author: Kazuma77

set SUCCESSMSG "Successfully Restored SysNAND."

set ERRORMSG "No qualifying exploit was found.\nAborting to avoid bricking the unit."
chk -u $[HAX] ""

set ERRORMSG "Safe restore is not available on\nntrboot. Aborting to avoid a brick."
chk -u $[HAX] "ntrboot"

set ERRORMSG "SysNAND not changed."
filesel "Select NAND Backup." $[GM9OUT]/*nand_???.bin NANDBAK
ask "Safe restore\n$[NANDBAK]\nto SysNAND?"
allow S:/ctrnand_full.bin
allow S:/twln.bin
allow S:/twlp.bin

set ERRORMSG "Not a valid NAND backup."
imgmount $[NANDBAK]
find I:/ctrnand_full.bin NULL
find I:/twln.bin NULL
find I:/twlp.bin NULL

# Uncomment the "verify" line below to enable verification.
# I left it out since the firm partitions are not being touched.
# If you do not want the script to even try to recover content from a bricked image, enable it.
#verify I:/nand_minsize.bin

set ERRORMSG "An error occurred during the transfer.\nPlease try again."
cp -w -n I:/ctrnand_full.bin S:/ctrnand_full.bin
cp -w -n I:/twln.bin S:/twln.bin
cp -w -n I:/twlp.bin S:/twlp.bin
imgumount

# # # # # # # # # # # # # # #
# setup_ctrnand_luma3ds.gm9 #
# # # # # # # # # # # # # # #
# Luma3DS CTRNAND Setup script
# last changed: 20170716
# author: ihaveamac

set SUCCESSMSG "Luma3DS copied successfully"

ask "This will copy Luma3DS to your CTRNAND,\nallowing for the system to work without\nan SD card.\n\nContinue?"

allow 1:/

# remove existing files just in case
rm -o -s 1:/boot.firm
rm -o -s 1:/rw/luma

# copy specific files over
cp 0:/boot.firm 1:/boot.firm
mkdir 1:/rw/luma
cp 0:/luma/payloads 1:/rw/luma/payloads
cp 0:/luma/config.bin 1:/rw/luma/config.bin
# SysNAND backup GM9 script
# This will create a backup named [DATESTAMP]_[SERIAL]_sysnand_???.bin
# author: d0k3

set ERRORMSG   "SysNAND backup failed"
set SUCCESSMSG "SysNAND backup success"

ask "Create a SysNAND backup in $[GM9OUT]?"
findnot $[GM9OUT]/$[DATESTAMP]_$[SERIAL]_sysnand_???.bin OUTPATH
cp -h S:/nand_minsize.bin $[OUTPATH]
echo "Backup created successfully:\n$[OUTPATH]"
# EmuNAND backup GM9 script
# This will create a backup named [DATESTAMP]_[SERIAL]_emunand_???.bin
# author: d0k3

set ERRORMSG   "EmuNAND backup failed"
set SUCCESSMSG "EmuNAND backup success"

ask "Create a EmuNAND backup in $[GM9OUT]?"
findnot $[GM9OUT]/$[DATESTAMP]_$[SERIAL]_emunand_???.bin OUTPATH
cp -h E:/nand_minsize.bin $[OUTPATH]
echo "Backup created successfully:\n$[OUTPATH]"