From 2cac144ba81ae38217555ddeb342312cf25d6eec Mon Sep 17 00:00:00 2001 From: "Such Meme, Many Skill" Date: Sat, 2 May 2020 14:06:56 +0200 Subject: [PATCH] Change some more functions to accept the new input --- source/hid/hid.c | 3 +++ source/tegraexplorer/emmc/emmc.c | 1 - source/tegraexplorer/emmc/emmcdumppart.c | 5 ++--- source/tegraexplorer/emmc/emmcrestorepart.c | 7 +++---- source/tegraexplorer/fs/filemenu.c | 7 +++---- source/tegraexplorer/fs/fsactions.c | 4 ++-- source/tegraexplorer/fs/fsextractbis.c | 1 - source/tegraexplorer/fs/fsreader.c | 2 ++ source/tegraexplorer/gfx/gfxutils.c | 8 ++++++++ source/tegraexplorer/gfx/gfxutils.h | 1 + source/tegraexplorer/mainmenu.c | 8 ++------ 11 files changed, 26 insertions(+), 21 deletions(-) diff --git a/source/hid/hid.c b/source/hid/hid.c index c600fc3..563db97 100644 --- a/source/hid/hid.c +++ b/source/hid/hid.c @@ -40,8 +40,11 @@ Inputs *hidRead(){ } } else { + u32 x, y; + gfx_con_getpos(&x, &y); gfx_con_setpos(1008, 703); gfx_printf("%k%K%s %s MISS%k%K", COLOR_DEFAULT, COLOR_WHITE, (controller->conn_l) ? " " : "JOYL", (controller->conn_r) ? " " : "JOYR", COLOR_WHITE, COLOR_DEFAULT); + gfx_con_setpos(x, y); errPrint = true; } diff --git a/source/tegraexplorer/emmc/emmc.c b/source/tegraexplorer/emmc/emmc.c index 3fac708..2fb3bd0 100644 --- a/source/tegraexplorer/emmc/emmc.c +++ b/source/tegraexplorer/emmc/emmc.c @@ -4,7 +4,6 @@ #include "../../utils/types.h" #include "../../libs/fatfs/ff.h" #include "../../utils/sprintf.h" -#include "../../utils/btn.h" #include "../../gfx/gfx.h" #include "../../utils/util.h" #include "../../hos/pkg1.h" diff --git a/source/tegraexplorer/emmc/emmcdumppart.c b/source/tegraexplorer/emmc/emmcdumppart.c index 7fc02e6..e7f2069 100644 --- a/source/tegraexplorer/emmc/emmcdumppart.c +++ b/source/tegraexplorer/emmc/emmcdumppart.c @@ -8,7 +8,6 @@ #include "../common/common.h" #include "../../libs/fatfs/ff.h" #include "../../utils/sprintf.h" -#include "../../utils/btn.h" #include "../../mem/heap.h" #include "../../storage/nx_emmc.h" #include "../common/types.h" @@ -72,8 +71,8 @@ int existsCheck(char *path){ int res = 0; if (fsutil_checkfile(path)){ - gfx_printf("File already exists! Overwrite?\nVol +/- to cancel\n"); - res = gfx_makewaitmenu("Power to continue", 3); + gfx_printf("File already exists! Overwrite?\nBto cancel\n"); + res = gfx_makewaitmenu("A to continue", 3); gfx_printf("\r \r"); return res; } diff --git a/source/tegraexplorer/emmc/emmcrestorepart.c b/source/tegraexplorer/emmc/emmcrestorepart.c index beda529..d0197f8 100644 --- a/source/tegraexplorer/emmc/emmcrestorepart.c +++ b/source/tegraexplorer/emmc/emmcrestorepart.c @@ -8,7 +8,6 @@ #include "../common/common.h" #include "../../libs/fatfs/ff.h" #include "../../utils/sprintf.h" -#include "../../utils/btn.h" #include "../../mem/heap.h" #include "../../storage/nx_emmc.h" #include "../common/types.h" @@ -57,10 +56,10 @@ int emmcRestorePart(char *path, sdmmc_storage_t *mmcstorage, emmc_part_t *part){ if (totalSize < totalSizeDest){ SWAPCOLOR(COLOR_ORANGE); - gfx_printf("File is too small for destination.\nDo you want to flash it anyway?\n\nVol +/- to Cancel\n"); + gfx_printf("File is too small for destination.\nDo you want to flash it anyway?\n\nB to Cancel\n"); u8 btnres = gfx_makewaitmenu( - "Power to Confirm", - 2 + "A to Confirm", + 3 ); RESETCOLOR; diff --git a/source/tegraexplorer/fs/filemenu.c b/source/tegraexplorer/fs/filemenu.c index 7649c6c..8497236 100644 --- a/source/tegraexplorer/fs/filemenu.c +++ b/source/tegraexplorer/fs/filemenu.c @@ -2,7 +2,6 @@ #include "entrymenu.h" #include "../common/common.h" #include "../../libs/fatfs/ff.h" -#include "../../utils/btn.h" #include "../../gfx/gfx.h" #include "fsutils.h" #include "fsactions.h" @@ -25,8 +24,8 @@ extern int launch_payload(char *path); int delfile(const char *path, const char *filename){ gfx_clearscreen(); SWAPCOLOR(COLOR_ORANGE); - gfx_printf("Are you sure you want to delete:\n%s\n\nPress vol+/- to cancel\n", filename); - if (gfx_makewaitmenu("Press power to delete", 3)){ + gfx_printf("Are you sure you want to delete:\n%s\n\nPress B to cancel\n", filename); + if (gfx_makewaitmenu("Press A to delete", 3)){ f_unlink(path); fsreader_readfolder(currentpath); return 0; @@ -177,7 +176,7 @@ int filemenu(menu_entry file){ gfx_clearscreen(); extract_bis_file(fsutil_getnextloc(currentpath, file.name), currentpath); fsreader_readfolder(currentpath); - btn_wait(); + hidWait(); break; case -1: return -1; diff --git a/source/tegraexplorer/fs/fsactions.c b/source/tegraexplorer/fs/fsactions.c index d9c1817..7a07b08 100644 --- a/source/tegraexplorer/fs/fsactions.c +++ b/source/tegraexplorer/fs/fsactions.c @@ -7,7 +7,7 @@ #include "../gfx/gfxutils.h" #include "../utils/utils.h" #include "../../mem/heap.h" -#include "../../utils/btn.h" +#include "../../hid/hid.h" #include "fsutils.h" int fsact_copy(const char *locin, const char *locout, u8 options){ @@ -71,7 +71,7 @@ int fsact_copy(const char *locin, const char *locout, u8 options){ i = 0; if (options & COPY_MODE_CANCEL) - if (btn_read() & BTN_VOL_DOWN){ + if (hidRead()->buttons & (KEY_VOLP | KEY_VOLM)){ f_unlink(locout); break; } diff --git a/source/tegraexplorer/fs/fsextractbis.c b/source/tegraexplorer/fs/fsextractbis.c index a40a975..d9c7533 100644 --- a/source/tegraexplorer/fs/fsextractbis.c +++ b/source/tegraexplorer/fs/fsextractbis.c @@ -7,7 +7,6 @@ #include "../common/common.h" #include "../../libs/fatfs/ff.h" #include "../../utils/sprintf.h" -#include "../../utils/btn.h" #include "../../mem/heap.h" #include "../../storage/nx_emmc.h" #include "../common/types.h" diff --git a/source/tegraexplorer/fs/fsreader.c b/source/tegraexplorer/fs/fsreader.c index a2e155e..8f0d870 100644 --- a/source/tegraexplorer/fs/fsreader.c +++ b/source/tegraexplorer/fs/fsreader.c @@ -46,8 +46,10 @@ void createfileobjects(int size, menu_entry **menu){ } void addobject(char* name, int spot, u8 attribs){ + /* u64 size = 0; int sizes = 0; + */ fsreader_files[spot].property = 0; if (fsreader_files[spot].name != NULL){ diff --git a/source/tegraexplorer/gfx/gfxutils.c b/source/tegraexplorer/gfx/gfxutils.c index b072c7f..558c3aa 100644 --- a/source/tegraexplorer/gfx/gfxutils.c +++ b/source/tegraexplorer/gfx/gfxutils.c @@ -178,4 +178,12 @@ void gfx_drawScrollBar(int minView, int maxView, int count){ gfx_boxGrey(740, 16 + offsetSize, 755, 702, 0x66); else gfx_boxGrey(740, 16 + offsetSize, 755, 16 + barSize + offsetSize, 0x66); +} + +int gfx_defaultWaitMenu(char *message, int time){ + gfx_clearscreen(); + SWAPCOLOR(COLOR_ORANGE); + gfx_printf("\n%s\n\nPress B to return\n", message); + SWAPCOLOR(COLOR_RED); + return gfx_makewaitmenu("Press A to continue", time); } \ No newline at end of file diff --git a/source/tegraexplorer/gfx/gfxutils.h b/source/tegraexplorer/gfx/gfxutils.h index 427f664..744ac63 100644 --- a/source/tegraexplorer/gfx/gfxutils.h +++ b/source/tegraexplorer/gfx/gfxutils.h @@ -18,5 +18,6 @@ u32 gfx_sideGetY(); void gfx_sideprintf(char* message, ...); void gfx_sideprintandclear(char* message, int length); void gfx_drawScrollBar(int minView, int maxView, int count); +int gfx_defaultWaitMenu(char *message, int time); extern int printerrors; \ No newline at end of file diff --git a/source/tegraexplorer/mainmenu.c b/source/tegraexplorer/mainmenu.c index 5a70324..f31c72b 100644 --- a/source/tegraexplorer/mainmenu.c +++ b/source/tegraexplorer/mainmenu.c @@ -36,9 +36,7 @@ void MainMenu_SDCard(){ } void MainMenu_EMMC(){ - gfx_clearscreen(); - gfx_printf("You're about to enter EMMC\nModifying anything here\n can result in a BRICK!\n\nPlease only continue\n if you know what you're doing\n\nPress B to return\n"); - if (gfx_makewaitmenu("Press A to enter", 4)){ + if (gfx_defaultWaitMenu("You're about to enter EMMC\nModifying anything here can result in a BRICK!\n\nPlease only continue if you know what you're doing", 4)){ /* connect_mmc(SYSMMC); @@ -91,9 +89,7 @@ void MainMenu_SDFormat(){ res = menu_make(mainmenu_format, 3, "-- Format Menu --"); if (res > 0){ - gfx_clearscreen(); - gfx_printf("Are you sure you want to format your sd?\nThis will delete everything on your SD card\nThis action is irreversible!\n\nPress B to cancel\n"); - if(gfx_makewaitmenu("Press A to continue", 10)){ + if(gfx_defaultWaitMenu("Are you sure you want to format your sd?\nThis will delete everything on your SD card!\nThis action is irreversible!", 10)){ if (format(res)){ sd_unmount(); }