From 7ef830adabc72bf93601c1bf59b8c405563fc53b Mon Sep 17 00:00:00 2001 From: chaoskagami Date: Tue, 2 Aug 2016 18:27:10 -0400 Subject: [PATCH] Okay, yeah, standalone chainloader is A-OK now --- source/menu.c | 80 +++++++++++++++++++++++++++++++------------------ source/option.c | 18 ----------- 2 files changed, 51 insertions(+), 47 deletions(-) diff --git a/source/menu.c b/source/menu.c index 03456f2..73b2ecd 100644 --- a/source/menu.c +++ b/source/menu.c @@ -1,18 +1,66 @@ #include #include +static struct options_s unmount_menu[] = { + // Patches. + { 0, "Card is now unmounted. Press [B] to remount.", "", not_option, 1, 0 }, + { -1, "", "", 0, 0, 0} +}; + +void unmount_card() { + fumount(); + + show_menu(unmount_menu, NULL); + + fmount(); +} + +void +reset() +{ + fflush(stderr); + + fumount(); // Unmount SD. + + // Reboot. + fprintf(BOTTOM_SCREEN, "Rebooting system...\n"); + + ctr_system_reset(); +} + +void +poweroff() +{ + fflush(stderr); + + fumount(); // Unmount SD. + + // Power off + fprintf(BOTTOM_SCREEN, "Powering off system...\n"); + + ctr_system_poweroff(); +} + static struct options_s options[] = { // Patches. - { 0, "General Options", "", not_option, 1, 0 }, + { 0, "Options", "", not_option, 1, 0 }, - { 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_ACCENT_COLOR, "Accent color", "Changes the accent color in menus.", ranged_val, 1, 7}, { OPTION_BRIGHTNESS, "Brightness", "Changes the screeninit brightness in menu. WIP, only takes effect on reboot (this will change.)", ranged_val, 0, 3}, + { 0, "Apply", "Apply settings", call_fun, (uint32_t)save_config, 0}, + + { 0, "", "", not_option, 0, 0 }, // cursor_min and cursor_max are stored in the last two. + { 0, "- - -", "", not_option, 0, 0 }, // cursor_min and cursor_max are stored in the last two. + { 0, "", "", not_option, 0, 0 }, // cursor_min and cursor_max are stored in the last two. + + { 0, "Unmount SD", "Unmount the SD card.", call_fun, (uint32_t)unmount_card, 0}, + { 0, "Reboot", "Reboot the console.", call_fun, (uint32_t)reset, 0}, + { 0, "Power off", "Power off the console.", call_fun, (uint32_t)poweroff, 0}, + // Sentinel. { -1, "", "", 0, 0, 0 }, // cursor_min and cursor_max are stored in the last two. }; @@ -44,32 +92,6 @@ menu_options() #define REL "master" #endif -void -reset() -{ - fflush(stderr); - - fumount(); // Unmount SD. - - // Reboot. - fprintf(BOTTOM_SCREEN, "Rebooting system...\n"); - - ctr_system_reset(); -} - -void -poweroff() -{ - fflush(stderr); - - fumount(); // Unmount SD. - - // Power off - fprintf(BOTTOM_SCREEN, "Powering off system...\n"); - - ctr_system_poweroff(); -} - void chainload_menu(); void diff --git a/source/option.c b/source/option.c index 1eee036..3115d4d 100644 --- a/source/option.c +++ b/source/option.c @@ -29,26 +29,8 @@ mk_structure() f_mkdir(DATA); f_mkdir(LIBEXECDIR); f_mkdir(LIBDIR); - f_mkdir(PATH_EXEFS); - f_mkdir(PATH_EXEFS_TEXT); - f_mkdir(PATH_EXEFS_DATA); - f_mkdir(PATH_EXEFS_RO); - f_mkdir(PATH_FIRMWARES); - f_mkdir(PATH_MODULES); - f_mkdir(BINDIR); -#if defined(CHAINLOADER) && CHAINLOADER == 1 f_mkdir(PATH_CHAINS); -#endif - f_mkdir(SBINDIR); f_mkdir(SYSCONFDIR); - f_mkdir(LOCALSTATEDIR); - f_mkdir(PATH_TEMP); - f_mkdir(PATH_LOADER_CACHE); - f_mkdir(PATH_LOG); - f_mkdir(SHAREDIR); - f_mkdir(PATH_KEYS); - f_mkdir(LOCALEDIR); - f_mkdir(PATH_LOCEMU); } void -- 2.39.5