From: chaoskagami Date: Sun, 14 Aug 2016 14:36:51 +0000 (-0400) Subject: Menu indentation improvements X-Git-Tag: v0.3.0~63 X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=90efd6703ed3d84456b3fd223342ec225bf44f33;p=corbenik%2Fcorbenik.git Menu indentation improvements --- diff --git a/include/option.h b/include/option.h index 671eb1c..fb864d7 100644 --- a/include/option.h +++ b/include/option.h @@ -57,6 +57,7 @@ struct options_s char desc[256]; enum type allowed; uint32_t a, b; + uint8_t indent; } __attribute__((packed)); // Use builtin loader module replacer. diff --git a/source/chainloader.c b/source/chainloader.c index 82557a9..3c13598 100644 --- a/source/chainloader.c +++ b/source/chainloader.c @@ -117,6 +117,7 @@ list_chain_build_back(char *fpath) chains[current_chain_index].allowed = call_fun; chains[current_chain_index].a = (uint32_t) chainload_file; chains[current_chain_index].b = (uint32_t) chains[current_chain_index].desc; + chains[current_chain_index].indent = 0; current_chain_index++; } @@ -144,6 +145,7 @@ list_chain_build(char *name) chains[0].allowed = not_option; chains[0].a = 1; chains[0].b = 0; + chains[0].indent = 0; current_chain_index += 1; diff --git a/source/menu-backend.c b/source/menu-backend.c index 93e516c..92b13a5 100644 --- a/source/menu-backend.c +++ b/source/menu-backend.c @@ -98,6 +98,10 @@ show_menu(struct options_s *options, uint8_t *toggles) // NOTE - Signed to unsigned conversion here. Again, not an issue. set_cursor(TOP_SCREEN, 0, (unsigned int)(i - window_top + 2) ); + int indent = options[i].indent; + for(int i=0; i < indent; i++) + fprintf(TOP_SCREEN, " "); + if (options[i].allowed == boolean_val || (is_n3ds && options[i].allowed == boolean_val_n3ds)) { if (cursor_y == i) { accent_color(TOP_SCREEN, 1); diff --git a/source/menu.c b/source/menu.c index 73622a1..966d55b 100644 --- a/source/menu.c +++ b/source/menu.c @@ -8,56 +8,56 @@ uint8_t *enable_list = NULL; static struct options_s options[] = { // Patches. - { 0, "General Options", "", not_option, 1, 0 }, + { 0, "General Options", "", not_option, 1, 0, 0 }, - { OPTION_SVCS, "svcBackdoor Fixup", "Reinserts svcBackdoor on 11.0 NATIVE_FIRM. svcBackdoor allows executing arbitrary functions with ARM11 kernel permissions, and is required by some (poorly coded) applications.", boolean_val, 0, 0 }, + { OPTION_SVCS, "svcBackdoor Fixup", "Reinserts svcBackdoor on 11.0 NATIVE_FIRM. svcBackdoor allows executing arbitrary functions with ARM11 kernel permissions, and is required by some (poorly coded) applications.", boolean_val, 0, 0, 0 }, - { OPTION_REBOOT, "Reboot Hook", "Hooks firmlaunch to allow largemem games on o3DS. Also allows patching TWL/AGB on all consoles.", boolean_val, 0, 0 }, + { OPTION_REBOOT, "Reboot Hook", "Hooks firmlaunch to allow largemem games on o3DS. Also allows patching TWL/AGB on all consoles.", boolean_val, 0, 0, 0 }, - { OPTION_EMUNAND, "Use EmuNAND", "Redirects NAND write/read to the SD. This supports both Gateway and redirected layouts.", boolean_val, 0, 0 }, - { OPTION_EMUNAND_INDEX, " Index", "Which EmuNAND to use. If you only have one, you want 0. Currently the maximum supported is 10 (0-9), but this is arbitrary.", ranged_val, 0, 0x9 }, + { OPTION_EMUNAND, "Use EmuNAND", "Redirects NAND write/read to the SD. This supports both Gateway and redirected layouts.", boolean_val, 0, 0, 0 }, + { OPTION_EMUNAND_INDEX, "Index", "Which EmuNAND to use. If you only have one, you want 0. Currently the maximum supported is 10 (0-9), but this is arbitrary.", ranged_val, 0, 0x9, 1 }, // { OPTION_EMUNAND_REVERSE, " Reverse layout", "(Warning - Experimental!) Calculate EmuNAND sector from the end of the disk, not the start. This isn't supported by tools like Decrypt9, but has some advantages.", boolean_val, 0, 0x9 }, - { OPTION_AUTOBOOT, "Autoboot", "Boot the system automatically, unless the R key is held while booting.", boolean_val, 0, 0 }, - { OPTION_SILENCE, " Silent mode", "Suppress all debug output during autoboot. You'll see the screen turn on and then off once.", boolean_val, 0, 0 }, - { OPTION_DIM_MODE, "Dim Background", "Experimental! Dims colors on lighter backgrounds to improve readability with text. You won't notice the change until scrolling or exiting the current menu due to the way rendering works.", boolean_val, 0, 0 }, + { OPTION_AUTOBOOT, "Autoboot", "Boot the system automatically, unless the R key is held while booting.", boolean_val, 0, 0, 0 }, + { OPTION_SILENCE, "Silent mode", "Suppress all debug output during autoboot. You'll see the screen turn on and then off once.", boolean_val, 0, 0, 1 }, + { OPTION_DIM_MODE, "Dim Background", "Experimental! Dims colors on lighter backgrounds to improve readability with text. You won't notice the change until scrolling or exiting the current menu due to the way rendering works.", boolean_val, 0, 0, 0 }, - { OPTION_ACCENT_COLOR, "Accent color", "Changes the accent color in menus.", ranged_val, 1, 7}, + { OPTION_ACCENT_COLOR, "Accent color", "Changes the accent color in menus.", ranged_val, 1, 7, 0}, - { OPTION_BRIGHTNESS, "Brightness", "Changes the screeninit brightness in menu. WIP, only takes effect on reboot (this will change.)", ranged_val, 0, 3}, + { OPTION_BRIGHTNESS, "Brightness", "Changes the screeninit brightness in menu. WIP, only takes effect on reboot (this will change.)", ranged_val, 0, 3, 0}, // space - { 0, "", "", not_option, 0, 0 }, + { 0, "", "", not_option, 0, 0, 0 }, // Patches. - { 0, "Loader Options", "", not_option, 1, 0 }, + { 0, "Loader Options", "", not_option, 1, 0, 0 }, - { OPTION_LOADER, "Use Loader Replacement", "Replaces loader with one capable of extra features. You should enable this even if you don't plan to use loader-based patches to kill ASLR and the Ninjhax/OOThax checks.", boolean_val, 0, 0 }, - { OPTION_LOADER_CPU_L2, " CPU - L2 cache", "Forces the system to use the L2 cache on all applications. If you have issues with crashes, try turning this off.", boolean_val_n3ds, 0, 0 }, - { OPTION_LOADER_CPU_800MHZ, " CPU - 804Mhz", "Forces the system to run in 804Mhz mode on all applications.", boolean_val_n3ds, 0, 0 }, - { OPTION_LOADER_LANGEMU, " Language Emulation", "Reads language emulation configuration from `" PATH_LOCEMU "` and imitates the region/language.", boolean_val, 0, 0 }, - { OPTION_LOADER_LOADCODE, " Load Code Sections", "Loads code sections (text/ro/data) from SD card and patches afterwards.", boolean_val, 0, 0 }, + { OPTION_LOADER, "Use Loader Replacement", "Replaces loader with one capable of extra features. You should enable this even if you don't plan to use loader-based patches to kill ASLR and the Ninjhax/OOThax checks.", boolean_val, 0, 0, 0 }, + { OPTION_LOADER_CPU_L2, "CPU - L2 cache", "Forces the system to use the L2 cache on all applications. If you have issues with crashes, try turning this off.", boolean_val_n3ds, 0, 0, 1 }, + { OPTION_LOADER_CPU_800MHZ, "CPU - 804Mhz", "Forces the system to run in 804Mhz mode on all applications.", boolean_val_n3ds, 0, 0, 1 }, + { OPTION_LOADER_LANGEMU, "Language Emulation", "Reads language emulation configuration from `" PATH_LOCEMU "` and imitates the region/language.", boolean_val, 0, 0, 1 }, + { OPTION_LOADER_LOADCODE, "Load Code Sections", "Loads code sections (text/ro/data) from SD card and patches afterwards.", boolean_val, 0, 0, 1 }, - { OPTION_LOADER_DUMPCODE, " Dump Code Sections", - "Dumps code sections for titles to SD card the first time they're loaded. Slows things down on first launch.", boolean_val, 0, 0 }, + { OPTION_LOADER_DUMPCODE, "Dump Code Sections", + "Dumps code sections for titles to SD card the first time they're loaded. Slows things down on first launch.", boolean_val, 0, 0, 1 }, - { OPTION_LOADER_DUMPCODE_ALL, " + System Titles", - "Dumps code sections for system titles, too. Expect to sit at a blank screen for >3mins on the first time you do this, because it dumps everything.", boolean_val, 0, 0 }, + { OPTION_LOADER_DUMPCODE_ALL, "+ System Titles", + "Dumps code sections for system titles, too. Expect to sit at a blank screen for >3mins on the first time you do this, because it dumps everything.", boolean_val, 0, 0, 2 }, // space - { 0, "", "", not_option, 0, 0 }, + { 0, "", "", not_option, 0, 0, 0 }, // Patches. - { 0, "Developer Options", "", not_option, 1, 0 }, + { 0, "Developer Options", "", not_option, 1, 0, 0 }, - { OPTION_TRACE, "Step Through", "After each important step, [WAIT] will be shown and you'll need to press a key. Debug feature.", boolean_val, 0, 0 }, - { OPTION_OVERLY_VERBOSE, "Verbose", "Output more debug information than the average user needs.", boolean_val, 0, 0 }, - { OPTION_SAVE_LOGS, "Logging", "Save logs to `" LOCALSTATEDIR "` as `boot.log` and `loader.log`. Slows operation a bit.", boolean_val, 0, 0 }, + { OPTION_TRACE, "Step Through", "After each important step, [WAIT] will be shown and you'll need to press a key. Debug feature.", boolean_val, 0, 0, 0 }, + { OPTION_OVERLY_VERBOSE, "Verbose", "Output more debug information than the average user needs.", boolean_val, 0, 0, 0 }, + { OPTION_SAVE_LOGS, "Logging", "Save logs to `" LOCALSTATEDIR "` as `boot.log` and `loader.log`. Slows operation a bit.", boolean_val, 0, 0, 0 }, // { OPTION_ARM9THREAD, "ARM9 Thread", boolean_val, 0, 0 }, // { IGNORE_PATCH_DEPS, "Ignore dependencies", boolean_val, 0, 0 }, // { IGNORE_BROKEN_SHIT, "Allow unsafe options", boolean_val, 0, 0 }, // Sentinel. - { -1, "", "", 0, 0, 0 }, // cursor_min and cursor_max are stored in the last two. + { -1, "", "", 0, 0, 0, 0 }, // cursor_min and cursor_max are stored in the last two. }; static int current_menu_index_patches = 0; @@ -105,6 +105,7 @@ list_patches_build_back(char *fpath, int desc_is_path) patches[current_menu_index_patches].allowed = boolean_val; patches[current_menu_index_patches].a = 0; patches[current_menu_index_patches].b = 0; + patches[current_menu_index_patches].indent = 0; if (desc_is_path) enable_list[p.uuid] = 0; @@ -143,6 +144,7 @@ list_patches_build(char *name, int desc_is_fname) patches[0].allowed = not_option; patches[0].a = 1; patches[0].b = 0; + patches[0].indent = 0; current_menu_index_patches += 1; } @@ -176,11 +178,11 @@ menu_options() #endif static struct options_s info_d[] = { - { 0, " Native FIRM: ", "The version of NATIVE_FIRM in use.", not_option, 0, 0}, - { 0, " AGB FIRM: ", "The version of AGB_FIRM in use. This is used to run GBA games.", not_option, 0, 0}, - { 0, " TWL FIRM: ", "The version of TWL_FIRM in use. This is used to run DS games and DSiWare.", not_option, 0, 0}, - { 0, " " FW_NAME ": " REVISION " (" REL ")", FW_NAME "'s version.", not_option, 0, 0}, - { -1, "", "", not_option, 0, 0 } + { 0, "Native FIRM: ", "The version of NATIVE_FIRM in use.", not_option, 0, 0, 1}, + { 0, "AGB FIRM: ", "The version of AGB_FIRM in use. This is used to run GBA games.", not_option, 0, 0, 1}, + { 0, "TWL FIRM: ", "The version of TWL_FIRM in use. This is used to run DS games and DSiWare.", not_option, 0, 0, 1}, + { 0, FW_NAME ": " REVISION " (" REL ")", FW_NAME "'s version.", not_option, 0, 0, 1}, + { -1, "", "", not_option, 0, 0, 0 } }; static int is_setup_info = 0; @@ -205,8 +207,8 @@ menu_info() show_menu(info_d, NULL); } -#define ln(s) { 0, s, "", not_option, 0, 0 } -#define lnh(s) { 0, s, "", not_option, 1, 0 } +#define ln(s) { 0, s, "", not_option, 0, 0, 0 } +#define lnh(s) { 0, s, "", not_option, 1, 0, 0 } static struct options_s help_d[] = { lnh("About"), @@ -235,7 +237,7 @@ static struct options_s help_d[] = { ln(" forgotten (yell at me, please!)"), ln(""), ln(" "), - { -1, "", "", not_option, 0, 0 } + { -1, "", "", not_option, 0, 0, 0 } }; void @@ -275,20 +277,20 @@ void chainload_menu(); #endif static struct options_s main_s[] = { - { 0, "Options", "Internal options for the CFW.\nThese are part of " FW_NAME " itself.", call_fun, (uint32_t)menu_options, 0 }, - { 0, "Patches", "External bytecode patches found in `" PATH_PATCHES "`.\nYou can choose which to enable.", call_fun, (uint32_t)menu_patches, 0 }, - { 0, "Info", "Shows the current FIRM versions (and loads them, if needed)", call_fun, (uint32_t)menu_info, 0 }, - { 0, "Readme", "Mini-readme.\nWhy are you opening help on this, though?\nThat's kind of silly.", call_fun, (uint32_t)menu_help, 0 }, - { 0, "Reboot", "Reboots the console.", call_fun, (uint32_t)reset, 0 }, - { 0, "Power off", "Powers off the console.", call_fun, (uint32_t)poweroff, 0 }, - { 0, "Save Configuration", "Save the configuration.\nYou must do this prior to booting,\notherwise the cache will not be (re)generated..", call_fun, (uint32_t)save_config, 0 }, + { 0, "Options", "Internal options for the CFW.\nThese are part of " FW_NAME " itself.", call_fun, (uint32_t)menu_options, 0, 0 }, + { 0, "Patches", "External bytecode patches found in `" PATH_PATCHES "`.\nYou can choose which to enable.", call_fun, (uint32_t)menu_patches, 0, 0 }, + { 0, "Info", "Shows the current FIRM versions (and loads them, if needed)", call_fun, (uint32_t)menu_info, 0, 0 }, + { 0, "Readme", "Mini-readme.\nWhy are you opening help on this, though?\nThat's kind of silly.", call_fun, (uint32_t)menu_help, 0, 0 }, + { 0, "Reboot", "Reboots the console.", call_fun, (uint32_t)reset, 0, 0 }, + { 0, "Power off", "Powers off the console.", call_fun, (uint32_t)poweroff, 0, 0 }, + { 0, "Save Configuration", "Save the configuration.\nYou must do this prior to booting,\notherwise the cache will not be (re)generated..", call_fun, (uint32_t)save_config, 0, 0 }, #if defined(CHAINLOADER) && CHAINLOADER == 1 - { 0, "Chainload", "Boot another ARM9 payload file.", call_fun, (uint32_t)chainload_menu, 0 }, + { 0, "Chainload", "Boot another ARM9 payload file.", call_fun, (uint32_t)chainload_menu, 0, 0 }, #endif - { 0, "Boot Firmware", "Generates caches, patches the firmware, and boots it.\nMake sure to 'Save Configuration' first if any options changed.", break_menu, 0, 0 }, + { 0, "Boot Firmware", "Generates caches, patches the firmware, and boots it.\nMake sure to 'Save Configuration' first if any options changed.", break_menu, 0, 0, 0 }, // Sentinel. - { -1, "", "", 0, 0, 0 }, // cursor_min and cursor_max are stored in the last two. + { -1, "", "", 0, 0, 0, 0 }, // cursor_min and cursor_max are stored in the last two. }; void