]> Chaos Git - corbenik/corbenik.git/commitdiff
Restore menu accent colors
authorchaoskagami <chaos.kagami@gmail.com>
Sun, 28 Aug 2016 07:49:15 +0000 (03:49 -0400)
committerchaoskagami <chaos.kagami@gmail.com>
Sun, 28 Aug 2016 07:49:15 +0000 (03:49 -0400)
host/copy-min.sh [new file with mode: 0644]
include/menu-backend.h
source/chainloader.c
source/menu-backend.c
source/menu.c

diff --git a/host/copy-min.sh b/host/copy-min.sh
new file mode 100644 (file)
index 0000000..86590ad
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# This is just a helper script I use to copy shit to my own unit.
+# You don't and shouldn't need to use it.
+
+mnt=/media/sd
+dev=/dev/sdc
+
+mnt=/mnt/ext1
+
+mount -t vfat ${dev}1 $mnt || exit 0
+cp out/arm9loaderhax.bin $mnt/arm9loaderhax_si.bin || exit 0
+umount $mnt || exit 0
+sync || exit 0
+eject ${dev} || exit 0
index ebb6a45e25af6ce3fa90b591262318d76aae7a06..0549247a8759185b054d14aecf717ab1f5ac069e 100644 (file)
@@ -24,6 +24,7 @@ struct options_s
     func_call_t func;  ///< Function to call on selection of option
     get_value_t value; ///< Function to get the value of the menu entry
     uint8_t indent;    ///< Indentation/ownership level of menu.
+    uint8_t highlight; ///< Colorize with the accent color
 };
 
 /* Set the accent foreground color for a screen.
index 5cc9690cf4e8a422f7343f06a1495d189e96a794..754d5b2863e269106e0af0a7120e117be0e5bd73 100644 (file)
@@ -120,6 +120,7 @@ list_chain_build(const char *name)
     chains[0].value = NULL;
     chains[0].handle = unselectable;
     chains[0].indent = 0;
+    chains[0].highlight = 1;
 
     current_chain_index += 1;
 
index 2e02cd5e528031c77bd83c00a6b482a8f9aeccbd..e77a488e5b0a8b1a72a089b05c9fc59760bd1c92 100644 (file)
@@ -120,7 +120,9 @@ show_menu(struct options_s *options)
                 }
             }
 
-            fprintf(TOP_SCREEN, "%s", options[i].name);
+            if (options[i].highlight == 1)
+                accent_color(TOP_SCREEN, 1);
+            fprintf(TOP_SCREEN, "%s\x1b[0m", options[i].name);
         }
 
         uint32_t key = wait_key(1);
index 3109e1ebd382ada86fefd06b85f87629a3997bcb..cca47d8a40206213d0568cfa579b1822e29a3e12 100644 (file)
@@ -57,89 +57,89 @@ char* get_opt(void* val) {
 
 static struct options_s options[] = {
     // Patches.
-    { "General Options", "", unselectable, 0, NULL, NULL, 0 },
+    { "General Options", "", unselectable, 0, NULL, NULL, 0, 1 },
 
     { "System Module Inject",
       "Replaces system modules in FIRM like loader, fs, pxi, etc.",
-      option, (void*)OPTION_LOADER, change_opt, get_opt, 0 },
+      option, (void*)OPTION_LOADER, change_opt, get_opt, 0, 0 },
 
     { "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.",
-      option, (void*)OPTION_SVCS, change_opt, get_opt, 0 },
+      option, (void*)OPTION_SVCS, change_opt, get_opt, 0, 0 },
 
     { "Firmlaunch Hook",
       "Hooks firmlaunch to allow largemem games on o3DS. Also allows patching TWL/AGB on all consoles. Previously called 'Reboot hook' but renamed for accuracy.",
-      option, (void*)OPTION_REBOOT, change_opt, get_opt, 0 },
+      option, (void*)OPTION_REBOOT, change_opt, get_opt, 0, 0 },
 
     { "Use EmuNAND",
       "Redirects NAND write/read to the SD. This supports both Gateway and redirected layouts.",
-      option, (void*)OPTION_EMUNAND, change_opt, get_opt, 0 },
+      option, (void*)OPTION_EMUNAND, change_opt, get_opt, 0, 0 },
     { "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.",
-      option, (void*)OPTION_EMUNAND_INDEX, change_opt, get_opt, 1 },
+      option, (void*)OPTION_EMUNAND_INDEX, change_opt, get_opt, 1, 0 },
 
     { "Autoboot",
       "Boot the system automatically, unless the R key is held while booting.",
-      option, (void*)OPTION_AUTOBOOT, change_opt, get_opt, 0 },
+      option, (void*)OPTION_AUTOBOOT, change_opt, get_opt, 0, 0 },
     { "Silent mode",
       "Suppress all debug output during autoboot. You'll see the screen turn on and then off once.",
-      option, (void*)OPTION_SILENCE, change_opt, get_opt, 1 },
+      option, (void*)OPTION_SILENCE, change_opt, get_opt, 1, 0 },
 
     { "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.",
-      option, (void*)OPTION_DIM_MODE, change_opt, get_opt, 0 },
+      option, (void*)OPTION_DIM_MODE, change_opt, get_opt, 0, 0 },
 
     { "Accent color",
       "Changes the accent color in menus.",
-      option, (void*)OPTION_ACCENT_COLOR, change_opt, get_opt, 0 },
+      option, (void*)OPTION_ACCENT_COLOR, change_opt, get_opt, 0, 0 },
 
     { "Brightness",
       "Changes the screeninit brightness in menu. WIP, only takes effect on reboot (this will change.)",
-      option, (void*)OPTION_BRIGHTNESS, change_opt, get_opt, 0 },
+      option, (void*)OPTION_BRIGHTNESS, change_opt, get_opt, 0, 0 },
 
     // space
-    { "", "", unselectable, 0, NULL, NULL, 0 },
+    { "", "", unselectable, 0, NULL, NULL, 0, 0 },
     // Patches.
-    { "Loader Options", "", unselectable, 0, NULL, NULL, 0 },
+    { "Loader Options", "", unselectable, 0, NULL, NULL, 0, 1 },
 
     { "CPU - L2 cache",
       "Forces the system to use the L2 cache on all applications. If you have issues with crashes, try turning this off.",
-      option_n3ds, (void*)OPTION_LOADER_CPU_L2, change_opt, get_opt, 0 },
+      option_n3ds, (void*)OPTION_LOADER_CPU_L2, change_opt, get_opt, 0, 0 },
     { "CPU - 804Mhz",
       "Forces the system to run in 804Mhz mode on all applications.",
-      option_n3ds, (void*)OPTION_LOADER_CPU_800MHZ, change_opt, get_opt, 0 },
+      option_n3ds, (void*)OPTION_LOADER_CPU_800MHZ, change_opt, get_opt, 0, 0 },
     { "Language Emulation",
       "Reads language emulation configuration from `" PATH_LOCEMU "` and imitates the region/language.",
-      option, (void*)OPTION_LOADER_LANGEMU, change_opt, get_opt, 0 },
+      option, (void*)OPTION_LOADER_LANGEMU, change_opt, get_opt, 0, 0 },
     { "Load Code Sections",
       "Loads code sections (text/ro/data) from SD card and patches afterwards.",
-      option, (void*)OPTION_LOADER_LOADCODE, change_opt, get_opt, 0 },
+      option, (void*)OPTION_LOADER_LOADCODE, change_opt, get_opt, 0, 0 },
 
     { "Dump Code Sections",
       "Dumps code sections for titles to SD card the first time they're loaded. Slows things down on first launch.",
-      option, (void*)OPTION_LOADER_DUMPCODE, change_opt, get_opt, 0 },
+      option, (void*)OPTION_LOADER_DUMPCODE, change_opt, get_opt, 0, 0 },
 
     { "+ 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.",
-      option, (void*)OPTION_LOADER_DUMPCODE_ALL, change_opt, get_opt, 1 },
+      option, (void*)OPTION_LOADER_DUMPCODE_ALL, change_opt, get_opt, 1, 0 },
 
     // space
-    { "", "", unselectable, 0, NULL, NULL, 0 },
+    { "", "", unselectable, 0, NULL, NULL, 0, 0 },
     // Patches.
-    { "Developer Options", "", unselectable, 0, NULL, NULL, 0 },
+    { "Developer Options", "", unselectable, 0, NULL, NULL, 0, 1 },
 
     { "Step Through",
       "After each important step, [WAIT] will be shown and you'll need to press a key. Debug feature.",
-      option, (void*)OPTION_TRACE, change_opt, get_opt, 0 },
+      option, (void*)OPTION_TRACE, change_opt, get_opt, 0, 0 },
     { "Verbose",
       "Output more debug information than the average user needs.",
-      option, (void*)OPTION_OVERLY_VERBOSE, change_opt, get_opt, 0 },
+      option, (void*)OPTION_OVERLY_VERBOSE, change_opt, get_opt, 0, 0 },
     { "Logging",
       "Save logs to `" LOCALSTATEDIR "` as `boot.log` and `loader.log`. Slows operation a bit.",
-      option, (void*)OPTION_SAVE_LOGS, change_opt, get_opt, 0 },
+      option, (void*)OPTION_SAVE_LOGS, change_opt, get_opt, 0, 0 },
 
     // Sentinel.
-    { NULL, NULL, 0, 0, NULL, NULL, 0 }, // cursor_min and cursor_max are stored in the last two.
+    { NULL, NULL, 0, 0, NULL, NULL, 0, 0 }, // cursor_min and cursor_max are stored in the last two.
 };
 
 static int current_menu_index_patches = 0;
@@ -216,6 +216,7 @@ list_patches_build(const char *name, int desc_is_fname)
     patches[0].indent = 0;
     patches[0].func   = NULL;
     patches[0].value  = NULL;
+    patches[0].highlight = 1;
 
     current_menu_index_patches += 1;
 
@@ -240,17 +241,18 @@ menu_options()
 #define REL "master"
 #endif
 
-#define ln(s) { s, "", unselectable, 0, NULL, NULL, 0 }
+#define ln(s) { s, "", unselectable, 0, NULL, NULL, 0, 0 }
+#define lnh(s) { s, "", unselectable, 0, NULL, NULL, 0, 1 }
 
 static struct options_s help_d[] = {
-    ln("About"),
+    lnh("About"),
     ln("  This is another 3DS CFW for power users."),
     ln("  It seeks to address some faults in other"),
     ln("  CFWs and is generally just another choice"),
     ln("  for users - but primarily is intended for"),
     ln("  developers. It is not for the faint of heart."),
     ln(""),
-    ln("Usage"),
+    lnh("Usage"),
     ln("  A         -> Select/Toggle/Increment"),
     ln("  B         -> Back/Boot"),
     ln("  X         -> Decrement"),
@@ -261,15 +263,15 @@ static struct options_s help_d[] = {
     ln("  Left      -> Up five"),
     ln("  L+R+Start -> Menu Screenshot"),
     ln(""),
-    ln("Credits"),
+    lnh("Credits"),
     ln("  @mid-kid, @Wolfvak, @Reisyukaku, @AuroraWright"),
     ln("  @d0k3, @TuxSH, @Steveice10, @delebile,"),
     ln("  @Normmatt, @b1l1s, @dark-samus, @TiniVi,"),
     ln("  @gemarcano, and anyone else I may have"),
     ln("  forgotten (yell at me, please!)"),
     ln(""),
-    ln("  <https://github.com/chaoskagami/corbenik>"),
-    { NULL, NULL, unselectable, 0, NULL, NULL, 0 }, // cursor_min and cursor_max are stored in the last two.
+    lnh("  <https://github.com/chaoskagami/corbenik>"),
+    { NULL, NULL, unselectable, 0, NULL, NULL, 0, 0 }, // cursor_min and cursor_max are stored in the last two.
 };
 
 void
@@ -311,13 +313,13 @@ void chainload_menu();
 static struct options_s config_opts[] = {
     { "Options",
       "Internal options for the CFW.\nThese are part of " FW_NAME " itself.",
-      option, 0, menu_options, NULL, 0 },
+      option, 0, menu_options, NULL, 0, 0 },
     { "Patches",
       "External bytecode patches found in `" PATH_PATCHES "`.\nYou can choose which to enable.",
-      option, 0, menu_patches, NULL, 0 },
+      option, 0, menu_patches, NULL, 0, 0 },
 
     // Sentinel.
-    { NULL, NULL, 0, 0, NULL, NULL, 0 }, // cursor_min and cursor_max are stored in the last two.
+    { NULL, NULL, 0, 0, NULL, NULL, 0, 0 }, // cursor_min and cursor_max are stored in the last two.
 };
 
 void config_main_menu() {
@@ -331,27 +333,27 @@ void config_main_menu() {
 static struct options_s main_s[] = {
     { "Configuration",
       "Configuration options for the CFW.",
-      option, 0, config_main_menu, NULL, 0 },
+      option, 0, config_main_menu, NULL, 0, 0 },
     { "Readme",
       "Mini-readme.\nWhy are you opening help on this, though?\nThat's kind of silly.",
-      option, 0, menu_help, NULL, 0 },
+      option, 0, menu_help, NULL, 0, 0 },
     { "Reboot",
       "Reboots the console.",
-      option, 0, reset, NULL, 0 },
+      option, 0, reset, NULL, 0, 0 },
     { "Power off",
       "Powers off the console.",
-      option, 0, poweroff, NULL, 0 },
+      option, 0, poweroff, NULL, 0, 0 },
 #if defined(CHAINLOADER) && CHAINLOADER == 1
     { "Chainload",
       "Boot another ARM9 payload file.",
-       option, 0, chainload_menu, NULL, 0 },
+       option, 0, chainload_menu, NULL, 0, 0 },
 #endif
     { "Boot Firmware",
-      "Generates caches, patches the firmware, and boots it.\nMake sure to 'Save Configuration' first if any options changed.",
-      break_menu, 0, NULL, NULL, 0 },
+      "Patches the firmware, and boots it.",
+      break_menu, 0, NULL, NULL, 0, 0 },
 
     // Sentinel.
-    { NULL, NULL, 0, 0, NULL, NULL, 0 }, // cursor_min and cursor_max are stored in the last two.
+    { NULL, NULL, 0, 0, NULL, NULL, 0, 0 }, // cursor_min and cursor_max are stored in the last two.
 };
 
 void