diff --git a/scripts/FirmwareDump.te b/scripts/FirmwareDump.te index ce3c8be..d3649b9 100644 --- a/scripts/FirmwareDump.te +++ b/scripts/FirmwareDump.te @@ -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") diff --git a/scripts/SystemWipe.te b/scripts/SystemWipe.te new file mode 100644 index 0000000..e33506a --- /dev/null +++ b/scripts/SystemWipe.te @@ -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() \ No newline at end of file diff --git a/source/script/arrayClass.c b/source/script/arrayClass.c index 4fbb9cf..44c2dc3 100644 --- a/source/script/arrayClass.c +++ b/source/script/arrayClass.c @@ -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)) diff --git a/source/script/compat.h b/source/script/compat.h index 57f1250..c35cf6f 100644 --- a/source/script/compat.h +++ b/source/script/compat.h @@ -3,8 +3,9 @@ #ifdef WIN32 #include #include -#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 diff --git a/source/script/standardLibrary.c b/source/script/standardLibrary.c index 2b730a2..80d2df2 100644 --- a/source/script/standardLibrary.c +++ b/source/script/standardLibrary.c @@ -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) {