From d000f86c890e5409f0990e52e2dd07e8f99b8d16 Mon Sep 17 00:00:00 2001 From: "Such Meme, Many Skill" Date: Mon, 19 Aug 2019 23:32:20 +0200 Subject: [PATCH] Re order the main menu --- source/meme/graphics.c | 1 + source/meme/main.c | 41 +++++++++++++++++++++-------------------- source/meme/main.h | 1 + 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/source/meme/graphics.c b/source/meme/graphics.c index 6c27c48..423c3b8 100644 --- a/source/meme/graphics.c +++ b/source/meme/graphics.c @@ -21,6 +21,7 @@ int messagebox(char *message){ int ret = -1; meme_clearscreen(); gfx_printf("%s", message); + msleep(100); u8 res = btn_wait(); if (res & BTN_POWER) ret = 0; else ret = 1; diff --git a/source/meme/main.c b/source/meme/main.c index b498503..c3f80e0 100644 --- a/source/meme/main.c +++ b/source/meme/main.c @@ -29,9 +29,9 @@ void meme_main(){ sdmmc_storage_init_mmc(&storage, &sdmmc, SDMMC_4, SDMMC_BUS_WIDTH_8, 4); sdmmc_storage_set_mmc_partition(&storage, 1); */ - dump_biskeys(bis_keys); + dump_biskeys(bis_keys); // add succeed check - char *options[5]; + char *options[6]; char *itemsinfolder[1000]; unsigned int muhbits[1000]; bool sd_mounted = false; @@ -45,12 +45,13 @@ void meme_main(){ i++; } addchartoarray("[emmc:/] SYSTEM", options, i); - addchartoarray("\nTools", options, i+1); - addchartoarray("About", options, i+2); - addchartoarray("Exit", options, i+3); - + if (!sd_mounted) addchartoarray("\nMount SD", options, i+1); + else addchartoarray("\nUnmount SD", options, i+1); + addchartoarray("\nTools", options, i+2); + addchartoarray("About", options, i+3); + addchartoarray("Exit", options, i+4); meme_clearscreen(); - ret = gfx_menulist(32, options, (i + 4)); + ret = gfx_menulist(32, options, (i + 5)); if (strcmp(options[ret - 1], "[SD:/] SD card") == 0){ sdexplorer(itemsinfolder, muhbits, "sd:/"); @@ -58,16 +59,26 @@ void meme_main(){ else if (strcmp(options[ret - 1], "About") == 0){ messagebox(ABOUT_MESSAGE); } + else if (strcmp(options[ret - 1], "\nMount SD") == 0 || strcmp(options[ret - 1], "\nUnmount SD") == 0){ + if (sd_mounted){ + sd_unmount(); + sd_mounted = false; + } + else { + sd_mounted = sd_mount(); + if (!sd_mounted) messagebox("\nSD INIT FAILED"); + } + } else if (strcmp(options[ret - 1], "[emmc:/] SYSTEM") == 0){ - sdexplorer(itemsinfolder, muhbits, "emmc:/"); + ret = messagebox(SYSTEM_WARNING_MESSAGE); // note: maybe add some sort of color system for messageboxes + if (ret == 0) sdexplorer(itemsinfolder, muhbits, "emmc:/"); } else if (strcmp(options[ret - 1], "\nTools") == 0){ meme_clearscreen(); addchartoarray("Back", options, 0); addchartoarray("\nPrint BISKEYS", options, 1); if (!sd_mounted) addchartoarray("Mount SD", options, 2); - else addchartoarray("Unmount SD", options, 2); - ret = gfx_menulist(32, options, 3); + ret = gfx_menulist(32, options, 2); switch(ret){ case 2: meme_clearscreen(); @@ -79,16 +90,6 @@ void meme_main(){ gfx_hexdump(0, bis_keys[2], 0x20 * sizeof(u8)); btn_wait(); break; - case 3: - if (sd_mounted){ - sd_unmount(); - sd_mounted = false; - } - else { - sd_mounted = sd_mount(); - if (!sd_mounted) messagebox("\nSD INIT FAILED"); - } - break; } } else { diff --git a/source/meme/main.h b/source/meme/main.h index ea3111d..2da9438 100644 --- a/source/meme/main.h +++ b/source/meme/main.h @@ -1,5 +1,6 @@ #pragma once #define ABOUT_MESSAGE "\nCreator: Such Meme, Many Skill#2921\nCool people: Denn, shchmue\nTesters: PhazonicRidley, huhen\n\n\nProject based on Lockpick_RCM\n With additional code from Hekate" +#define SYSTEM_WARNING_MESSAGE "\nNOTICE!\n\nAbout to enter SYSTEM:/\nThis is a SYSTEM partition!\nMessing something up here \n will brick your switch!\n\nVol+/- to cancel\nPower to continue..." void meme_main(); \ No newline at end of file