# 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
