From acb43b67db159228728b266346f6525d6c0ab250 Mon Sep 17 00:00:00 2001 From: "Such Meme, Many Skill" Date: Sat, 2 May 2020 23:35:25 +0200 Subject: [PATCH] Improvements to script control --- source/hid/hid.h | 4 ++++ source/tegraexplorer/fs/filemenu.c | 4 ++++ source/tegraexplorer/script/functions.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/source/hid/hid.h b/source/hid/hid.h index 8c28315..7f75334 100644 --- a/source/hid/hid.h +++ b/source/hid/hid.h @@ -4,8 +4,12 @@ #define BIT(n) (1 << n) #define KEY_A BIT(3) #define KEY_B BIT(2) +#define KEY_Y BIT(0) +#define KEY_X BIT(1) #define KEY_LUP BIT(18) #define KEY_LDOWN BIT(17) +#define KEY_LRIGHT BIT(19) +#define KEY_LLEFT BIT(20) #define KEY_RUP BIT(7) #define KEY_RDOWN BIT(6) #define KEY_VOLP BIT(14) diff --git a/source/tegraexplorer/fs/filemenu.c b/source/tegraexplorer/fs/filemenu.c index e79fcd3..dfc82b3 100644 --- a/source/tegraexplorer/fs/filemenu.c +++ b/source/tegraexplorer/fs/filemenu.c @@ -191,6 +191,10 @@ int filemenu(menu_entry file){ break; case FILE_SCRIPT: //ParseScript(fsutil_getnextloc(currentpath, file.name)); + gfx_printf(" %kRelease any buttons if held!", COLOR_RED); + + while (hidRead()->buttons); + runScript(fsutil_getnextloc(currentpath, file.name)); fsreader_readfolder(currentpath); break; diff --git a/source/tegraexplorer/script/functions.c b/source/tegraexplorer/script/functions.c index 07b0fd3..2c99f54 100644 --- a/source/tegraexplorer/script/functions.c +++ b/source/tegraexplorer/script/functions.c @@ -269,7 +269,7 @@ int part_MountMMC(){ } int part_Pause(){ - Inputs *input = hidWait(); + Inputs *input = hidWaitMask(KEY_A | KEY_B | KEY_X | KEY_Y | KEY_POW | KEY_VOLP | KEY_VOLM | KEY_LUP | KEY_LDOWN | KEY_LLEFT | KEY_LRIGHT); str_int_add("@BTN_POWER", input->pow); str_int_add("@BTN_VOL+", input->volp);