diff --git a/include/arm11/menu/menu.h b/include/arm11/menu/menu.h index b6473d6..94e1040 100644 --- a/include/arm11/menu/menu.h +++ b/include/arm11/menu/menu.h @@ -31,9 +31,6 @@ #define MENU_FLAG_SLOTS 1 -#define MENU_EXIT_REBOOT 0 -#define MENU_EXIT_POWEROFF 1 - /** * @brief Menu entry description struct, used by MenuInfo. */ diff --git a/include/arm11/menu/menu_fb3ds.h b/include/arm11/menu/menu_fb3ds.h index 29e3e5c..834f0b6 100644 --- a/include/arm11/menu/menu_fb3ds.h +++ b/include/arm11/menu/menu_fb3ds.h @@ -22,6 +22,16 @@ #include "arm11/menu/menu.h" #include "arm11/menu/menu_func.h" +#define SUBMENU_SLOT_SETUP(x) \ +{ \ + "Boot Slot #" #x " Setup", 3, NULL, 0, \ + { \ + { "Select [slot " #x "] firm", DESC_FIRM_SLOT(x), &menuSetupBootSlot, (x-1)&0xF }, \ + { "Select [slot " #x "] buttons", DESC_KEYS_SLOT(x), &menuSetupBootKeys, (x-1)&0xF }, \ + { "Clear [slot " #x "]", DESC_CLEAR_SLOT(x), &menuSetupBootSlot, 0x10|((x-1)&0xF) } \ + } \ +} + #define LOREM "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata" #define DESC_CONTINUE "Continue booting the first available boot slot.\nNo function if boot slots are not set up." @@ -31,30 +41,18 @@ #define DESC_OPTIONS "Enter fastboot3ds settings submenu." #define DESC_MISC "Enter miscellaneous submenu, including the update tool and credits section." -#define DESC_BOOT_SLOT_1 "Boot the firmware in slot #1." -#define DESC_BOOT_SLOT_2 "Boot the firmware in slot #2." -#define DESC_BOOT_SLOT_3 "Boot the firmware in slot #3." +#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_BOOT_SETUP_1 "Change boot settings for slot #1." -#define DESC_BOOT_SETUP_2 "Change boot settings for slot #2." -#define DESC_BOOT_SETUP_3 "Change boot settings for slot #3." +#define DESC_SLOT_SETUP(x) "Change boot settings for slot #" #x "." +#define DESC_FIRM_SLOT(x) "Change the firmware in boot slot #" #x "." +#define DESC_CLEAR_SLOT(x) "Change the firmware in boot slot #" #x "." +#define DESC_KEYS_SLOT(x) "Change the keycombo used to boot slot #" #x "." -#define DESC_SET_SLOT_1 "Change the firmware in boot slot #1." -#define DESC_SET_SLOT_2 "Change the firmware in boot slot #2." -#define DESC_SET_SLOT_3 "Change the firmware in boot slot #3." - -#define DESC_CLEAR_SLOT_1 "Reset boot slot #1 to empty state." -#define DESC_CLEAR_SLOT_2 "Reset boot slot #2 to empty state." -#define DESC_CLEAR_SLOT_3 "Reset boot slot #3 to empty state." - -#define DESC_KEYS_SLOT_1 "Change the keycombo used to boot slot #1." -#define DESC_KEYS_SLOT_2 "Change the keycombo used to boot slot #2." -#define DESC_KEYS_SLOT_3 "Change the keycombo used to boot slot #3." - -#define DESC_CHANGE_SLOT "Setup fastboot3ds boot slots." -#define DESC_CLEAR_SLOT "Choose & clear fastboot3ds boot slots." +#define DESC_BOOT_NORMAL "Set normal boot mode.\nIn normal boot mode, you will be presented with the fastboot3ds menu upon boot." +#define DESC_BOOT_QUICK "Set quick boot mode.\nIn quick boot mode, splash is displayed and the boot is continued via the first available boot slot. To enter fastboot3ds menu, hold a key combo." +#define DESC_BOOT_QUIET "Set quiet boot mode.\nIn quiet boot mode, splash is not displayed and the boot is continued via the first available boot slot. To enter fastboot3ds menu, hold a key combo." #define DESC_CHANGE_BOOT "Change fastboot3ds boot mode. This allows you to set up how your console boots." #define DESC_NAND_BACKUP "Backup current NAND to a file." @@ -65,10 +63,6 @@ #define DESC_CHANGE_BRIGHT "Change fastboot3ds brightness. This may also affect firmware launched from within fastboot3ds." #define DESC_SET_CONTIG "Enable/disable contiguous NAND backups.\nContiguous NAND backups may be required on certain CFWs to be bootable from SD cards." -#define DESC_BOOT_NORMAL "Set normal boot mode.\nIn normal boot mode, you will be presented with the fastboot3ds menu upon boot." -#define DESC_BOOT_QUICK "Set quick boot mode.\nIn quick boot mode, splash is displayed and the boot is continued via the first available boot slot. To enter fastboot3ds menu, hold a key combo." -#define DESC_BOOT_QUIET "Set quiet boot mode.\nIn quiet boot mode, splash is not displayed and the boot is continued via the first available boot slot. To enter fastboot3ds menu, hold a key combo." - #define DESC_ENABLE_CONTIG "Select to enable contiguous NAND backups." #define DESC_DISABLE_CONTIG "Select to disable contiguous NAND backups." @@ -79,21 +73,22 @@ MenuInfo menu_fb3ds[] = { { - "Main Menu", 5, NULL, 0, + "Main Menu", 6, NULL, 0, { { "Continue boot", DESC_CONTINUE, &DummyFunc, 0 }, { "Boot menu...", DESC_BOOT_MENU, NULL, 1 }, { "Boot from file...", DESC_BOOT_FILE, &DummyFunc, 2 }, { "NAND tools...", DESC_NAND_TOOLS, NULL, 7 }, - { "Miscellaneous...", DESC_MISC, NULL, 8 } + { "Miscellaneous...", DESC_MISC, NULL, 8 }, + { "Debug...", "Debug menu.", NULL, 9 } } }, { // 1 "Boot Menu", 5, &menuPresetBootSlot, MENU_FLAG_SLOTS, { - { "Boot [slot 1]", DESC_BOOT_SLOT_1, &DummyFunc, 0x00 }, - { "Boot [slot 2]", DESC_BOOT_SLOT_2, &DummyFunc, 0x01 }, - { "Boot [slot 3]", DESC_BOOT_SLOT_3, &DummyFunc, 0x02 }, + { "Boot [slot 1]", DESC_BOOT_SLOT(1), &DummyFunc, 0x00 }, + { "Boot [slot 2]", DESC_BOOT_SLOT(2), &DummyFunc, 0x01 }, + { "Boot [slot 3]", DESC_BOOT_SLOT(3), &DummyFunc, 0x02 }, { "Boot from FIRM1", DESC_BOOT_FIRM1, &DummyFunc, 0xFF }, { "Boot setup...", DESC_BOOT_SETUP, NULL, 2 } @@ -102,36 +97,15 @@ { // 2 "Boot Setup", 4, &menuPresetBootSlot, MENU_FLAG_SLOTS, { - { "Setup [slot 1]...", DESC_BOOT_SETUP_1, NULL, 3 }, - { "Setup [slot 2]...", DESC_BOOT_SETUP_2, NULL, 4 }, - { "Setup [slot 3]...", DESC_BOOT_SETUP_3, NULL, 5 }, + { "Setup [slot 1]...", DESC_SLOT_SETUP(1), NULL, 3 }, + { "Setup [slot 2]...", DESC_SLOT_SETUP(2), NULL, 4 }, + { "Setup [slot 3]...", DESC_SLOT_SETUP(3), NULL, 5 }, { "Change boot mode...", DESC_CHANGE_BOOT, NULL, 6 } } }, - { // 3 - "Boot Slot #1 Setup", 3, NULL, 0, - { - { "Select [slot 1] firm", DESC_SET_SLOT_1, &menuSetupBootSlot, 0x00 }, - { "Select [slot 1] buttons", DESC_KEYS_SLOT_1, &menuSetupBootKeys, 0x00 }, - { "Clear [slot 1]", DESC_CLEAR_SLOT_1, &menuSetupBootSlot, 0x10 } - } - }, - { // 4 - "Boot Slot #2 Setup", 3, NULL, 0, - { - { "Select [slot 2] firm", DESC_SET_SLOT_2, &menuSetupBootSlot, 0x01 }, - { "Select [slot 2] buttons", DESC_KEYS_SLOT_2, &menuSetupBootKeys, 0x01 }, - { "Clear [slot 2]", DESC_CLEAR_SLOT_2, &menuSetupBootSlot, 0x11 } - } - }, - { // 5 - "Boot Slot #3 Setup", 3, NULL, 0, - { - { "Select [slot 3] firm", DESC_SET_SLOT_3, &menuSetupBootSlot, 0x02 }, - { "Select [slot 3] buttons", DESC_KEYS_SLOT_3, &menuSetupBootKeys, 0x02 }, - { "Clear [slot 3]", DESC_CLEAR_SLOT_3, &menuSetupBootSlot, 0x12 } - } - }, + SUBMENU_SLOT_SETUP(1), // 3 + SUBMENU_SLOT_SETUP(2), // 4 + SUBMENU_SLOT_SETUP(3), // 5 { // 6 "Boot Mode Setup", 3, &menuPresetBootMode, 0, { @@ -150,11 +124,16 @@ } }, { // 8 - "Miscellaneous", 3, NULL, 0, + "Miscellaneous", 2, NULL, 0, { { "Update fastboot3DS", DESC_UPDATE, &DummyFunc, 1 }, - { "Credits", DESC_CREDITS, &ShowCredits, 0 }, - { "View current settings", "View current settings", &SetView, 0 } // needs to be removed later + { "Credits", DESC_CREDITS, &ShowCredits, 0 } + } + }, + { // 9 + "Debug", 1, NULL, 0, // this will not show in the release version + { + { "View current settings", "View current settings", &SetView, 0 } } } }; diff --git a/source/arm11/menu/menu.c b/source/arm11/menu/menu.c index 1515d33..bca9fdc 100644 --- a/source/arm11/menu/menu.c +++ b/source/arm11/menu/menu.c @@ -48,9 +48,7 @@ // done if no description available if (!name || !desc) - { return; - } // build description string // also handle MENU_FLAG_SLOTS flag @@ -158,7 +156,6 @@ u32 menu_lvl = 0; u32 index = 0; u32 last_index = (u32) -1; - u32 result = MENU_EXIT_REBOOT; // main menu processing loop while (true) { @@ -218,8 +215,8 @@ { // return to HOME menu menu_lvl = 0; - curr_menu = prev_menu[0]; - index = prev_index[0]; + curr_menu = info; + index = 0; } else if (kDown & KEY_DDOWN) { @@ -230,13 +227,8 @@ { // cursor up index = (index == 0) ? curr_menu->n_entries - 1 : index - 1; - } - /*if (kDown & KEY_START) - { - result = (kHeld & KEY_DLEFT) ? MENU_EXIT_POWEROFF : MENU_EXIT_REBOOT; - break; - }*/ + } } - return result; + return 0; }