Compare commits
13 Commits
save-close
...
4.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eea3728127 | ||
|
|
b1460c13cb | ||
|
|
f504c09441 | ||
|
|
b9c1b00482 | ||
|
|
11ebd537d8 | ||
|
|
76781f6fb7 | ||
|
|
6bc0772647 | ||
|
|
51e8efc6a5 | ||
|
|
6b84d6cd86 | ||
|
|
7406938e8e | ||
|
|
ed8987ee50 | ||
|
|
f812818967 | ||
|
|
61a0c7c9db |
4
Makefile
4
Makefile
@@ -10,8 +10,8 @@ include $(DEVKITARM)/base_rules
|
|||||||
|
|
||||||
IPL_LOAD_ADDR := 0x40008000
|
IPL_LOAD_ADDR := 0x40008000
|
||||||
LPVERSION_MAJOR := 4
|
LPVERSION_MAJOR := 4
|
||||||
LPVERSION_MINOR := 1
|
LPVERSION_MINOR := 2
|
||||||
LPVERSION_BUGFX := 1
|
LPVERSION_BUGFX := 0
|
||||||
LPVERSION := \"$(LPVERSION_MAJOR).$(LPVERSION_MINOR).$(LPVERSION_BUGFX)\"
|
LPVERSION := \"$(LPVERSION_MAJOR).$(LPVERSION_MINOR).$(LPVERSION_BUGFX)\"
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|||||||
@@ -299,14 +299,14 @@ void save_free_contexts(save_ctx_t *ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ALWAYS_INLINE bool save_flush(save_ctx_t *ctx) {
|
static ALWAYS_INLINE bool save_flush(save_ctx_t *ctx) {
|
||||||
if (ctx->header.layout.version < VERSION_DISF_5) {
|
|
||||||
if (!save_cached_storage_flush(ctx->core_data_ivfc_storage.data_level)) {
|
if (!save_cached_storage_flush(ctx->core_data_ivfc_storage.data_level)) {
|
||||||
EPRINTF("Failed to flush cached storage!");
|
EPRINTF("Failed to flush cached storage!");
|
||||||
}
|
}
|
||||||
if (save_remap_storage_write(&ctx->meta_remap_storage, ctx->fat_storage, ctx->header.layout.fat_offset, ctx->header.layout.fat_size) != ctx->header.layout.fat_size) {
|
if (save_remap_storage_write(&ctx->meta_remap_storage, ctx->fat_storage, ctx->header.layout.fat_offset, ctx->header.layout.fat_size) != ctx->header.layout.fat_size) {
|
||||||
EPRINTF("Failed to write meta remap storage!");
|
EPRINTF("Failed to write meta remap storage!");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
|
if (ctx->header.layout.version >= VERSION_DISF_5) {
|
||||||
if (!save_cached_storage_flush(ctx->fat_ivfc_storage.data_level)) {
|
if (!save_cached_storage_flush(ctx->fat_ivfc_storage.data_level)) {
|
||||||
EPRINTF("Failed to flush cached storage!");
|
EPRINTF("Failed to flush cached storage!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,69 +1,213 @@
|
|||||||
#REQUIRE KEYS
|
#REQUIRE KEYS
|
||||||
is=["8000000000000120","8000000000000000"]
|
is=["8000000000000120","8000000000000053","8000000000000000"]
|
||||||
p=println
|
p=println
|
||||||
pr=print
|
pr=print
|
||||||
pe={pause() exit()}
|
pe={pause() exit()}
|
||||||
wait={t=timer()while(timer()<(t+tw)){print("Wait for",(t+tw-timer()/1000),"seconds \r")}}
|
|
||||||
p("System wiper\n")
|
p("System wiper\n")
|
||||||
op=["Exit","Wipe sysmmc"].copy()
|
op=["Exit","Wipe sysmmc"].copy()
|
||||||
if (emu()){op+"Wipe emummc"}
|
if (emu()){op+"Wipe emummc"}
|
||||||
r=menu(op,0)clear()
|
r=menu(op,0)clear()
|
||||||
if(r==0){exit()}
|
if(r==0){exit()}
|
||||||
if(r==1){p("Selected sysmmc")mount=mountsys}
|
if(r==1){
|
||||||
if(r==2){p("Selected emummc")mount=mountemu}
|
mount=mountsys
|
||||||
|
selected_target = "sysmmc"
|
||||||
|
}
|
||||||
|
if(r==2){
|
||||||
|
mount=mountemu
|
||||||
|
selected_target = "emummc"
|
||||||
|
}
|
||||||
if(mount("SYSTEM")){p("Mount failed!")pe()}
|
if(mount("SYSTEM")){p("Mount failed!")pe()}
|
||||||
color(0xFF0000)
|
clear()
|
||||||
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)
|
border = {
|
||||||
tw=10000
|
setpixels(0,0,1279,19,border_color)
|
||||||
wait()
|
setpixels(0,700,1279,719,border_color)
|
||||||
color(0x0000FF)
|
setpixels(0,20,19,699,border_color)
|
||||||
p("Press power to wipe, any other key to exit")a=pause()if(!a.power){exit()}clear()
|
setpixels(1260,20,1279,699,border_color)
|
||||||
|
}
|
||||||
|
|
||||||
|
i = 10
|
||||||
|
x_pos = 10
|
||||||
|
y_pos = 12
|
||||||
|
|
||||||
|
["WARNING!!!",
|
||||||
|
"",
|
||||||
|
"Do you really want to wipe your system?",
|
||||||
|
"This will remove:",
|
||||||
|
"- Your Save Data",
|
||||||
|
"- Your Game Data",
|
||||||
|
"- Your User Data",
|
||||||
|
"",
|
||||||
|
"Restoring an emmc backup is always preferable over wiping.",
|
||||||
|
"Please only use this as a last resort.",
|
||||||
|
"This script is intended to be used in aid of unbricking."
|
||||||
|
].foreach("line")
|
||||||
|
{
|
||||||
|
printpos(x_pos, y_pos)
|
||||||
|
y_pos = y_pos + 1
|
||||||
|
print(line)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fsexists("bis:/save/"+is[1]))
|
||||||
|
{
|
||||||
|
[
|
||||||
|
"",
|
||||||
|
"DeviceSettings save (8000000000000053) is missing!!!",
|
||||||
|
"This script cannot recover lost battery calibration data.",
|
||||||
|
"The system will initialize with default values.",
|
||||||
|
"These values are unsafe for lite systems!"
|
||||||
|
].foreach("line")
|
||||||
|
{
|
||||||
|
printpos(x_pos, y_pos)
|
||||||
|
y_pos = y_pos + 1
|
||||||
|
print(line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
time = 5000
|
||||||
|
y_pos = y_pos + 4
|
||||||
|
|
||||||
|
while (i > 0)
|
||||||
|
{
|
||||||
|
i = i - 1
|
||||||
|
|
||||||
|
if (i % 2 == 0){
|
||||||
|
border_color = 0xFF0000
|
||||||
|
}.else() {
|
||||||
|
border_color = 0x000000
|
||||||
|
}
|
||||||
|
|
||||||
|
border()
|
||||||
|
sleep(500)
|
||||||
|
time = time - 500
|
||||||
|
printpos(x_pos, y_pos)
|
||||||
|
print("Waiting for", time / 1000, "seconds")
|
||||||
|
}
|
||||||
|
|
||||||
|
printpos(x_pos, y_pos)
|
||||||
|
print("Ready to wipe", selected_target, " ")
|
||||||
|
y_pos = y_pos + 1
|
||||||
|
printpos(x_pos, y_pos)
|
||||||
|
print("Press the power button to wipe, any other key to exit")
|
||||||
|
|
||||||
|
result = pause(0x70F000F)
|
||||||
|
|
||||||
|
if (!result.power)
|
||||||
|
{
|
||||||
|
exit()
|
||||||
|
}
|
||||||
|
|
||||||
|
clear()
|
||||||
color(0xFF0000)
|
color(0xFF0000)
|
||||||
pr("Deleting system saves... ")
|
pr("Deleting system saves... ")
|
||||||
f=readdir("bis:/save")
|
f=readdir("bis:/save")
|
||||||
if(f.folders.len()!=0){p("Folders in save dir???")pe()}
|
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()}}}
|
f.files.foreach("x"){if(!is.contains(x)){if(delfile("bis:/save/"+x)){p("File deletion failed: ", x)pe()}}}
|
||||||
pr("Done!\nSetting up indexer save...")
|
pr("Done!\nSetting up indexer save...")
|
||||||
s=getfilesize("bis:/save/"+is[0])
|
|
||||||
ba0=["BYTE[]",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
|
if(fsexists("bis:/save/"+is[0]))
|
||||||
ba120=["BYTE[]",0x20,0x01,0x00,0x00,0x00,0x00,0x00,0x80]
|
{
|
||||||
s1=s&0xFF
|
ba0=["BYTE[]",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
|
||||||
s2=(s>>8)&0xFF
|
ba120=["BYTE[]",0x20,0x01,0x00,0x00,0x00,0x00,0x00,0x80]
|
||||||
s3=(s>>16)&0xFF
|
ba53=["BYTE[]",0x53,0x00,0x00,0x00,0x00,0x00,0x00,0x80]
|
||||||
s4=(s>>24)&0xFF
|
imen=["BYTE[]",0x49,0x4D,0x45,0x4E,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00]
|
||||||
idb=["BYTE[]",0x49,0x4D,0x4B,0x56,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x49,0x4D,0x45,0x4E,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00].copy()
|
|
||||||
idb.addrange(ba0)
|
idb=["BYTE[]",0x49,0x4D,0x4B,0x56,0x00,0x00,0x00,0x00].copy() # imkv
|
||||||
idb.addrange(ba0)
|
|
||||||
idb.addrange(ba0)
|
skip53 = !fsexists("bis:/save/"+is[1])
|
||||||
idb.addrange(ba120)
|
|
||||||
idb.addrange(ba0)
|
if(skip53)
|
||||||
idb.addrange(ba0)
|
{
|
||||||
idb.addrange(ba0)
|
idb.add(0x01) # 0x01 imen
|
||||||
idb.addrange(ba0)
|
pr("053 save not found!!! Skip indexing it...")
|
||||||
idb.addrange(ba120)
|
}.else()
|
||||||
idb.add(s1)
|
{
|
||||||
idb.add(s2)
|
idb.add(0x02) # 0x02 imens
|
||||||
idb.add(s3)
|
}
|
||||||
idb.add(s4)
|
|
||||||
idb.add(0x00)
|
idb.add(0x00)
|
||||||
idb.add(0x00)
|
idb.add(0x00)
|
||||||
idb.add(0x00)
|
idb.add(0x00)
|
||||||
idb.add(0x00)
|
|
||||||
idb.addrange(ba0)
|
if(!skip53)
|
||||||
idb.addrange(ba0)
|
{
|
||||||
idb.addrange(ba0)
|
# 53 save
|
||||||
idb.addrange(ba0)
|
s=getfilesize("bis:/save/"+is[1])
|
||||||
idb.addrange(ba0)
|
s1=s&0xFF
|
||||||
idb.addrange(ba0)
|
s2=(s>>8)&0xFF
|
||||||
idxs=readsave("bis:/save/"+is[1])
|
s3=(s>>16)&0xFF
|
||||||
if(idxs.resize("/imkvdb.arc",idb.len())){p("imkvdb resize failed")pe()}
|
s4=(s>>24)&0xFF
|
||||||
if(idxs.write("/imkvdb.arc",idb)){p("imkvdb write failed")pe()}
|
idb.addrange(imen)
|
||||||
if(idxs.resize("/lastPublishedId",ba0.len())){p("lastPublishedId resize failed")pe()}
|
idb.addrange(ba0)
|
||||||
if(idxs.write("/lastPublishedId",ba0)){p("lastPublishedId write failed")pe()}
|
idb.addrange(ba0)
|
||||||
if(idxs.commit()){p("Indexer save commit failed")pe()}
|
idb.addrange(ba0)
|
||||||
idxs=0
|
idb.addrange(ba53)
|
||||||
pr("Done!\nDeleting user dirs...")ud=["Album","Contents","save","saveMeta","temp"]
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba53)
|
||||||
|
idb.add(s1)
|
||||||
|
idb.add(s2)
|
||||||
|
idb.add(s3)
|
||||||
|
idb.add(s4)
|
||||||
|
idb.add(0x00)
|
||||||
|
idb.add(0x00)
|
||||||
|
idb.add(0x00)
|
||||||
|
idb.add(0x00)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
}
|
||||||
|
|
||||||
|
# 120 save
|
||||||
|
s=getfilesize("bis:/save/"+is[0])
|
||||||
|
s1=s&0xFF
|
||||||
|
s2=(s>>8)&0xFF
|
||||||
|
s3=(s>>16)&0xFF
|
||||||
|
s4=(s>>24)&0xFF
|
||||||
|
idb.addrange(imen)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba120)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba120)
|
||||||
|
idb.add(s1)
|
||||||
|
idb.add(s2)
|
||||||
|
idb.add(s3)
|
||||||
|
idb.add(s4)
|
||||||
|
idb.add(0x00)
|
||||||
|
idb.add(0x00)
|
||||||
|
idb.add(0x00)
|
||||||
|
idb.add(0x00)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
idb.addrange(ba0)
|
||||||
|
|
||||||
|
idxs=readsave("bis:/save/"+is[2])
|
||||||
|
if(idxs.resize("/imkvdb.arc",idb.len())){p("imkvdb resize failed")pe()}
|
||||||
|
if(idxs.write("/imkvdb.arc",idb)){p("imkvdb write failed")pe()}
|
||||||
|
if(idxs.resize("/lastPublishedId",ba0.len())){p("lastPublishedId resize failed")pe()}
|
||||||
|
if(idxs.write("/lastPublishedId",ba0)){p("lastPublishedId write failed")pe()}
|
||||||
|
if(idxs.commit()){p("Indexer save commit failed")pe()}
|
||||||
|
idxs=0
|
||||||
|
pr("Done!")
|
||||||
|
}.else()
|
||||||
|
{
|
||||||
|
pr("120 save not found!!! Skip editing indexer save!!!")
|
||||||
|
}
|
||||||
|
|
||||||
|
pr("\nDeleting user dirs...")ud=["Album","Contents","save","saveMeta","temp"]
|
||||||
if(mount("USER")){p("Mount failed!")pe()}
|
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)}
|
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")
|
mkdir("bis:/Contents/placehld")mkdir("bis:/Contents/registered")
|
||||||
|
|||||||
@@ -278,7 +278,6 @@ void freeVariableInternal(Variable_t* referencedTarget) {
|
|||||||
save_free_contexts(&referencedTarget->save->saveCtx);
|
save_free_contexts(&referencedTarget->save->saveCtx);
|
||||||
f_close(&referencedTarget->save->saveFile);
|
f_close(&referencedTarget->save->saveFile);
|
||||||
FREE(referencedTarget->save);
|
FREE(referencedTarget->save);
|
||||||
gfx_printf("Save closed\n");
|
|
||||||
#endif // !WIN32
|
#endif // !WIN32
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ u8 nextToken(char** inPtr, void** val) {
|
|||||||
if (!memcmp(t.strToken, in, (t.strToken[1] == '\0') ? 1 : 2)) {
|
if (!memcmp(t.strToken, in, (t.strToken[1] == '\0') ? 1 : 2)) {
|
||||||
//gfx_printf("Token: '%s'\n", t.strToken);
|
//gfx_printf("Token: '%s'\n", t.strToken);
|
||||||
ret = Token_Token;
|
ret = Token_Token;
|
||||||
*val = t.token;
|
*val = (void*)t.token;
|
||||||
|
|
||||||
if (t.strToken[1] != '\0')
|
if (t.strToken[1] != '\0')
|
||||||
in++;
|
in++;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "scriptError.h"
|
#include "scriptError.h"
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include "../hid/hid.h"
|
||||||
|
|
||||||
s64 scriptCurrentLine;
|
s64 scriptCurrentLine;
|
||||||
u8 scriptLastError = 0;
|
u8 scriptLastError = 0;
|
||||||
|
|||||||
@@ -46,6 +46,19 @@ ClassFunction(stdIf) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Takes [int]. Returns empty.
|
||||||
|
ClassFunction(stdSleep)
|
||||||
|
{
|
||||||
|
s64 value = getIntValue(args[0]);
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
{
|
||||||
|
msleep(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return &emptyClass;
|
||||||
|
}
|
||||||
|
|
||||||
// Takes [function, function]. Returns empty. Works by evaling the first function and running the 2nd if true.
|
// Takes [function, function]. Returns empty. Works by evaling the first function and running the 2nd if true.
|
||||||
ClassFunction(stdWhile) {
|
ClassFunction(stdWhile) {
|
||||||
Variable_t* result = eval(args[0]->function.function.operations.data, args[0]->function.function.operations.count, 1);
|
Variable_t* result = eval(args[0]->function.function.operations.data, args[0]->function.function.operations.count, 1);
|
||||||
@@ -566,6 +579,7 @@ ClassFunctionTableEntry_t standardFunctionDefenitions[] = {
|
|||||||
{"menu", stdMenuFull, 3, menuArgsStd},
|
{"menu", stdMenuFull, 3, menuArgsStd},
|
||||||
{"menu", stdMenuFull, 2, menuArgsStd},
|
{"menu", stdMenuFull, 2, menuArgsStd},
|
||||||
{"power", stdPower, 1, threeIntsStd},
|
{"power", stdPower, 1, threeIntsStd},
|
||||||
|
{"sleep", stdSleep, 1, threeIntsStd},
|
||||||
|
|
||||||
// System
|
// System
|
||||||
{"mountsys", stdMountSysmmc, 1, twoStringArgStd},
|
{"mountsys", stdMountSysmmc, 1, twoStringArgStd},
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "../fs/fscopy.h"
|
#include "../fs/fscopy.h"
|
||||||
#include "../utils/utils.h"
|
#include "../utils/utils.h"
|
||||||
|
#include <display/di.h>
|
||||||
|
|
||||||
extern sdmmc_storage_t sd_storage;
|
extern sdmmc_storage_t sd_storage;
|
||||||
extern bool is_sd_inited;
|
extern bool is_sd_inited;
|
||||||
|
|||||||
Reference in New Issue
Block a user