add embedding TE scripts

This commit is contained in:
suchmememanyskill
2021-07-19 21:44:15 +02:00
parent e49f184f9b
commit 27350c0a5f
6 changed files with 142 additions and 16 deletions

View File

@@ -72,6 +72,23 @@ void DeleteFile(char *path, FSEntry_t entry){
free(thing);
}
void RunScriptString(char *str, u32 size){
gfx_clearscreen();
ParserRet_t ret = parseScript(str, size);
setStaticVars(&ret.staticVarHolder);
initRuntimeVars();
Variable_t* res = eval(ret.main.operations.data, ret.main.operations.count, 1);
exitRuntimeVars();
exitStaticVars(&ret.staticVarHolder);
exitFunction(ret.main.operations.data, ret.main.operations.count);
vecFree(ret.staticVarHolder);
vecFree(ret.main.operations);
hidWait();
hidWait();
}
void RunScript(char *path, FSEntry_t entry){
char *thing = CombinePaths(path, entry.name);
u32 size;

View File

@@ -4,4 +4,5 @@
typedef void (*fileMenuPath)(char *path, FSEntry_t entry);
void FileMenu(char *path, FSEntry_t entry);
void RunScript(char *path, FSEntry_t entry);
void RunScript(char *path, FSEntry_t entry);
void RunScriptString(char *str, u32 size);