diff --git a/include/arm11/menu/menu.h b/include/arm11/menu/menu.h index 4504b08..2ee077f 100644 --- a/include/arm11/menu/menu.h +++ b/include/arm11/menu/menu.h @@ -29,9 +29,10 @@ #define MENU_WIDTH 28 #define WORDWRAP_WIDTH 58 -#define MENU_FLAG_SLOTS 1 +#define MENU_FLAG_SLOTS (1<<0) #define MENU_FLAG_SLOT(x) (1<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; + int menu_preset = 0xFF; // get menu preset if (curr_menu->preset) @@ -169,11 +169,17 @@ char* name = entry->name; bool is_selected = (i == index); + char symbol = ' '; + if (curr_menu->flags & MENU_FLAG_CONFIG) + symbol = ((menu_preset >> i) & 0x1) ? '\xFB' : ' '; + else + symbol = ((menu_preset >> i) & 0x1) ? '+' : '-'; + consoleSetCursor(menu_con, menu_x, menu_y++); // ee_printf(((menu_preset >> i) & 0x1) ? ESC_SCHEME_STD : ESC_SCHEME_WEAK); ee_printf(ESC_SCHEME_STD); if (is_selected) ee_printf(ESC_INVERT); - ee_printf("%.3s %-*.*s", ((menu_preset >> i) & 0x1) ? "[X]" : "[ ]", MENU_WIDTH-4, MENU_WIDTH-4, name); + ee_printf("[%c] %-*.*s", symbol, MENU_WIDTH-4, MENU_WIDTH-4, name); ee_printf(ESC_RESET); } diff --git a/source/arm11/menu/menu_func.c b/source/arm11/menu/menu_func.c index bced8bd..853b12d 100644 --- a/source/arm11/menu/menu_func.c +++ b/source/arm11/menu/menu_func.c @@ -41,18 +41,36 @@ return menuPresetSlotConfig((x-1)); \ } -u32 menuPresetBootMode(void) +u32 menuPresetNandTools(void) { - if (configDataExist(KBootMode)) - { - return (1 << (*(u32*) configGetData(KBootMode))); - } - - return 0; + u32 res = 0xFF; + + if (!configDataExist(KDevMode) || !(*(bool*) configGetData(KDevMode))) + res &= ~((1 << 2) | (1 << 3)); + + return res; } u32 menuPresetBootMenu(void) { + u32 res = 0xFF; + + for (u32 i = 0; i < 3; i++) + { + if (!configDataExist(KBootOption1 + i)) + { + res &= ~(1 << i); + } + } + + if (!configDataExist(KDevMode) || !(*(bool*) configGetData(KDevMode))) + res &= ~(1 << 3); + + return res; +} + +u32 menuPresetBootConfig(void) +{ u32 res = 0; for (u32 i = 0; i < 3; i++) @@ -63,17 +81,10 @@ } } - return res; -} - -u32 menuPresetBootConfig(void) -{ - u32 res = 0; - if (configDataExist(KBootMode)) res |= 1 << 3; - return res | menuPresetBootMenu(); + return res; } u32 menuPresetSlotConfig(u32 slot) @@ -86,12 +97,25 @@ if (configDataExist(KBootOption1Buttons + slot)) res |= (1 << 1); + if (res) res |= (1 << 2); + return res; } PRESET_SLOT_CONFIG_FUNC(1) PRESET_SLOT_CONFIG_FUNC(2) PRESET_SLOT_CONFIG_FUNC(3) +u32 menuPresetBootMode(void) +{ + if (configDataExist(KBootMode)) + { + return (1 << (*(u32*) configGetData(KBootMode))); + } + + return 0; +} + + u32 menuSetBootMode(PrintConsole* term_con, PrintConsole* menu_con, u32 param) { (void) term_con; @@ -360,11 +384,12 @@ configSetKeyData(KDevMode, &enabled); consoleClear(); + term_con->cursorY = 10; ee_printf(ESC_SCHEME_ACCENT1); - ee_printf("You are now a developer!\n"); + ee_printf_line_center("You are now a developer!"); ee_printf(ESC_RESET); - ee_printf("Access to developer only features granted.\n\n"); - ee_printf("Press B or HOME to return."); + ee_printf_line_center(""); + ee_printf_line_center("Access to developer-only features granted."); updateScreens(); outputEndWait();