1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-22 20:06:43 +00: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,18 +19,13 @@ fv()
sysfw=fw sysfw=fw
p("Sys' fw is",fw) p("Sys' fw is",fw)
emufw="" emufw=""
if (emu()){if(!mountemu("SYSTEM")){ if (emu()){if(!mountemu("SYSTEM")){fv()emufw=fw p("Emu's fw is",fw)}}
fv()
emufw=fw
p("Emu's fw is",fw)}}
op=["Exit","Dump sysmmc"].copy() op=["Exit","Dump sysmmc"].copy()
if (emufw!=""){op+"Dump emummc"} if (emufw!=""){op+"Dump emummc"}
p() p()r=menu(op,0)clear()
r=menu(op,0)
if(r==0){exit()} if(r==0){exit()}
if(r==1){fw=sysfw if(mountsys("SYSTEM")){print("SYSTEM MOUNT FAIL")pe()}} 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()}} if(r==2){fw=emufw if(mountemu("SYSTEM")){print("SYSTEM MOUNT FAIL")pe()}}
clear()
mkdir("sd:/tegraexplorer") mkdir("sd:/tegraexplorer")
mkdir("sd:/tegraexplorer/Firmware") mkdir("sd:/tegraexplorer/Firmware")
bsp="sd:/tegraexplorer/Firmware/"+fw bsp="sd:/tegraexplorer/Firmware/"+fw

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

@ -174,6 +174,10 @@ ClassFunction(arrayContains) {
for (int i = 0; i < v->count; i++) { for (int i = 0; i < v->count; i++) {
Variable_t iter = arrayClassGetIdx(caller, 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 (caller->variableType == StringArrayClass) {
if (!strcmp(arg->string.value, iter.string.value)) if (!strcmp(arg->string.value, iter.string.value))
return newIntVariablePtr(1); return newIntVariablePtr(1);

View file

@ -5,6 +5,7 @@
#include <malloc.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_vprintf(str, va) vprintf(str, va);
#define gfx_putc(x) gfx_printf("%c", x)
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) #define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
#define LP_VER_MJ 3 #define LP_VER_MJ 3
#define LP_VER_MN 0 #define LP_VER_MN 0

View file

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