From d27832effbad2d356821bf70308d65412871a967 Mon Sep 17 00:00:00 2001 From: suchmememanyskill Date: Sun, 10 Jan 2021 23:19:51 +0100 Subject: [PATCH] [script] Fix <= and >= --- source/script/functions.c | 9 +++++++++ source/script/lexer.c | 14 +++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/source/script/functions.c b/source/script/functions.c index 41b1151..c2b7d75 100644 --- a/source/script/functions.c +++ b/source/script/functions.c @@ -343,6 +343,7 @@ scriptFunction(funcMkdir){ return varInt((f_mkdir(vars[0].stringType))); } +// Args: Str scriptFunction(funcReadDir){ int res = 0; Vector_t files = ReadFolder(vars[0].stringType, &res); @@ -369,26 +370,32 @@ scriptFunction(funcReadDir){ return newVar(StringArrayType, 1, .vectorType = fileNames); } +// Args: Str, Str scriptFunction(funcCopyDir){ return varInt((FolderCopy(vars[0].stringType, vars[1].stringType).err)); } +// Args: Str scriptFunction(funcDelDir){ return varInt((FolderDelete(vars[0].stringType).err)); } +// Args: Str scriptFunction(funcDelFile){ return varInt((f_unlink(vars[0].stringType))); } +// Args: Str, Str scriptFunction(funcMmcDump){ return varInt((DumpOrWriteEmmcPart(vars[0].stringType, vars[1].stringType, 0, 1).err)); } +// Args: Str, Str, Int scriptFunction(funcMmcRestore){ return varInt((DumpOrWriteEmmcPart(vars[0].stringType, vars[1].stringType, 1, vars[2].integerType).err)); } +// Args: Str scriptFunction(funcGetNcaType){ if (!TConf.keysDumped) return ErrVar(ERRFATALFUNCFAIL); @@ -396,6 +403,7 @@ scriptFunction(funcGetNcaType){ return varInt((GetNcaType(vars[0].stringType))); } +// Args: Str scriptFunction(funcSignSave){ if (!TConf.keysDumped) return ErrVar(ERRFATALFUNCFAIL); @@ -409,6 +417,7 @@ scriptFunction(funcGetMs){ extern int launch_payload(char *path); +// Args: Str scriptFunction(funcLaunchPayload){ return varInt(launch_payload(vars[0].stringType)); } diff --git a/source/script/lexer.c b/source/script/lexer.c index 23be5a1..3bc203a 100644 --- a/source/script/lexer.c +++ b/source/script/lexer.c @@ -251,16 +251,24 @@ Vector_t runLexer(const char* in, u32 len) { vecAddElement(&vec, makeLexarToken(BitShiftRight, 0)); in++; } - else + else { + int a = (in[1] == '=') ? 1 : 0; vecAddElement(&vec, makeLexarToken(Bigger, 0)); + in += a; + } + } ELIFC('<'){ if (in[1] == '<'){ vecAddElement(&vec, makeLexarToken(BitShiftLeft, 0)); in++; } - else - vecAddElement(&vec, makeLexarToken(Smaller, 0)); + else { + int a = (in[1] == '=') ? 1 : 0; + vecAddElement(&vec, makeLexarToken(Smaller + a, 0)); + in += a; + } + } else { int val = 0;