set PREVIEW_MODE "Uninstall CFW Script\n\nDerived from\nGODMODE9 ALL-IN-ONE MEGASCRIPT\noriginally by annson24" if not ask "!!WARNING!!\nThis will completely remove CFW and\nrevert your system to stock.\nPLEASE make sure you have run the Safety Test\nAT LEAST ONCE before running this script.\n \nIf the safety test was unsuccessful,\nuninstalling CFW will 100% BRICK, GUARANTEED.\n \nProceed anyway?" goto Exit end if not chk $[HAX] "ntrboot" if not ask "!!WARNING!!\nntrboot not detected!\nYou should at least have ntrboot or a hardmod\nwith you before proceeding in case of brick.\n \nProceed anyway?" goto Exit end end if chk -u $[ONTYPE] "N3DS" goto Unhax_Old end if not sha S:/sector0x96.bin 82F2730D2C2DA3F30165F987FDCCAC5CBAB24B4E5F65C981CD7BE6F438E6D9D3 if not find 0:/boot9strap/secret_sector.bin SECRET if not find $[GM9IN]/boot9strap/secret_sector.bin SECRET echo "Sector 0x96 is not genuine.\nYou must have the secret_sector.bin file in the\nboot9strap folder first then try again.\n \nAborting." goto Exit end end if not allow -a S: echo "Permissions denied. Aborting." goto Exit end cp -n -w S:/sector0x96.bin $[SECRET].bak cp -n -w $[SECRET] S:/sector0x96.bin if not sha S:/sector0x96.bin 82F2730D2C2DA3F30165F987FDCCAC5CBAB24B4E5F65C981CD7BE6F438E6D9D3 echo "Sector 0x96 can't be restored properly! Aborting!" goto Exit end end if not find 1:/title/00040138/20000002/content/????????.app NATIVE_NCCH echo "NATIVE_FIRM not found.\nIs this a N3DS?" goto Exit end goto Actual_Unhax @Unhax_Old if not find 1:/title/00040138/00000002/content/????????.app NATIVE_NCCH echo "NATIVE_FIRM not found.\nIs this an O3DS?" goto Exit end @Actual_Unhax imgmount $[NATIVE_NCCH] verify G:/exefs/.firm shaget G:/exefs/.firm@0:200 NFIRM_HDR_HASH set NATIVE_FIRM 9:/NATIVE_FIRM.firm cp -w G:/exefs/.firm $[NATIVE_FIRM] imgumount if allow -a S: allow -a 1: cp -n $[NATIVE_FIRM] S:/firm0.bin shaget S:/firm0.bin@0:200 FIRM0_HDR_HASH if chk -u $[FIRM0_HDR_HASH] $[NFIRM_HDR_HASH] echo "FIRM0 got corrupted during uninstallation! Aborting!" goto Exit end verify S:/firm0.bin cp -n $[NATIVE_FIRM] S:/firm1.bin shaget S:/firm1.bin@0:200 FIRM1_HDR_HASH if chk -u $[FIRM1_HDR_HASH] $[NFIRM_HDR_HASH] echo "FIRM1 got corrupted during uninstallation! Aborting!" goto Exit end verify S:/firm1.bin rm -o -s 1:/boot.firm rm -o -s 1:/rw/luma shaget S:/nand.bin@57FFE00:200 PRE_STAGE2_HASH if not sha S:/nand.bin@B800000:200 $[PRE_STAGE2_HASH] fget S:/nand.bin@57FFE00:1 PRE_STAGE2 fill S:/nand.bin@B7FFE00:89C00 $[PRE_STAGE2] end echo "CFW uninstalled successfully." else echo "Permissions denied. Aborting." end @Exit