2021-01-05 16:55:48 +01:00
checkIfImportantSave = {
importantSaves = ["8000000000000120", "80000000000000d1", "8000000000000047"]
j = 0
important = 0
while (j < len(importantSaves)){
if (importantSaves[j] == save){
important = 1
}
j = j + 1
}
2020-04-01 21:06:29 +02:00
}
2021-01-05 16:55:48 +01:00
ver = version()
2020-04-01 21:06:29 +02:00
2021-01-05 16:55:48 +01:00
println("Tegrascript system wiper")
println("Running on TE ", ver)
println()
2020-04-01 21:06:29 +02:00
2021-01-05 16:55:48 +01:00
BTN_X = 0x2
2020-04-01 21:06:29 +02:00
2021-01-05 16:55:48 +01:00
if (_EMU) {
menuOptions = ["Exit", "Sysmmc", "Emummc"]
}
else() {
menuOptions = ["Exit", "Sysmmc"]
2020-04-01 21:06:29 +02:00
}
2021-01-05 16:55:48 +01:00
print("Wipe from: ")
res = menu(menuOptions, 0)
2020-04-01 21:06:29 +02:00
2021-01-05 16:55:48 +01:00
clearscreen()
2020-04-01 21:06:29 +02:00
2021-01-05 16:55:48 +01:00
if (res == 0){
exit()
2020-04-01 21:06:29 +02:00
}
2021-01-05 16:55:48 +01:00
if (res == 1){
println("Mounting Sysmmc")
mount = mmcConnect("SYSMMC")
}
2020-04-01 21:06:29 +02:00
2021-01-05 16:55:48 +01:00
if (res == 2){
println("Mounting Emummc")
mount = mmcConnect("EMUMMC")
}
2020-04-01 21:06:29 +02:00
2021-01-05 16:55:48 +01:00
if (mount){
println("Error connecting mmc!")
pause()
exit()
}
2020-04-01 21:06:29 +02:00
2021-01-05 16:55:48 +01:00
if (mmcMount("SYSTEM")) {
println("Failed to mount SYSTEM")
pause()
exit()
2020-04-01 21:06:29 +02:00
}
2021-01-05 16:55:48 +01:00
color("RED")
println("Are you sure you want to wipe everything?\nThis includes:\n- Saves\n- Game Data\n- All other data on the system\n\nUse this only as a last resort!")
color("YELLOW")
wait(10000)
2020-04-01 21:06:29 +02:00
2021-01-05 16:55:48 +01:00
println("Press X to continue\nPress any other button to exit")
2020-04-01 21:06:29 +02:00
2021-01-05 16:55:48 +01:00
start = pause() & BTN_X
if (!start){
color("WHITE")
exit()
2020-04-01 21:06:29 +02:00
}
2021-01-05 16:55:48 +01:00
color("WHITE")
println("Deleting SYSTEM saves")
files = dirRead("bis:/save")
i = 0
color("RED")
while (i < len(files)) {
if (!fileProperties[i]){ # checks if it's not a file
save = files[i]
checkIfImportantSave()
if (!important){
print("\rDeleting ", save)
res = fileDel(pathCombine("bis:/save", save))
if (res) {
println("\nFile deletion failed!")
pause()
exit()
}
}
}
i = i + 1
}
2020-04-01 21:06:29 +02:00
2021-01-05 16:55:48 +01:00
color("WHITE")
println("\n\nDeleting USER\n")
color("RED")
2020-04-01 21:06:29 +02:00
2021-01-05 16:55:48 +01:00
if (mmcMount("USER")){
println("Failed to mount USER")
pause()
exit()
}
2020-04-01 21:06:29 +02:00
2021-01-05 16:55:48 +01:00
toDel = ["Album", "Contents", "save", "saveMeta", "temp"]
2020-04-01 21:06:29 +02:00
2021-01-05 16:55:48 +01:00
i = 0
while (i < len(toDel)){
dirDel(pathCombine("bis:/", toDel[i]))
mkdir(pathCombine("bis:/", toDel[i]))
i = i + 1
}
2020-04-01 21:06:29 +02:00
2021-01-05 16:55:48 +01:00
mkdir("bis:/Contents/placehld")
mkdir("bis:/Contents/registered")
2020-04-01 21:06:29 +02:00
2021-01-05 16:55:48 +01:00
color("GREEN")
println("\n\nDone!")
pause()