diff --git a/include/arm11/menu/bootslot_store.h b/include/arm11/menu/bootslot_store.h index e90fb34..02cc897 100644 --- a/include/arm11/menu/bootslot_store.h +++ b/include/arm11/menu/bootslot_store.h @@ -20,7 +20,6 @@ #include "types.h" -#define FIRM1_BOOT_SLOT 0xFE #define INVALID_BOOT_SLOT 0xFF u8 readStoredBootslot(void); diff --git a/include/arm11/menu/menu_fb3ds.h b/include/arm11/menu/menu_fb3ds.h index c2454e7..42c9d91 100644 --- a/include/arm11/menu/menu_fb3ds.h +++ b/include/arm11/menu/menu_fb3ds.h @@ -41,7 +41,6 @@ #define DESC_MISC "Enter miscellaneous submenu, including the update tool and credits section." #define DESC_BOOT_SLOT(x) "Boot the firmware in slot #" #x "." -#define DESC_BOOT_FIRM1 "Boot the firmware in firm1:." #define DESC_BOOT_SETUP "Change boot settings." #define DESC_SLOT_SETUP(x) "Change boot settings for slot #" #x "." @@ -88,12 +87,11 @@ } }, { // 1 - "Boot Menu", 4, &menuPresetBootMenu, MENU_FLAG_SLOTS, + "Boot Menu", 3, &menuPresetBootMenu, MENU_FLAG_SLOTS, { { "Boot [slot 1]", DESC_BOOT_SLOT(1), &menuLaunchFirm, 0x00 }, { "Boot [slot 2]", DESC_BOOT_SLOT(2), &menuLaunchFirm, 0x01 }, - { "Boot [slot 3]", DESC_BOOT_SLOT(3), &menuLaunchFirm, 0x02 }, - { "Boot from FIRM1", DESC_BOOT_FIRM1, &menuLaunchFirm, 0xFE } + { "Boot [slot 3]", DESC_BOOT_SLOT(3), &menuLaunchFirm, 0x02 } } }, { // 2 diff --git a/source/arm11/main.c b/source/arm11/main.c index 0bbfc43..b413461 100644 --- a/source/arm11/main.c +++ b/source/arm11/main.c @@ -212,16 +212,6 @@ break; } } - // boot env handling (only on reboots) for firm1: - else if (nextBootSlot == FIRM1_BOOT_SLOT) - { - err_ptr += ee_sprintf(err_ptr, "Rebooting to firm1:...\n"); - - firm_err = loadVerifyFirm("firm1:", false); - g_startFirmLaunch = (firm_err >= 0); - - err_ptr += ee_sprintf(err_ptr, "Load firm1: %s.\n", g_startFirmLaunch ? "success" : "failed"); - } // boot env handling (only on reboots) -> try previous slot else { diff --git a/source/arm11/menu/menu.c b/source/arm11/menu/menu.c index be8ea28..663add9 100644 --- a/source/arm11/menu/menu.c +++ b/source/arm11/menu/menu.c @@ -174,8 +174,6 @@ ee_printf(ESC_SCHEME_WEAK "reboot: " ESC_RESET); if ((prevSlot >= 1) && (prevSlot <= 3)) ee_printf(" slot %lu ", prevSlot); - else if (prevSlot == FIRM1_BOOT_SLOT) - ee_printf(" firm1: "); else ee_printf("autoboot"); diff --git a/source/arm11/menu/menu_fsel.c b/source/arm11/menu/menu_fsel.c index 0013c1f..174bd2a 100644 --- a/source/arm11/menu/menu_fsel.c +++ b/source/arm11/menu/menu_fsel.c @@ -29,6 +29,7 @@ #include "arm11/menu/menu_color.h" #include "arm11/hardware/hid.h" #include "arm11/hardware/timer.h" +#include "arm11/config.h" #include "arm11/console.h" #include "arm11/debug.h" #include "arm11/fmt.h" @@ -67,17 +68,12 @@ } } - // handling the asterisk (matches one or more chars in path) + // handling the asterisk (matches any # of chars in path) if ((*(pattern+1) == '?') || (*(pattern+1) == '*')) { // stupid user/dev shenanigans, failure return false; } - else if (*path == '\0') - { - // asterisk, but end reached on path, failure - return false; - } else if (*(pattern+1) == '\0') { // nothing after the asterisk, match found @@ -86,7 +82,7 @@ else { // we couldn't really go without recursion here - for (path++; *path != '\0'; path++) + for (; *path != '\0'; path++) { if (matchName(path, pattern + 1) == true) return true; } @@ -153,6 +149,9 @@ if(!*path) { const char* root_paths[] = { "sdmc:", "twln:", "twlp:", "nand:" }; + const char* firm_paths[] = { "firm1:" }; + const u32 firm_size = 0x400000; // 4MB + bool devmode = configDataExist(KDevMode) && (*(bool*) configGetData(KDevMode)); for(u32 i = 0; i < sizeof(root_paths) / sizeof(const char*); i++) { @@ -165,6 +164,20 @@ n_entries++; } + if(devmode) + { + for(u32 i = 0; i < sizeof(firm_paths) / sizeof(const char*); i++) + { + if (!matchName(firm_paths[i], pattern)) + continue; + + dir_buffer[n_entries].fsize = firm_size; + dir_buffer[n_entries].is_dir = 0; + dir_buffer[n_entries].fname = mallocpyString(firm_paths[i]); + n_entries++; + } + } + return n_entries; } diff --git a/source/arm11/menu/menu_func.c b/source/arm11/menu/menu_func.c index 0032ec7..a007568 100644 --- a/source/arm11/menu/menu_func.c +++ b/source/arm11/menu/menu_func.c @@ -159,7 +159,7 @@ updateScreens(); u32 res = 0; - if (menuFileSelector(res_path, menu_con, start, "*.firm", true)) + if (menuFileSelector(res_path, menu_con, start, "*firm*", true)) res = (configSetKeyData(KBootOption1 + slot, res_path)) ? 0 : 1; free(res_path); @@ -276,21 +276,13 @@ } path = (char*) configGetData(KBootOption1 + param); } - else if (param == 0xFE) // loading from FIRM1 - { - if (!configDataExist(KDevMode) || !(*(bool*) configGetData(KDevMode))) { - ee_printf("Boot from FIRM1 is not available!\nEnable dev mode to get access.\n"); - goto fail; - } - path = "firm1:"; - } else if (param == 0xFF) // user decision { ee_printf_screen_center("Select a firmware file to boot.\nPress [HOME] to cancel."); updateScreens(); path = path_store; - if (!menuFileSelector(path, menu_con, NULL, "*.firm", true)) + if (!menuFileSelector(path, menu_con, NULL, "*firm*", true)) return 1; // back to terminal console @@ -311,7 +303,7 @@ g_startFirmLaunch = true; // store the bootslot - u32 slot = (param < 3) ? (param + 1) : (param == 0xFE) ? FIRM1_BOOT_SLOT : 0; + u32 slot = (param < 3) ? (param + 1) : 0; storeBootslot(slot); return 0; @@ -648,7 +640,7 @@ // file selector ee_printf_screen_center("Select a firmware file to install.\nPress [HOME] to cancel."); updateScreens(); - if (!menuFileSelector(firm_path, menu_con, NULL, "*.firm", true)) + if (!menuFileSelector(firm_path, menu_con, NULL, "*firm*", true)) return 1; // cancel by user @@ -711,7 +703,7 @@ ee_printf_screen_center("Select fastboot3DS update file.\nPress [HOME] to cancel."); updateScreens(); - if (!menuFileSelector(firm_path, menu_con, "sdmc:", "*.firm", true)) + if (!menuFileSelector(firm_path, menu_con, "sdmc:", "*firm*", true)) return 1; // cancel by user