]> Chaos Git - corbenik/corbenik.git/commitdiff
More minor cleanup
authorchaoskagami <chaos.kagami@gmail.com>
Tue, 10 Jan 2017 13:42:29 +0000 (08:42 -0500)
committerchaoskagami <chaos.kagami@gmail.com>
Tue, 10 Jan 2017 13:42:29 +0000 (08:42 -0500)
include/option.h
source/Makefile.am
source/configback/dummy.c [new file with mode: 0644]
source/configback/file-dat.c [moved from source/config-backend-file.c with 99% similarity]
source/corbenik.c [moved from source/main.c with 100% similarity]
source/menu.c

index a043043e47aec697b1946bbe2b1b3b8f42fe925b..d462612d1f5c5b07e2e6319bba0e02b7a81db378 100644 (file)
@@ -105,7 +105,7 @@ void save_config(void);
 
 /* Changes an option according to internal rules. Used in menus.
  */
-void  change_opt(void* val);
+void  toggle_opt(void* val);
 
 /* Gets an option as a readable string.
  */
index 0dae7bafca71ff89f636b1d4110644ec7e725a63..ad899e4f5f54d6a658afe83a178be3c93c37e590 100644 (file)
@@ -19,4 +19,10 @@ corbenikdir = $(top_srcdir)/source
 
 inc_dir = $(top_srcdir)/include
 
-corbenik_SOURCES = patch/reboot.c patch/svc.c patch/module.c patch/emunand.c main.c std/fs.c std/draw.c std/memory.c std/abort.c menu.c firm/util.c firm/keys.c firm/firmlaunch.c firm/version.c firm/firm.c firm/decryptor.c interpreter.c input.c patcher.c chainloader.c config-backend-file.c menu-backend.c start.s interrupt.c arm11.c test-framework.c
+corbenik_SOURCES = \
+       start.s corbenik.c \
+       menu.c menu-backend.c interrupt.c arm11.c test-framework.c interpreter.c input.c patcher.c chainloader.c \
+       patch/reboot.c patch/svc.c patch/module.c patch/emunand.c \
+       std/fs.c std/draw.c std/memory.c std/abort.c \
+       firm/util.c firm/keys.c firm/firmlaunch.c firm/version.c firm/firm.c firm/decryptor.c \
+       configback/file-dat.c
diff --git a/source/configback/dummy.c b/source/configback/dummy.c
new file mode 100644 (file)
index 0000000..b1bce5c
--- /dev/null
@@ -0,0 +1,36 @@
+#include <common.h>
+
+// This is a do-nothing implementation of the configuration backend.
+// It's solely to show what the access API for config should be.
+
+// Recreates the configuration from scratch.
+void regenerate_config(void) {}
+
+// Loads the configuration.
+void load_config(void) {}
+
+// Saves the configuration.
+void save_config(void) {}
+
+// Toggles an option.
+void toggle_opt(void* val) {}
+
+// Gets an option as a string suitable for printing.
+char* get_opt(void* val) {
+    return "?";
+}
+
+// Gets an option as a uint32_t.
+uint32_t get_opt_u32(uint32_t val) {
+    return 0;
+}
+
+// Sets an option as a uint32_t.
+int set_opt_u32(uint32_t key, uint32_t val) {
+    return 0;
+}
+
+// Sets an option as a string.
+int set_opt_str(uint32_t key, const char* val) {
+    return 0;
+}
similarity index 99%
rename from source/config-backend-file.c
rename to source/configback/file-dat.c
index 34edaf1a788b221006b946e0dac498583264e29f..a2f9dfc14a9a2e8e008043f7bf8050621907ad89 100644 (file)
@@ -168,7 +168,7 @@ save_config(void)
     crclose(conf_handle);
 }
 
-void change_opt(void* val) {
+void toggle_opt(void* val) {
     uint32_t opt = (uint32_t)val;
     uint8_t* set = & (config->options[opt]);
     switch(opt) {
similarity index 100%
rename from source/main.c
rename to source/corbenik.c
index 09c383a6173428a68115fe58d5bc655571aec461..e62febda325d5cc0f4efa824d183542ccbe7d4f8 100644 (file)
@@ -34,41 +34,41 @@ static struct options_s options[] = {
 
     { "System Module Inject",
       "Replaces system modules in FIRM like loader, fs, pxi, etc.",
-      option, (void*)OPTION_LOADER, change_opt, get_opt, 0, 0 },
+      option, (void*)OPTION_LOADER, toggle_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, 0 },
+      option, (void*)OPTION_SVCS, toggle_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, 0 },
+      option, (void*)OPTION_REBOOT, toggle_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, 0 },
+      option, (void*)OPTION_EMUNAND, toggle_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, 0 },
+      option, (void*)OPTION_EMUNAND_INDEX, toggle_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, 0 },
+      option, (void*)OPTION_AUTOBOOT, toggle_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, 0 },
+      option, (void*)OPTION_SILENCE, toggle_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, 0 },
+      option, (void*)OPTION_DIM_MODE, toggle_opt, get_opt, 0, 0 },
 
     { "Accent color",
       "Changes the accent color in menus.",
-      option, (void*)OPTION_ACCENT_COLOR, change_opt, get_opt, 0, 0 },
+      option, (void*)OPTION_ACCENT_COLOR, toggle_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, 0 },
+      option, (void*)OPTION_BRIGHTNESS, toggle_opt, get_opt, 0, 0 },
 
     // space
     { "", "", unselectable, 0, NULL, NULL, 0, 0 },
@@ -77,25 +77,25 @@ static struct options_s options[] = {
 
     { "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, 0 },
+      option_n3ds, (void*)OPTION_LOADER_CPU_L2, toggle_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, 0 },
+      option_n3ds, (void*)OPTION_LOADER_CPU_800MHZ, toggle_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, 0 },
+      option, (void*)OPTION_LOADER_LANGEMU, toggle_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, 0 },
+      option, (void*)OPTION_LOADER_LOADCODE, toggle_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, 0 },
+      option, (void*)OPTION_LOADER_DUMPCODE, toggle_opt, get_opt, 0, 0 },
     { "Merged codebins",
       "Use merged codebins rather than segment split files.",
-      option, (void*)OPTION_LOADER_DUMPCODE_MERGED, change_opt, get_opt, 1, 0 },
+      option, (void*)OPTION_LOADER_DUMPCODE_MERGED, toggle_opt, get_opt, 1, 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, 0 },
+      option, (void*)OPTION_LOADER_DUMPCODE_ALL, toggle_opt, get_opt, 1, 0 },
 
     // space
     { "", "", unselectable, 0, NULL, NULL, 0, 0 },
@@ -104,13 +104,13 @@ static struct options_s options[] = {
 
     { "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, 0 },
+      option, (void*)OPTION_TRACE, toggle_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, 0 },
+      option, (void*)OPTION_OVERLY_VERBOSE, toggle_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, 0 },
+      option, (void*)OPTION_SAVE_LOGS, toggle_opt, get_opt, 0, 0 },
 
     // Sentinel.
     { NULL, NULL, 0, 0, NULL, NULL, 0, 0 }, // cursor_min and cursor_max are stored in the last two.