Compare commits
21 Commits
4.1.0-b1
...
Lockpick-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eea3728127 | ||
|
|
b1460c13cb | ||
|
|
f504c09441 | ||
|
|
b9c1b00482 | ||
|
|
11ebd537d8 | ||
|
|
76781f6fb7 | ||
|
|
6bc0772647 | ||
|
|
51e8efc6a5 | ||
|
|
6b84d6cd86 | ||
|
|
7406938e8e | ||
|
|
ed8987ee50 | ||
|
|
f812818967 | ||
|
|
61a0c7c9db | ||
|
|
2b2c5b7c5f | ||
|
|
1e5a09a407 | ||
|
|
efe0843706 | ||
|
|
c117f53b5c | ||
|
|
9e01bbf13e | ||
|
|
8bc5a23425 | ||
|
|
91261f1671 | ||
|
|
94e60e0ded |
2
Makefile
2
Makefile
@@ -10,7 +10,7 @@ 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 := 0
|
LPVERSION_BUGFX := 0
|
||||||
LPVERSION := \"$(LPVERSION_MAJOR).$(LPVERSION_MINOR).$(LPVERSION_BUGFX)\"
|
LPVERSION := \"$(LPVERSION_MAJOR).$(LPVERSION_MINOR).$(LPVERSION_BUGFX)\"
|
||||||
|
|
||||||
|
|||||||
@@ -51,16 +51,18 @@ For question specifically for TegraExplorer, go to [my discord](https://discord.
|
|||||||
Based on [Lockpick_RCM](https://github.com/shchmue/Lockpick_RCM), and thus also based on [Hekate](https://github.com/CTCaer/hekate)
|
Based on [Lockpick_RCM](https://github.com/shchmue/Lockpick_RCM), and thus also based on [Hekate](https://github.com/CTCaer/hekate)
|
||||||
|
|
||||||
Awesome people who helped with this project:
|
Awesome people who helped with this project:
|
||||||
- shchmue
|
- [shchmue](https://github.com/shchmue)
|
||||||
- Dennthecafebabe
|
- [maddiethecafebabe](https://github.com/maddiethecafebabe/)
|
||||||
|
- [bleck9999](https://github.com/bleck9999)
|
||||||
|
|
||||||
Other awesome people:
|
Other awesome people:
|
||||||
- PhazonicRidley
|
- PhazonicRidley
|
||||||
- Dax
|
- Dax
|
||||||
- Huhen
|
- Huhen
|
||||||
- Bleck9999
|
|
||||||
- Exelix
|
- Exelix
|
||||||
- Emmo
|
- Emmo
|
||||||
|
- Gengar
|
||||||
|
- Einso
|
||||||
- JeffV
|
- JeffV
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|||||||
@@ -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!");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,18 +15,22 @@ fv={a=readsave("bis:/save/8000000000000120")
|
|||||||
maj=((ver>>26)&((1<<6)- 1))
|
maj=((ver>>26)&((1<<6)- 1))
|
||||||
}.else(){print("Fw not found")pe()}
|
}.else(){print("Fw not found")pe()}
|
||||||
a=0 fwstr()}
|
a=0 fwstr()}
|
||||||
if(mountsys("SYSTEM")){print("SYSTEM MOUNT FAIL")pe()}
|
|
||||||
fv()
|
|
||||||
sysfw=fw
|
|
||||||
p("Sys' fw is",fw)
|
|
||||||
emufw=""
|
|
||||||
if (emu()){if(!mountemu("SYSTEM")){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 (emu()){op+"Dump emummc"}
|
||||||
p()r=menu(op,0)clear()
|
p()r=menu(op,0)clear()
|
||||||
if(r==0){exit()}
|
if(r==0){exit()}
|
||||||
if(r==1){fw=sysfw if(mountsys("SYSTEM")){print("SYSTEM MOUNT FAIL")pe()}}
|
if(r==1){if(mountsys("SYSTEM")){print("SYSTEM MOUNT FAIL")pe()}}
|
||||||
if(r==2){fw=emufw if(mountemu("SYSTEM")){print("SYSTEM MOUNT FAIL")pe()}}
|
if(r==2){if(mountemu("SYSTEM")){print("SYSTEM MOUNT FAIL")pe()}}
|
||||||
|
|
||||||
|
clear()
|
||||||
|
fv()
|
||||||
|
p("Found firmware",fw)
|
||||||
|
p("Press Power or A to dump firmware, any other key to exit")
|
||||||
|
a = pause()
|
||||||
|
if (!a.a) {exit()}
|
||||||
|
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
|
||||||
|
|||||||
@@ -1,30 +1,213 @@
|
|||||||
#REQUIRE KEYS
|
#REQUIRE KEYS
|
||||||
is=["8000000000000120","80000000000000d1","8000000000000047"]
|
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!\nDeleting user dirs...")ud=["Album","Contents","save","saveMeta","temp"]
|
pr("Done!\nSetting up indexer save...")
|
||||||
|
|
||||||
|
if(fsexists("bis:/save/"+is[0]))
|
||||||
|
{
|
||||||
|
ba0=["BYTE[]",0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]
|
||||||
|
ba120=["BYTE[]",0x20,0x01,0x00,0x00,0x00,0x00,0x00,0x80]
|
||||||
|
ba53=["BYTE[]",0x53,0x00,0x00,0x00,0x00,0x00,0x00,0x80]
|
||||||
|
imen=["BYTE[]",0x49,0x4D,0x45,0x4E,0x40,0x00,0x00,0x00,0x40,0x00,0x00,0x00]
|
||||||
|
|
||||||
|
idb=["BYTE[]",0x49,0x4D,0x4B,0x56,0x00,0x00,0x00,0x00].copy() # imkv
|
||||||
|
|
||||||
|
skip53 = !fsexists("bis:/save/"+is[1])
|
||||||
|
|
||||||
|
if(skip53)
|
||||||
|
{
|
||||||
|
idb.add(0x01) # 0x01 imen
|
||||||
|
pr("053 save not found!!! Skip indexing it...")
|
||||||
|
}.else()
|
||||||
|
{
|
||||||
|
idb.add(0x02) # 0x02 imens
|
||||||
|
}
|
||||||
|
|
||||||
|
idb.add(0x00)
|
||||||
|
idb.add(0x00)
|
||||||
|
idb.add(0x00)
|
||||||
|
|
||||||
|
if(!skip53)
|
||||||
|
{
|
||||||
|
# 53 save
|
||||||
|
s=getfilesize("bis:/save/"+is[1])
|
||||||
|
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(ba53)
|
||||||
|
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")
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ Input_t *hidRead(){
|
|||||||
LbaseY = controller->lstick_y;
|
LbaseY = controller->lstick_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
inputs.up = (controller->up || (controller->lstick_y > LbaseY + 500)) ? 1 : 0;
|
inputs.up = (controller->up || inputs.volp || (controller->lstick_y > LbaseY + 500)) ? 1 : 0;
|
||||||
inputs.down = (controller->down || (controller->lstick_y < LbaseY - 500)) ? 1 : 0;
|
inputs.down = (controller->down || inputs.volm || (controller->lstick_y < LbaseY - 500)) ? 1 : 0;
|
||||||
inputs.left = (controller->left || (controller->lstick_x < LbaseX - 500)) ? 1 : 0;
|
inputs.left = (controller->left || (controller->lstick_x < LbaseX - 500)) ? 1 : 0;
|
||||||
inputs.right = (controller->right || (controller->lstick_x > LbaseX + 500)) ? 1 : 0;
|
inputs.right = (controller->right || (controller->lstick_x > LbaseX + 500)) ? 1 : 0;
|
||||||
}
|
}
|
||||||
@@ -71,8 +71,7 @@ Input_t *hidRead(){
|
|||||||
inputs.rLeft = (controller->rstick_x < RbaseX - 500) ? 1 : 0;
|
inputs.rLeft = (controller->rstick_x < RbaseX - 500) ? 1 : 0;
|
||||||
inputs.rRight = (controller->rstick_x > RbaseX + 500) ? 1 : 0;
|
inputs.rRight = (controller->rstick_x > RbaseX + 500) ? 1 : 0;
|
||||||
}
|
}
|
||||||
else
|
inputs.a = inputs.a || inputs.power;
|
||||||
inputs.a = inputs.power;
|
|
||||||
|
|
||||||
return &inputs;
|
return &inputs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,27 @@ int arrayClassAdd(Variable_t *caller, Variable_t *add){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int arrayClassAddRange(Variable_t* caller, Variable_t* add)
|
||||||
|
{
|
||||||
|
// Check if IntArrayClass or StringArrayClass or ByteArrayClass
|
||||||
|
if ((caller->variableType == IntArrayClass) || (caller->variableType == StringArrayClass) || (caller->variableType == ByteArrayClass)) {
|
||||||
|
if (caller->variableType != add->variableType) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (s64 i = 0; i < add->solvedArray.vector.count; i++)
|
||||||
|
{
|
||||||
|
Variable_t v = arrayClassGetIdx(add, i);
|
||||||
|
if (arrayClassAdd(caller, &v))
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ClassFunction(getArrayIdx) {
|
ClassFunction(getArrayIdx) {
|
||||||
s64 getVal = (*args)->integer.value;
|
s64 getVal = (*args)->integer.value;
|
||||||
// Out of bounds
|
// Out of bounds
|
||||||
@@ -167,6 +188,20 @@ ClassFunction(arrayAdd) {
|
|||||||
return &emptyClass;
|
return &emptyClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClassFunction(arrayAddRange) {
|
||||||
|
Variable_t* arg = *args;
|
||||||
|
|
||||||
|
if (caller->readOnly) {
|
||||||
|
SCRIPT_FATAL_ERR("Array is read-only");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arrayClassAddRange(caller, arg)) {
|
||||||
|
SCRIPT_FATAL_ERR("Adding the wrong type to a typed array");
|
||||||
|
}
|
||||||
|
|
||||||
|
return &emptyClass;
|
||||||
|
}
|
||||||
|
|
||||||
ClassFunction(arrayContains) {
|
ClassFunction(arrayContains) {
|
||||||
Vector_t* v = &caller->solvedArray.vector;
|
Vector_t* v = &caller->solvedArray.vector;
|
||||||
Variable_t* arg = *args;
|
Variable_t* arg = *args;
|
||||||
@@ -258,6 +293,7 @@ ClassFunctionTableEntry_t arrayFunctions[] = {
|
|||||||
{"set", arraySet, 2, oneIntOneAny},
|
{"set", arraySet, 2, oneIntOneAny},
|
||||||
{"+", arrayAdd, 1, anotherAnotherOneVarArg},
|
{"+", arrayAdd, 1, anotherAnotherOneVarArg},
|
||||||
{"add", arrayAdd, 1, anotherAnotherOneVarArg},
|
{"add", arrayAdd, 1, anotherAnotherOneVarArg},
|
||||||
|
{"addrange", arrayAddRange, 1, anotherAnotherOneVarArg},
|
||||||
{"-", arrayMinus, 1, anotherOneIntArg},
|
{"-", arrayMinus, 1, anotherOneIntArg},
|
||||||
{"contains", arrayContains, 1, anotherAnotherOneVarArg},
|
{"contains", arrayContains, 1, anotherAnotherOneVarArg},
|
||||||
{"bytestostr", bytesToStr, 0, 0},
|
{"bytestostr", bytesToStr, 0, 0},
|
||||||
|
|||||||
@@ -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++;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
u8 oneStringArgSave[] = {StringClass};
|
u8 oneStringArgSave[] = {StringClass};
|
||||||
u8 oneStrOneByteArrayArgSave[] = {StringClass, ByteArrayClass};
|
u8 oneStrOneByteArrayArgSave[] = {StringClass, ByteArrayClass};
|
||||||
|
u8 oneStringOneIntArgSave[] = {StringClass, IntClass};
|
||||||
|
|
||||||
ClassFunction(readFile){
|
ClassFunction(readFile){
|
||||||
Variable_t *arg = (*args);
|
Variable_t *arg = (*args);
|
||||||
@@ -96,11 +97,25 @@ ClassFunction(saveClassCommit){
|
|||||||
return newIntVariablePtr(!save_commit(&caller->save->saveCtx));
|
return newIntVariablePtr(!save_commit(&caller->save->saveCtx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClassFunction(writeFileSize) {
|
||||||
|
Variable_t* arg = (*args);
|
||||||
|
save_data_file_ctx_t dataArc;
|
||||||
|
if (!save_open_file(&caller->save->saveCtx, &dataArc, arg->string.value, OPEN_MODE_WRITE))
|
||||||
|
return newIntVariablePtr(1);
|
||||||
|
|
||||||
|
if (!save_data_file_set_size(&dataArc, args[1]->integer.value)) {
|
||||||
|
return newIntVariablePtr(2);
|
||||||
|
};
|
||||||
|
|
||||||
|
return newIntVariablePtr(0);
|
||||||
|
}
|
||||||
|
|
||||||
ClassFunctionTableEntry_t saveFunctions[] = {
|
ClassFunctionTableEntry_t saveFunctions[] = {
|
||||||
{"read", readFile, 1, oneStringArgSave},
|
{"read", readFile, 1, oneStringArgSave},
|
||||||
{"write", writeFile, 2, oneStrOneByteArrayArgSave},
|
{"write", writeFile, 2, oneStrOneByteArrayArgSave},
|
||||||
//{"readdir", getFiles, 1, oneStringArgSave}, // Seems broken?
|
//{"readdir", getFiles, 1, oneStringArgSave}, // Seems broken?
|
||||||
{"commit", saveClassCommit, 0, 0},
|
{"commit", saveClassCommit, 0, 0},
|
||||||
|
{"resize", writeFileSize, 2, oneStringOneIntArgSave},
|
||||||
};
|
};
|
||||||
|
|
||||||
Variable_t getSaveMember(Variable_t* var, char* memberName) {
|
Variable_t getSaveMember(Variable_t* var, char* memberName) {
|
||||||
|
|||||||
@@ -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);
|
||||||
@@ -399,6 +412,16 @@ ClassFunction(stdFileRead){
|
|||||||
return copyVariableToPtr(v);
|
return copyVariableToPtr(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClassFunction(stdFileReadSize) {
|
||||||
|
u32 fSize = 0;
|
||||||
|
u8* buff = sd_file_read(args[0]->string.value, &fSize);
|
||||||
|
if (buff == NULL) {
|
||||||
|
SCRIPT_FATAL_ERR("Failed to read file");
|
||||||
|
}
|
||||||
|
|
||||||
|
return newIntVariablePtr(fSize);
|
||||||
|
}
|
||||||
|
|
||||||
ClassFunction(stdFileWrite){
|
ClassFunction(stdFileWrite){
|
||||||
return newIntVariablePtr(sd_save_to_file(args[1]->solvedArray.vector.data, args[1]->solvedArray.vector.count, args[0]->string.value));
|
return newIntVariablePtr(sd_save_to_file(args[1]->solvedArray.vector.data, args[1]->solvedArray.vector.count, args[0]->string.value));
|
||||||
}
|
}
|
||||||
@@ -506,6 +529,7 @@ STUBBED(stdFileMove)
|
|||||||
STUBBED(stdLaunchPayload)
|
STUBBED(stdLaunchPayload)
|
||||||
STUBBED(stdFileWrite)
|
STUBBED(stdFileWrite)
|
||||||
STUBBED(stdFileRead)
|
STUBBED(stdFileRead)
|
||||||
|
STUBBED(stdFileReadSize)
|
||||||
STUBBED(stdCombinePaths)
|
STUBBED(stdCombinePaths)
|
||||||
STUBBED(stdEmmcFileWrite)
|
STUBBED(stdEmmcFileWrite)
|
||||||
STUBBED(stdEmmcFileRead)
|
STUBBED(stdEmmcFileRead)
|
||||||
@@ -555,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},
|
||||||
@@ -579,6 +604,7 @@ ClassFunctionTableEntry_t standardFunctionDefenitions[] = {
|
|||||||
{"movefile", stdFileMove, 2, twoStringArgStd},
|
{"movefile", stdFileMove, 2, twoStringArgStd},
|
||||||
{"delfile", stdFileDel, 1, twoStringArgStd},
|
{"delfile", stdFileDel, 1, twoStringArgStd},
|
||||||
{"readfile", stdFileRead, 1, twoStringArgStd},
|
{"readfile", stdFileRead, 1, twoStringArgStd},
|
||||||
|
{"getfilesize", stdFileReadSize, 1, twoStringArgStd},
|
||||||
{"writefile", stdFileWrite, 2, oneStringOneByteArrayStd},
|
{"writefile", stdFileWrite, 2, oneStringOneByteArrayStd},
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -157,12 +157,19 @@ char *ShowKeyboard(const char *toEdit, u8 alwaysRet){
|
|||||||
}
|
}
|
||||||
int val = (input->up || input->down) ? 11 : 1;
|
int val = (input->up || input->down) ? 11 : 1;
|
||||||
|
|
||||||
// Btn buttons do not work lol
|
if (input->volm) {
|
||||||
if (input->buttons & (JoyLLeft | JoyLUp | BtnVolM)){
|
if (pos > 0)
|
||||||
|
pos -= 1;
|
||||||
|
}
|
||||||
|
else if (input->volp) {
|
||||||
|
if (pos < 43)
|
||||||
|
pos += 1;
|
||||||
|
}
|
||||||
|
else if (input->buttons & (JoyLLeft | JoyLUp)){
|
||||||
if (pos > -1 + val)
|
if (pos > -1 + val)
|
||||||
pos -= val;
|
pos -= val;
|
||||||
}
|
}
|
||||||
if (input->buttons & (JoyLRight | JoyLDown | BtnVolP)){
|
else if (input->buttons & (JoyLRight | JoyLDown)){
|
||||||
if (pos < 44 - val)
|
if (pos < 44 - val)
|
||||||
pos += val;
|
pos += val;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user