1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-09-16 20:13:24 +01:00

make Systemwipe.te

This commit is contained in:
suchmememanyskill 2021-07-24 23:00:05 +02:00
parent 987b7e8765
commit f48447f9f5
5 changed files with 53 additions and 11 deletions

View file

@ -19,22 +19,17 @@ fv()
sysfw=fw
p("Sys' fw is",fw)
emufw=""
if (emu()){if(!mountemu("SYSTEM")){
fv()
emufw=fw
p("Emu's fw is",fw)}}
if (emu()){if(!mountemu("SYSTEM")){fv()emufw=fw p("Emu's fw is",fw)}}
op=["Exit","Dump sysmmc"].copy()
if (emufw!=""){op+"Dump emummc"}
p()
r=menu(op,0)
p()r=menu(op,0)clear()
if(r==0){exit()}
if(r==1){fw=sysfw if(mountsys("SYSTEM")){print("SYSTEM MOUNT FAIL")pe()}}
if(r==2){fw=emufw if(mountemu("SYSTEM")){print("SYSTEM MOUNT FAIL")pe()}}
clear()
mkdir("sd:/tegraexplorer")
mkdir("sd:/tegraexplorer/Firmware")
bsp = "sd:/tegraexplorer/Firmware/" + fw
if(fsexists(bsp)){p("Dir already exists! Press power to replace, any other key to exit") a=pause() if (!a.power){exit()} deldir(bsp)}
bsp="sd:/tegraexplorer/Firmware/"+fw
if(fsexists(bsp)){p("Dir already exists! Press power to replace, any other key to exit") a=pause() if(!a.power){exit()} deldir(bsp)}
mkdir(bsp)
p("Dumping to",bsp)
con=readdir("bis:/Contents/registered")

30
scripts/SystemWipe.te Normal file
View file

@ -0,0 +1,30 @@
is=["8000000000000120","80000000000000d1","8000000000000047"]
p=println
pr=print
pe={pause() exit()}
wait={t=timer()while(timer()<(t+tw)){print("Wait for",(t+tw-timer()/1000),"seconds \r")}}
p("System wiper\n")
op=["Exit","Wipe sysmmc"].copy()
if (emu()){op+"Wipe emummc"}
r=menu(op,0)clear()
if(r==0){exit()}
if(r==1){p("Selected sysmmc")mount=mountsys}
if(r==2){p("Selected emummc")mount=mountemu}
if(mount("SYSTEM")){p("Mount failed!")pe()}
color(0xFF0000)
p("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(0xFFFF00)
tw=10000
wait()
color(0x0000FF)
p("Press power to wipe, any other key to exit")a=pause()if(!a.power){exit()}clear()
color(0xFF0000)
pr("Deleting system saves... ")
f=readdir("bis:/save")
if(f.folders.len()!=0){p("Folders in save dir???")pe()}
f.files.foreach("x"){if(!is.contains(x)){if(delfile("bis:/save/"+x)){p("File deletion failed: ", x)pe()}}}
pr("Done!\nDeleting user dirs...")ud=["Album","Contents","save","saveMeta","temp"]
if(mount("USER")){p("Mount failed!")pe()}
ud.foreach("x"){pr("\n"+x,"")if(deldir("bis:/"+x)){p("Dir deletion failed")pe()}mkdir("bis:/"+x)}
mkdir("bis:/Contents/placehld")mkdir("bis:/Contents/registered")
color(0x00FF00)p("\n\nDone!")pause()

View file

@ -173,6 +173,10 @@ ClassFunction(arrayContains) {
for (int i = 0; i < v->count; i++) {
Variable_t iter = arrayClassGetIdx(caller, i);
if (iter.variableType != arg->variableType){
SCRIPT_FATAL_ERR("type of contains does not match");
}
if (caller->variableType == StringArrayClass) {
if (!strcmp(arg->string.value, iter.string.value))

View file

@ -3,8 +3,9 @@
#ifdef WIN32
#include <stdio.h>
#include <malloc.h>
#define gfx_printf(str, ...) printf(str, ##__VA_ARGS__)
#define gfx_printf(str, ...) printf(str, ##__VA_ARGS__)
#define gfx_vprintf(str, va) vprintf(str, va);
#define gfx_putc(x) gfx_printf("%c", x)
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
#define LP_VER_MJ 3
#define LP_VER_MN 0

View file

@ -78,7 +78,8 @@ ClassFunction(stdPrint) {
Variable_t* res = callMemberFunctionDirect(args[i], "print", NULL, 0);
if (res == NULL)
return NULL;
gfx_putc(' ');
if (i + 1 != argsLen)
gfx_putc(' ');
}
@ -351,6 +352,10 @@ ClassFunction(stdFileExists){
return newIntVariablePtr(FileExists(args[0]->string.value));
}
ClassFunction(stdFileDel){
return newIntVariablePtr(f_unlink(args[0]->string.value));
}
#else
#define STUBBED(name) ClassFunction(name) { return newIntVariablePtr(0); }
@ -388,6 +393,12 @@ STUBBED(stdPause)
STUBBED(stdPauseMask)
STUBBED(stdColor)
STUBBED(stdMenuFull)
STUBBED(stdMountEmummc)
STUBBED(stdHasEmu)
STUBBED(stdGetMs)
STUBBED(stdClear)
STUBBED(stdRmDir)
STUBBED(stdFileExists)
#endif
u8 oneIntoneFunction[] = { IntClass, FunctionClass };
@ -425,6 +436,7 @@ ClassFunctionTableEntry_t standardFunctionDefenitions[] = {
{"timer", stdGetMs, 0, 0},
{"deldir", stdRmDir, 1, oneStringArgStd},
{"fsexists", stdFileExists, 1, oneStringArgStd},
{"delfile", stdFileDel, 1, oneStringArgStd},
};
ClassFunctionTableEntry_t* searchStdLib(char* funcName, u8 *len) {