Skip to content

Commit

Permalink
Added NAND restore scripts by Kazuma77
Browse files Browse the repository at this point in the history
  • Loading branch information
d0k3 committed Sep 24, 2017
1 parent 430bcd6 commit fe1791c
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resources/gm9/scripts/Backup EmuNAND.gm9
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# EmuNAND backup GM9 script
# This will create a backup named [SERIAL]_nandmin_???.bin
# This will create a backup named [DATESTAMP]_[SERIAL]_emunand_???.bin
# author: d0k3

set ERRORMSG "EmuNAND backup failed"
Expand Down
2 changes: 1 addition & 1 deletion resources/gm9/scripts/Backup SysNAND.gm9
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SysNAND backup GM9 script
# This will create a backup named [SERIAL]_nandmin_???.bin
# This will create a backup named [DATESTAMP]_[SERIAL]_sysnand_???.bin
# author: d0k3

set ERRORMSG "SysNAND backup failed"
Expand Down
23 changes: 23 additions & 0 deletions resources/gm9/scripts/Restore EmuNAND.gm9
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
21 changes: 21 additions & 0 deletions resources/gm9/scripts/Restore SysNAND (Full).gm9
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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
35 changes: 35 additions & 0 deletions resources/gm9/scripts/Restore SysNAND (Safe).gm9
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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

0 comments on commit fe1791c

Please sign in to comment.