diff --git a/include/arm11/menu.h b/include/arm11/menu.h index 791976a..da745ec 100644 --- a/include/arm11/menu.h +++ b/include/arm11/menu.h @@ -49,6 +49,7 @@ typedef struct { char* name; ///< Displayed name on top of the menu. u32 n_entries; ///< Number of entries in the menu. + u32 (*preset)(void); ///< Returns the preset of the current menu in bitwise format. MenuEntry entries[MENU_MAX_ENTRIES]; ///< An array of menu entries. } MenuInfo; diff --git a/include/arm11/menu_fb3ds.h b/include/arm11/menu_fb3ds.h index a237c1b..725d976 100644 --- a/include/arm11/menu_fb3ds.h +++ b/include/arm11/menu_fb3ds.h @@ -64,7 +64,7 @@ MenuInfo menu_fb3ds[] = { { - "Main Menu", 6, + "Main Menu", 6, NULL, { { "Continue boot", DESC_CONTINUE, &DummyFunc, 0 }, { "Boot menu...", DESC_BOOT_MENU, NULL, 1 }, @@ -75,7 +75,7 @@ } }, { // 1 - "Boot Menu", 5, + "Boot Menu", 5, NULL, { { "Boot [slot 1]", DESC_BOOT_SLOT_1, &DummyFunc, 0 }, { "Boot [slot 2]", DESC_BOOT_SLOT_2, &DummyFunc, 1 }, @@ -85,7 +85,7 @@ } }, { // 2 - "Boot Slot Setup", 3, + "Boot Slot Setup", 3, NULL, { { "Setup [slot 1]...", DESC_SET_SLOT_1, &DummyFunc, 0 }, { "Setup [slot 2]...", DESC_SET_SLOT_2, &DummyFunc, 1 }, @@ -93,7 +93,7 @@ } }, { // 3 - "NAND Tools", 4, + "NAND Tools", 4, NULL, { { "Backup NAND", DESC_NAND_BACKUP, &DummyFunc, 3 }, { "Restore NAND", DESC_NAND_RESTORE, &DummyFunc, 4 }, @@ -102,7 +102,7 @@ } }, { // 4 - "Settings", 3, + "Settings", 3, NULL, { { "Change boot mode", DESC_CHANGE_BOOT, NULL, 5 }, { "Change brightness", DESC_CHANGE_BRIGHT, &DummyFunc, 8 }, @@ -110,22 +110,22 @@ } }, { // 5 - "Boot Mode Setup", 3, + "Boot Mode Setup", 3, &menuPresetBootMode, { - { "Set normal boot", DESC_BOOT_NORMAL, &DummyFunc, 0 }, - { "Set quick boot", DESC_BOOT_QUICK, &DummyFunc, 1 }, - { "Set quiet boot", DESC_BOOT_QUIET, &DummyFunc, 2 } + { "Set normal boot", DESC_BOOT_NORMAL, &menuSetBootMode, 0 }, + { "Set quick boot", DESC_BOOT_QUICK, &menuSetBootMode, 1 }, + { "Set quiet boot", DESC_BOOT_QUIET, &menuSetBootMode, 2 } } }, { // 6 - "Backup Setup", 2, + "Backup Setup", 2, NULL, { { "Enable contiguous backups", DESC_ENABLE_CONTIG, &DummyFunc, 1 }, { "Disable contiguous backups", DESC_DISABLE_CONTIG, &DummyFunc, 0 } } }, { // 7 - "Miscellaneous", 3, + "Miscellaneous", 3, NULL, { { "Update fastboot3DS", DESC_UPDATE, &DummyFunc, 1 }, { "Credits", DESC_CREDITS, &ShowCredits, 0 }, diff --git a/include/arm11/menu_func.h b/include/arm11/menu_func.h index f779825..3a159da 100644 --- a/include/arm11/menu_func.h +++ b/include/arm11/menu_func.h @@ -20,6 +20,8 @@ #include "types.h" +u32 menuPresetBootMode(void); +u32 menuSetBootMode(PrintConsole* con, u32 param); u32 DummyFunc(PrintConsole* con, u32 param); u32 SetView(PrintConsole* con, u32 param); u32 ShowCredits(PrintConsole* con, u32 param); diff --git a/source/arm11/menu.c b/source/arm11/menu.c index 88500e6..a777afa 100644 --- a/source/arm11/menu.c +++ b/source/arm11/menu.c @@ -126,6 +126,11 @@ int menu_x = (menu_con->consoleWidth - MENU_WIDTH) >> 1; // int menu_y = MENU_DISP_Y + ((menu_con->consoleHeight - menu_block_height) >> 1); int menu_y = MENU_OFFSET_TITLE; + int menu_preset = 0; + + // get menu preset + if (curr_menu->preset) + menu_preset = curr_menu->preset(); // select menu console consoleSelect(menu_con); @@ -144,7 +149,8 @@ bool is_selected = (i == index); consoleSetCursor(menu_con, menu_x, menu_y++); - ee_printf(is_selected ? "\x1b[47;30m%2lu.%-*.*s\x1b[0m" : "%2lu.%-*.*s", i + 1, MENU_WIDTH-3, MENU_WIDTH-3, name); + ee_printf(is_selected ? "\x1b[47;30m%.3s %-*.*s\x1b[0m" : "%.3s %-*.*s", + ((menu_preset >> i) & 0x1) ? "[X]" : "[ ]", MENU_WIDTH-3, MENU_WIDTH-3, name); } // button instructions diff --git a/source/arm11/menu_func.c b/source/arm11/menu_func.c index c620685..c3a4718 100644 --- a/source/arm11/menu_func.c +++ b/source/arm11/menu_func.c Binary files differ