1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-09 13:41:45 +00:00

Add $BTN$ flags to scripts

This commit is contained in:
Such Meme, Many Skill 2020-02-07 00:55:55 +01:00
parent ab061cf0b3
commit 37ce49a31f

View file

@ -70,8 +70,10 @@ int Part_Exit(){
return 0; return 0;
} }
u8 buttons_pressed = 0;
int Part_WaitOnUser(){ int Part_WaitOnUser(){
return (btn_wait() & BTN_POWER); buttons_pressed = btn_wait();
return (buttons_pressed & BTN_POWER);
} }
int ParsePart(){ int ParsePart(){
@ -80,6 +82,7 @@ int ParsePart(){
if (strcmpcheck(func, parts[i].name)) if (strcmpcheck(func, parts[i].name))
return i; return i;
} }
forceExit = true;
return -1; return -1;
} }
@ -140,7 +143,7 @@ void ParseScript(char* path){
res = ParsePart(); res = ParsePart();
if (res == -1) if (res == -1)
return; break;
for (int i = 0; i < parts[res].arg_amount; i++){ for (int i = 0; i < parts[res].arg_amount; i++){
while (currentchar != 0x22) while (currentchar != 0x22)
@ -170,12 +173,19 @@ void ParseScript(char* path){
func[strlength] = '\0'; func[strlength] = '\0';
if (strcmpcheck(func, "ERROR") || strcmpcheck(func, "TRUE")){ if (strcmpcheck(func, "ERROR") || strcmpcheck(func, "TRUE")){
if (res) inifstatement = (res);
inifstatement = true;
} }
else if (strcmpcheck(func, "NOERROR") || strcmpcheck(func, "FALSE")){ else if (strcmpcheck(func, "NOERROR") || strcmpcheck(func, "FALSE")){
if (!res) inifstatement = (!res);
inifstatement = true; }
else if (strcmpcheck(func, "BTN_POWER")){
inifstatement = (buttons_pressed & BTN_POWER);
}
else if (strcmpcheck(func, "BTN_VOL+")){
inifstatement = (buttons_pressed & BTN_VOL_UP);
}
else if (strcmpcheck(func, "BTN_VOL-")){
inifstatement = (buttons_pressed & BTN_VOL_DOWN);
} }
if (inifstatement) if (inifstatement)