From 0d98f65f99289bd7d7a0279f5a577b716e08023b Mon Sep 17 00:00:00 2001 From: "Such Meme, Many Skill" Date: Sat, 2 May 2020 13:33:54 +0200 Subject: [PATCH] Add script button stuff --- source/tegraexplorer/gfx/menu.c | 1 - source/tegraexplorer/script/functions.c | 24 ++++++++++++++---------- source/tegraexplorer/script/parser.c | 3 --- source/tegraexplorer/utils/utils.c | 21 ++++++++++++++++++++- 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/source/tegraexplorer/gfx/menu.c b/source/tegraexplorer/gfx/menu.c index 8b33502..99fc49c 100644 --- a/source/tegraexplorer/gfx/menu.c +++ b/source/tegraexplorer/gfx/menu.c @@ -49,7 +49,6 @@ void _printentry(menu_entry *entry, bool highlighted, bool refresh, char *path){ break; } - /* if (highlighted){ SWAPBGCOLOR(COLOR_WHITE); diff --git a/source/tegraexplorer/script/functions.c b/source/tegraexplorer/script/functions.c index 2eb982a..6be7308 100644 --- a/source/tegraexplorer/script/functions.c +++ b/source/tegraexplorer/script/functions.c @@ -6,7 +6,7 @@ #include "../../utils/types.h" #include "../../libs/fatfs/ff.h" #include "../../utils/sprintf.h" -#include "../../utils/btn.h" +#include "../../hid/hid.h" #include "../../gfx/gfx.h" #include "../../utils/util.h" #include "../../storage/emummc.h" @@ -269,17 +269,21 @@ int part_MountMMC(){ } int part_Pause(){ - int res; + Inputs *input = hidWait(); - while (btn_read() != 0); - - res = btn_wait(); - - str_int_add("@BTN_POWER", (res & BTN_POWER)); - str_int_add("@BTN_VOL+", (res & BTN_VOL_UP)); - str_int_add("@BTN_VOL-", (res & BTN_VOL_DOWN)); + str_int_add("@BTN_POWER", input->pow); + str_int_add("@BTN_VOL+", input->volp); + str_int_add("@BTN_VOL-", input->volm); + str_int_add("@BTN_A", input->a); + str_int_add("@BTN_B", input->b); + str_int_add("@BTN_X", input->x); + str_int_add("@BTN_Y", input->y); + str_int_add("@BTN_UP", input->Lup); + str_int_add("@BTN_DOWN", input->Ldown); + str_int_add("@BTN_LEFT", input->Lleft); + str_int_add("@BTN_RIGHT", input->Lright); - return res; + return input->buttons; } int part_addstrings(){ diff --git a/source/tegraexplorer/script/parser.c b/source/tegraexplorer/script/parser.c index b7e2ac7..9754203 100644 --- a/source/tegraexplorer/script/parser.c +++ b/source/tegraexplorer/script/parser.c @@ -287,9 +287,6 @@ void runScript(char *path){ //add builtin vars str_int_add("@EMUMMC", emu_cfg.enabled); str_int_add("@RESULT", 0); - str_int_add("@BTN_POWER", 0); - str_int_add("@BTN_VOL+", 0); - str_int_add("@BTN_VOL-", 0); str_str_add("$CURRENTPATH", currentpath); //str_int_printall(); diff --git a/source/tegraexplorer/utils/utils.c b/source/tegraexplorer/utils/utils.c index 766d158..df0ee7b 100644 --- a/source/tegraexplorer/utils/utils.c +++ b/source/tegraexplorer/utils/utils.c @@ -4,6 +4,12 @@ #include "../gfx/menu.h" #include "../../storage/emummc.h" #include "../../mem/heap.h" +/* +#include "../../utils/util.h" +#include "../../utils/sprintf.h" +#include "../../libs/fatfs/ff.h" +#include "../fs/fsutils.h" +*/ int utils_mmcMenu(){ if (emu_cfg.enabled) @@ -16,4 +22,17 @@ void utils_copystring(const char *in, char **out){ int len = strlen(in) + 1; *out = (char *) malloc (len); strcpy(*out, in); -} \ No newline at end of file +} + +/* +void utils_takeScreenshot(){ + char *name, *path; + char basepath[] = "sd:/tegraexplorer/screenshots"; + name = malloc(35); + sprintf(name, "Screenshot_%d", get_tmr_s()); + + f_mkdir("sd:/tegraexplorer"); + f_mkdir(basepath); + path = fsutil_getnextloc(basepath, name); +} +*/ \ No newline at end of file