From dac56029d8a108727957f9517e75b8717d0bd26e Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 3 Jul 2024 15:12:09 +0100 Subject: [PATCH 01/16] Improve RTC message --- src/menu/views/rtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/menu/views/rtc.c b/src/menu/views/rtc.c index d810f382d..ae56fd8b2 100644 --- a/src/menu/views/rtc.c +++ b/src/menu/views/rtc.c @@ -36,7 +36,7 @@ static void draw (menu_t *menu, surface_t *d) { "\n" "\n" "To set the date and time, please use the PC terminal\n" - "application and set via USB.\n\n" + "application and set via USB or a game that uses it.\n\n" "Current date & time: %s\n", menu->current_time >= 0 ? ctime(&menu->current_time) : "Unknown\n" ); From 00f24a971b514a0e4b98899d60005c31bdecfcf7 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 3 Jul 2024 16:21:57 +0100 Subject: [PATCH 02/16] Add context menu for settings TODO: save settings to config.ini --- src/menu/views/settings_editor.c | 79 +++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 2 deletions(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index badb3696b..8cc0356f5 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -9,11 +9,75 @@ static const char *format_switch (bool state) { } } +static void set_pal60_type (menu_t *menu, void *arg) { + menu->settings.pal60_enabled = (bool) (arg); + + menu->browser.reload = true; +} + +static void set_protected_entries_type (menu_t *menu, void *arg) { + menu->settings.show_protected_entries = (bool) (arg); + + menu->browser.reload = true; +} + +static void set_sound_enabled_type (menu_t *menu, void *arg) { + menu->settings.sound_enabled = (bool) (arg); + + menu->browser.reload = true; +} + +static void set_use_saves_folder_type (menu_t *menu, void *arg) { + menu->settings.use_saves_folder = (bool) (arg); + + menu->browser.reload = true; +} + +static component_context_menu_t set_pal60_type_context_menu = { .list = { + {.text = "Enable", .action = set_pal60_type, .arg = (void *) (true) }, + {.text = "Disable", .action = set_pal60_type, .arg = (void *) (false) }, + COMPONENT_CONTEXT_MENU_LIST_END, +}}; + +static component_context_menu_t set_protected_entries_type_context_menu = { .list = { + {.text = "Enable", .action = set_protected_entries_type, .arg = (void *) (true) }, + {.text = "Disable", .action = set_protected_entries_type, .arg = (void *) (false) }, + COMPONENT_CONTEXT_MENU_LIST_END, +}}; + +static component_context_menu_t set_sound_enabled_type_context_menu = { .list = { + {.text = "Enable", .action = set_sound_enabled_type, .arg = (void *) (true) }, + {.text = "Disable", .action = set_sound_enabled_type, .arg = (void *) (false) }, + COMPONENT_CONTEXT_MENU_LIST_END, +}}; + +static component_context_menu_t set_use_saves_folder_type_context_menu = { .list = { + {.text = "Enable", .action = set_use_saves_folder_type, .arg = (void *) (true) }, + {.text = "Disable", .action = set_use_saves_folder_type, .arg = (void *) (false) }, + COMPONENT_CONTEXT_MENU_LIST_END, +}}; + +static component_context_menu_t options_context_menu = { .list = { + { .text = "Set PAL60 Mode", .submenu = &set_pal60_type_context_menu }, + { .text = "Show Hidden Files", .submenu = &set_protected_entries_type_context_menu }, + { .text = "Set Menu Sound", .submenu = &set_sound_enabled_type_context_menu }, + { .text = "Use saves folder", .submenu = &set_use_saves_folder_type_context_menu }, + + COMPONENT_CONTEXT_MENU_LIST_END, +}}; + static void process (menu_t *menu) { + if (component_context_menu_process(menu, &options_context_menu)) { + return; + } + if (menu->actions.back) { menu->next_mode = MENU_MODE_BROWSER; sound_play_effect(SFX_EXIT); + } else if (menu->actions.options) { + component_context_menu_show(&options_context_menu); + sound_play_effect(SFX_SETTING); } } @@ -34,7 +98,8 @@ static void draw (menu_t *menu, surface_t *d) { ALIGN_LEFT, VALIGN_TOP, "\n" "\n" - "To change the settings, please adjust them\n" + "To change the settings, press `R`.\n" + "Certain options are only adjustable\n" "directly in the 'menu/config.ini' file.\n\n" "pal60_enabled: %s\n" "show_protected_entries: %s\n" @@ -58,12 +123,22 @@ static void draw (menu_t *menu, surface_t *d) { "B: Back" ); + component_actions_bar_text_draw( + ALIGN_RIGHT, VALIGN_TOP, + "\n" + "R: Options" + ); + + component_context_menu_draw(&options_context_menu); + rdpq_detach_show(); } void view_settings_init (menu_t *menu) { - // Nothing to initialize (yet) + + component_context_menu_init(&options_context_menu); + } void view_settings_display (menu_t *menu, surface_t *display) { From 5e8523bae7505c84d9df06122c7b98f9a0aed132 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 3 Jul 2024 18:01:37 +0100 Subject: [PATCH 03/16] Add ability to save settings Improve context values. --- src/menu/views/settings_editor.c | 78 +++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 22 deletions(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 8cc0356f5..5f2f3acb9 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -1,6 +1,9 @@ +#include #include "../sound.h" +#include "../settings.h" #include "views.h" +static bool settings_changed = false; static const char *format_switch (bool state) { switch (state) { @@ -10,50 +13,71 @@ static const char *format_switch (bool state) { } static void set_pal60_type (menu_t *menu, void *arg) { + bool initial_setting_val = menu->settings.pal60_enabled; menu->settings.pal60_enabled = (bool) (arg); + if (initial_setting_val != menu->settings.pal60_enabled) { + settings_changed = true; + } menu->browser.reload = true; } static void set_protected_entries_type (menu_t *menu, void *arg) { + bool initial_setting_val = menu->settings.show_protected_entries; menu->settings.show_protected_entries = (bool) (arg); - + if (initial_setting_val != menu->settings.show_protected_entries) { + settings_changed = true; + } + menu->browser.reload = true; } static void set_sound_enabled_type (menu_t *menu, void *arg) { + bool initial_setting_val = menu->settings.sound_enabled; menu->settings.sound_enabled = (bool) (arg); - + if (initial_setting_val != menu->settings.sound_enabled) { + settings_changed = true; + } + menu->browser.reload = true; } static void set_use_saves_folder_type (menu_t *menu, void *arg) { + bool initial_setting_val = menu->settings.use_saves_folder; menu->settings.use_saves_folder = (bool) (arg); - + if (initial_setting_val != menu->settings.use_saves_folder) { + settings_changed = true; + } + menu->browser.reload = true; } +// static void set_use_default_settings (menu_t *menu, void *arg) { +// // FIXME: add implementation +// menu->browser.reload = true; +// } + static component_context_menu_t set_pal60_type_context_menu = { .list = { - {.text = "Enable", .action = set_pal60_type, .arg = (void *) (true) }, - {.text = "Disable", .action = set_pal60_type, .arg = (void *) (false) }, + {.text = "On", .action = set_pal60_type, .arg = (void *) (true) }, + {.text = "Off", .action = set_pal60_type, .arg = (void *) (false) }, COMPONENT_CONTEXT_MENU_LIST_END, }}; static component_context_menu_t set_protected_entries_type_context_menu = { .list = { - {.text = "Enable", .action = set_protected_entries_type, .arg = (void *) (true) }, - {.text = "Disable", .action = set_protected_entries_type, .arg = (void *) (false) }, + {.text = "On", .action = set_protected_entries_type, .arg = (void *) (true) }, + {.text = "Off", .action = set_protected_entries_type, .arg = (void *) (false) }, COMPONENT_CONTEXT_MENU_LIST_END, }}; static component_context_menu_t set_sound_enabled_type_context_menu = { .list = { - {.text = "Enable", .action = set_sound_enabled_type, .arg = (void *) (true) }, - {.text = "Disable", .action = set_sound_enabled_type, .arg = (void *) (false) }, + {.text = "On", .action = set_sound_enabled_type, .arg = (void *) (true) }, + {.text = "Off", .action = set_sound_enabled_type, .arg = (void *) (false) }, COMPONENT_CONTEXT_MENU_LIST_END, }}; static component_context_menu_t set_use_saves_folder_type_context_menu = { .list = { - {.text = "Enable", .action = set_use_saves_folder_type, .arg = (void *) (true) }, - {.text = "Disable", .action = set_use_saves_folder_type, .arg = (void *) (false) }, + {.text = "On", .action = set_use_saves_folder_type, .arg = (void *) (true) }, + {.text = "Off", .action = set_use_saves_folder_type, .arg = (void *) (false) }, COMPONENT_CONTEXT_MENU_LIST_END, }}; @@ -62,6 +86,7 @@ static component_context_menu_t options_context_menu = { .list = { { .text = "Show Hidden Files", .submenu = &set_protected_entries_type_context_menu }, { .text = "Set Menu Sound", .submenu = &set_sound_enabled_type_context_menu }, { .text = "Use saves folder", .submenu = &set_use_saves_folder_type_context_menu }, + // { .text = "Restore defaults", .action = set_use_default_settings }, COMPONENT_CONTEXT_MENU_LIST_END, }}; @@ -72,12 +97,18 @@ static void process (menu_t *menu) { return; } - if (menu->actions.back) { + if (menu->actions.enter) { + component_context_menu_show(&options_context_menu); + sound_play_effect(SFX_SETTING); + } else if (menu->actions.back) { + // FIXME: should we allow preview in the menu, or forget them? menu->next_mode = MENU_MODE_BROWSER; sound_play_effect(SFX_EXIT); } else if (menu->actions.options) { - component_context_menu_show(&options_context_menu); - sound_play_effect(SFX_SETTING); + if (settings_changed) { + settings_save(&menu->settings); + settings_changed = false; + } } } @@ -98,8 +129,8 @@ static void draw (menu_t *menu, surface_t *d) { ALIGN_LEFT, VALIGN_TOP, "\n" "\n" - "To change the settings, press `R`.\n" - "Certain options are only adjustable\n" + "To change the settings, press 'R'.\n\n" + "Note: Certain settings are only adjustable\n" "directly in the 'menu/config.ini' file.\n\n" "pal60_enabled: %s\n" "show_protected_entries: %s\n" @@ -117,17 +148,20 @@ static void draw (menu_t *menu, surface_t *d) { format_switch(menu->settings.rumble_enabled) ); + component_actions_bar_text_draw( ALIGN_LEFT, VALIGN_TOP, - "\n" + "A: Change\n" "B: Back" ); - component_actions_bar_text_draw( - ALIGN_RIGHT, VALIGN_TOP, - "\n" - "R: Options" - ); + if (settings_changed) { + component_actions_bar_text_draw( + ALIGN_RIGHT, VALIGN_TOP, + "\n" + "R: Save" + ); + } component_context_menu_draw(&options_context_menu); From 02ef3815150ee458b632e44730031c4dd38fca9b Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 3 Jul 2024 18:21:39 +0100 Subject: [PATCH 04/16] Improve setting menu text --- src/menu/views/settings_editor.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 5f2f3acb9..eb58dd3fd 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -127,18 +127,20 @@ static void draw (menu_t *menu, surface_t *d) { component_main_text_draw( ALIGN_LEFT, VALIGN_TOP, - "\n" - "\n" - "To change the settings, press 'R'.\n\n" - "Note: Certain settings are only adjustable\n" - "directly in the 'menu/config.ini' file.\n\n" + "\n\n" + "To change the settings, press 'A'.\n\n" "pal60_enabled: %s\n" "show_protected_entries: %s\n" - "default_directory: %s\n" + "default_directory*: %s\n" "use_saves_folder: %s\n" "bgm_enabled: %s\n" - "sound_enabled: %s\n" - "rumble_enabled: %s\n", + "sound_enabled**: %s\n" + "rumble_enabled: %s\n\n" + "Note: Certain settings are only adjustable\n" + "directly in the 'menu/config.ini' file.\n\n" + "* Set using other menu.\n" + "** Currently requires a flashcart reboot.\n\n" + "To write the settings permanently, press 'R`.\n", format_switch(menu->settings.pal60_enabled), format_switch(menu->settings.show_protected_entries), menu->settings.default_directory, From beb78a970431b7e2a3677461a1ee151e155f6c72 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 3 Jul 2024 18:30:43 +0100 Subject: [PATCH 05/16] Add missing sfx --- src/menu/views/settings_editor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index eb58dd3fd..688bb0bc2 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -108,6 +108,7 @@ static void process (menu_t *menu) { if (settings_changed) { settings_save(&menu->settings); settings_changed = false; + sound_play_effect(SFX_ENTER); } } } From 1ee93e84b6f3240e39fa586ce2616a3fbf5d70ff Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 3 Jul 2024 19:07:17 +0100 Subject: [PATCH 06/16] Review improvements --- src/menu/views/settings_editor.c | 46 +++++--------------------------- 1 file changed, 6 insertions(+), 40 deletions(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 688bb0bc2..43dcfbca0 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -3,7 +3,6 @@ #include "../settings.h" #include "views.h" -static bool settings_changed = false; static const char *format_switch (bool state) { switch (state) { @@ -13,43 +12,25 @@ static const char *format_switch (bool state) { } static void set_pal60_type (menu_t *menu, void *arg) { - bool initial_setting_val = menu->settings.pal60_enabled; menu->settings.pal60_enabled = (bool) (arg); - if (initial_setting_val != menu->settings.pal60_enabled) { - settings_changed = true; - } - - menu->browser.reload = true; + settings_save(&menu->settings); } static void set_protected_entries_type (menu_t *menu, void *arg) { - bool initial_setting_val = menu->settings.show_protected_entries; menu->settings.show_protected_entries = (bool) (arg); - if (initial_setting_val != menu->settings.show_protected_entries) { - settings_changed = true; - } + settings_save(&menu->settings); menu->browser.reload = true; } static void set_sound_enabled_type (menu_t *menu, void *arg) { - bool initial_setting_val = menu->settings.sound_enabled; menu->settings.sound_enabled = (bool) (arg); - if (initial_setting_val != menu->settings.sound_enabled) { - settings_changed = true; - } - - menu->browser.reload = true; + settings_save(&menu->settings); } static void set_use_saves_folder_type (menu_t *menu, void *arg) { - bool initial_setting_val = menu->settings.use_saves_folder; menu->settings.use_saves_folder = (bool) (arg); - if (initial_setting_val != menu->settings.use_saves_folder) { - settings_changed = true; - } - - menu->browser.reload = true; + settings_save(&menu->settings); } // static void set_use_default_settings (menu_t *menu, void *arg) { @@ -57,6 +38,7 @@ static void set_use_saves_folder_type (menu_t *menu, void *arg) { // menu->browser.reload = true; // } + static component_context_menu_t set_pal60_type_context_menu = { .list = { {.text = "On", .action = set_pal60_type, .arg = (void *) (true) }, {.text = "Off", .action = set_pal60_type, .arg = (void *) (false) }, @@ -101,15 +83,8 @@ static void process (menu_t *menu) { component_context_menu_show(&options_context_menu); sound_play_effect(SFX_SETTING); } else if (menu->actions.back) { - // FIXME: should we allow preview in the menu, or forget them? menu->next_mode = MENU_MODE_BROWSER; sound_play_effect(SFX_EXIT); - } else if (menu->actions.options) { - if (settings_changed) { - settings_save(&menu->settings); - settings_changed = false; - sound_play_effect(SFX_ENTER); - } } } @@ -140,8 +115,7 @@ static void draw (menu_t *menu, surface_t *d) { "Note: Certain settings are only adjustable\n" "directly in the 'menu/config.ini' file.\n\n" "* Set using other menu.\n" - "** Currently requires a flashcart reboot.\n\n" - "To write the settings permanently, press 'R`.\n", + "** Currently requires a flashcart reboot.\n", format_switch(menu->settings.pal60_enabled), format_switch(menu->settings.show_protected_entries), menu->settings.default_directory, @@ -158,14 +132,6 @@ static void draw (menu_t *menu, surface_t *d) { "B: Back" ); - if (settings_changed) { - component_actions_bar_text_draw( - ALIGN_RIGHT, VALIGN_TOP, - "\n" - "R: Save" - ); - } - component_context_menu_draw(&options_context_menu); rdpq_detach_show(); From 249cab94dd5524ce21f6ab85e8d1f2f7b86bef3c Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 3 Jul 2024 19:12:11 +0100 Subject: [PATCH 07/16] Text improvement --- src/menu/views/settings_editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 43dcfbca0..e146871ad 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -114,7 +114,7 @@ static void draw (menu_t *menu, surface_t *d) { "rumble_enabled: %s\n\n" "Note: Certain settings are only adjustable\n" "directly in the 'menu/config.ini' file.\n\n" - "* Set using other menu.\n" + "* Set using browser submenu.\n" "** Currently requires a flashcart reboot.\n", format_switch(menu->settings.pal60_enabled), format_switch(menu->settings.show_protected_entries), From a249e698f61e7d72cccc868dbd50cee13d1e8abe Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 3 Jul 2024 20:08:20 +0100 Subject: [PATCH 08/16] Add all settings Beta features will not save, but that is ok (note added). Improve text. --- src/menu/views/settings_editor.c | 57 +++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index e146871ad..8cb4b4b61 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -23,13 +23,23 @@ static void set_protected_entries_type (menu_t *menu, void *arg) { menu->browser.reload = true; } +static void set_use_saves_folder_type (menu_t *menu, void *arg) { + menu->settings.use_saves_folder = (bool) (arg); + settings_save(&menu->settings); +} + +static void set_bgm_enabled_type (menu_t *menu, void *arg) { + menu->settings.bgm_enabled = (bool) (arg); + settings_save(&menu->settings); +} + static void set_sound_enabled_type (menu_t *menu, void *arg) { menu->settings.sound_enabled = (bool) (arg); settings_save(&menu->settings); } -static void set_use_saves_folder_type (menu_t *menu, void *arg) { - menu->settings.use_saves_folder = (bool) (arg); +static void set_rumble_enabled_type (menu_t *menu, void *arg) { + menu->settings.rumble_enabled = (bool) (arg); settings_save(&menu->settings); } @@ -63,12 +73,26 @@ static component_context_menu_t set_use_saves_folder_type_context_menu = { .list COMPONENT_CONTEXT_MENU_LIST_END, }}; +static component_context_menu_t set_bgm_enabled_type_context_menu = { .list = { + {.text = "On", .action = set_bgm_enabled_type, .arg = (void *) (true) }, + {.text = "Off", .action = set_bgm_enabled_type, .arg = (void *) (false) }, + COMPONENT_CONTEXT_MENU_LIST_END, +}}; + +static component_context_menu_t set_rumble_enabled_type_context_menu = { .list = { + {.text = "On", .action = set_rumble_enabled_type, .arg = (void *) (true) }, + {.text = "Off", .action = set_rumble_enabled_type, .arg = (void *) (false) }, + COMPONENT_CONTEXT_MENU_LIST_END, +}}; + static component_context_menu_t options_context_menu = { .list = { - { .text = "Set PAL60 Mode", .submenu = &set_pal60_type_context_menu }, + { .text = "PAL60 Mode", .submenu = &set_pal60_type_context_menu }, { .text = "Show Hidden Files", .submenu = &set_protected_entries_type_context_menu }, - { .text = "Set Menu Sound", .submenu = &set_sound_enabled_type_context_menu }, - { .text = "Use saves folder", .submenu = &set_use_saves_folder_type_context_menu }, - // { .text = "Restore defaults", .action = set_use_default_settings }, + { .text = "Sound Effects", .submenu = &set_sound_enabled_type_context_menu }, + { .text = "Background Music", .submenu = &set_bgm_enabled_type_context_menu }, + { .text = "Rumble Feedback", .submenu = &set_rumble_enabled_type_context_menu }, + { .text = "Use Saves Folder", .submenu = &set_use_saves_folder_type_context_menu }, + // { .text = "Restore Defaults", .action = set_use_default_settings }, COMPONENT_CONTEXT_MENU_LIST_END, }}; @@ -97,25 +121,26 @@ static void draw (menu_t *menu, surface_t *d) { component_main_text_draw( ALIGN_CENTER, VALIGN_TOP, - "SETTINGS EDITOR\n" + "MENU SETTINGS EDITOR\n" "\n" ); component_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n\n" - "To change the settings, press 'A'.\n\n" - "pal60_enabled: %s\n" - "show_protected_entries: %s\n" - "default_directory*: %s\n" - "use_saves_folder: %s\n" - "bgm_enabled: %s\n" - "sound_enabled**: %s\n" - "rumble_enabled: %s\n\n" + "To change the menu settings, press 'A'.\n\n" + "PAL60 Mode: %s\n" + "Show Hidden Files: %s\n" + "Default Menu Directory*: %s\n" + "Use Saves folder: %s\n" + "Background Music***: %s\n" + "Menu Sound Effects**: %s\n" + "Rumble Feedback***: %s\n\n" "Note: Certain settings are only adjustable\n" "directly in the 'menu/config.ini' file.\n\n" "* Set using browser submenu.\n" - "** Currently requires a flashcart reboot.\n", + "** Currently requires a flashcart reboot.\n" + "*** Not currently supported.\n", format_switch(menu->settings.pal60_enabled), format_switch(menu->settings.show_protected_entries), menu->settings.default_directory, From b33f70b16cd8c77acf086e5c93f0b72ba2bde555 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 3 Jul 2024 20:19:20 +0100 Subject: [PATCH 09/16] Fix text alignment --- src/menu/views/settings_editor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 8cb4b4b61..e84989271 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -138,8 +138,8 @@ static void draw (menu_t *menu, surface_t *d) { "Rumble Feedback***: %s\n\n" "Note: Certain settings are only adjustable\n" "directly in the 'menu/config.ini' file.\n\n" - "* Set using browser submenu.\n" - "** Currently requires a flashcart reboot.\n" + "* Set using browser submenu.\n" + "** Currently requires a flashcart reboot.\n" "*** Not currently supported.\n", format_switch(menu->settings.pal60_enabled), format_switch(menu->settings.show_protected_entries), From 5ac1c172a2b91e9d184ffcfea7e2c354c767d266 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 3 Jul 2024 20:32:33 +0100 Subject: [PATCH 10/16] Improve settings menu text layout --- src/menu/views/settings_editor.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index e84989271..9bd1957cd 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -129,24 +129,24 @@ static void draw (menu_t *menu, surface_t *d) { ALIGN_LEFT, VALIGN_TOP, "\n\n" "To change the menu settings, press 'A'.\n\n" - "PAL60 Mode: %s\n" - "Show Hidden Files: %s\n" - "Default Menu Directory*: %s\n" - "Use Saves folder: %s\n" - "Background Music***: %s\n" - "Menu Sound Effects**: %s\n" - "Rumble Feedback***: %s\n\n" + "* Default Menu Directory: %s\n" + " PAL60 Mode: %s\n" + " Show Hidden Files: %s\n" + " Use Saves folder: %s\n" + "** Menu Sound Effects: %s\n" + "*** Background Music: %s\n" + "*** Rumble Feedback: %s\n\n" "Note: Certain settings are only adjustable\n" "directly in the 'menu/config.ini' file.\n\n" "* Set using browser submenu.\n" "** Currently requires a flashcart reboot.\n" "*** Not currently supported.\n", + menu->settings.default_directory, format_switch(menu->settings.pal60_enabled), format_switch(menu->settings.show_protected_entries), - menu->settings.default_directory, format_switch(menu->settings.use_saves_folder), - format_switch(menu->settings.bgm_enabled), format_switch(menu->settings.sound_enabled), + format_switch(menu->settings.bgm_enabled), format_switch(menu->settings.rumble_enabled) ); From ac0e6343f99a389e0b584d10cac7309d843db107 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 3 Jul 2024 20:48:22 +0100 Subject: [PATCH 11/16] Last improvement to text --- src/menu/views/settings_editor.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 9bd1957cd..38410ca1b 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -135,9 +135,8 @@ static void draw (menu_t *menu, surface_t *d) { " Use Saves folder: %s\n" "** Menu Sound Effects: %s\n" "*** Background Music: %s\n" - "*** Rumble Feedback: %s\n\n" - "Note: Certain settings are only adjustable\n" - "directly in the 'menu/config.ini' file.\n\n" + "*** Rumble Feedback: %s\n\n\n" + "Note: Certain settings have the following caveats:\n\n" "* Set using browser submenu.\n" "** Currently requires a flashcart reboot.\n" "*** Not currently supported.\n", From 166855b4b967b54f3fc7b2e0f8460d594a33dd45 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 3 Jul 2024 20:55:48 +0100 Subject: [PATCH 12/16] Further improve text --- src/menu/views/settings_editor.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index 38410ca1b..b98681b2b 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -129,17 +129,17 @@ static void draw (menu_t *menu, surface_t *d) { ALIGN_LEFT, VALIGN_TOP, "\n\n" "To change the menu settings, press 'A'.\n\n" - "* Default Menu Directory: %s\n" - " PAL60 Mode: %s\n" - " Show Hidden Files: %s\n" - " Use Saves folder: %s\n" - "** Menu Sound Effects: %s\n" - "*** Background Music: %s\n" - "*** Rumble Feedback: %s\n\n\n" + "* Default Directory : %s\n" + " PAL60 Mode : %s\n" + " Show Hidden Files : %s\n" + " Use Saves folder : %s\n" + "** Sound Effects : %s\n" + "*** Background Music : %s\n" + "*** Rumble Feedback : %s\n\n\n" "Note: Certain settings have the following caveats:\n\n" - "* Set using browser submenu.\n" - "** Currently requires a flashcart reboot.\n" - "*** Not currently supported.\n", + "* Settable from file browser options.\n" + "** Requires a flashcart reboot.\n" + "*** Not currently supported.\n", menu->settings.default_directory, format_switch(menu->settings.pal60_enabled), format_switch(menu->settings.show_protected_entries), From 0709c1fdc500203907e1aec67dba405215ceb4e1 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 3 Jul 2024 23:10:06 +0100 Subject: [PATCH 13/16] Use ifdef for beta settings --- src/menu/views/settings_editor.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index b98681b2b..b7324b667 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -28,13 +28,14 @@ static void set_use_saves_folder_type (menu_t *menu, void *arg) { settings_save(&menu->settings); } -static void set_bgm_enabled_type (menu_t *menu, void *arg) { - menu->settings.bgm_enabled = (bool) (arg); +static void set_sound_enabled_type (menu_t *menu, void *arg) { + menu->settings.sound_enabled = (bool) (arg); settings_save(&menu->settings); } -static void set_sound_enabled_type (menu_t *menu, void *arg) { - menu->settings.sound_enabled = (bool) (arg); +#ifdef BETA_SETTINGS +static void set_bgm_enabled_type (menu_t *menu, void *arg) { + menu->settings.bgm_enabled = (bool) (arg); settings_save(&menu->settings); } @@ -47,6 +48,7 @@ static void set_rumble_enabled_type (menu_t *menu, void *arg) { // // FIXME: add implementation // menu->browser.reload = true; // } +#endif static component_context_menu_t set_pal60_type_context_menu = { .list = { @@ -73,6 +75,7 @@ static component_context_menu_t set_use_saves_folder_type_context_menu = { .list COMPONENT_CONTEXT_MENU_LIST_END, }}; +#ifdef BETA_SETTINGS static component_context_menu_t set_bgm_enabled_type_context_menu = { .list = { {.text = "On", .action = set_bgm_enabled_type, .arg = (void *) (true) }, {.text = "Off", .action = set_bgm_enabled_type, .arg = (void *) (false) }, @@ -84,15 +87,18 @@ static component_context_menu_t set_rumble_enabled_type_context_menu = { .list = {.text = "Off", .action = set_rumble_enabled_type, .arg = (void *) (false) }, COMPONENT_CONTEXT_MENU_LIST_END, }}; +#endif static component_context_menu_t options_context_menu = { .list = { { .text = "PAL60 Mode", .submenu = &set_pal60_type_context_menu }, { .text = "Show Hidden Files", .submenu = &set_protected_entries_type_context_menu }, { .text = "Sound Effects", .submenu = &set_sound_enabled_type_context_menu }, + { .text = "Use Saves Folder", .submenu = &set_use_saves_folder_type_context_menu }, +#ifdef BETA_SETTINGS { .text = "Background Music", .submenu = &set_bgm_enabled_type_context_menu }, { .text = "Rumble Feedback", .submenu = &set_rumble_enabled_type_context_menu }, - { .text = "Use Saves Folder", .submenu = &set_use_saves_folder_type_context_menu }, // { .text = "Restore Defaults", .action = set_use_default_settings }, +#endif COMPONENT_CONTEXT_MENU_LIST_END, }}; @@ -134,19 +140,23 @@ static void draw (menu_t *menu, surface_t *d) { " Show Hidden Files : %s\n" " Use Saves folder : %s\n" "** Sound Effects : %s\n" - "*** Background Music : %s\n" - "*** Rumble Feedback : %s\n\n\n" +#ifdef BETA_SETTINGS + " Background Music : %s\n" + " Rumble Feedback : %s\n\n\n" +#endif "Note: Certain settings have the following caveats:\n\n" "* Settable from file browser options.\n" - "** Requires a flashcart reboot.\n" - "*** Not currently supported.\n", + "** Requires a flashcart reboot.\n", menu->settings.default_directory, format_switch(menu->settings.pal60_enabled), format_switch(menu->settings.show_protected_entries), format_switch(menu->settings.use_saves_folder), - format_switch(menu->settings.sound_enabled), + format_switch(menu->settings.sound_enabled) +#ifdef BETA_SETTINGS + , format_switch(menu->settings.bgm_enabled), format_switch(menu->settings.rumble_enabled) +#endif ); From 0fbdee198cc454fdadbdaa3cfd0161fa3a6fdacd Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Wed, 3 Jul 2024 23:27:09 +0100 Subject: [PATCH 14/16] Fix line spacing --- src/menu/views/settings_editor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index b7324b667..e0dbcd677 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -142,8 +142,9 @@ static void draw (menu_t *menu, surface_t *d) { "** Sound Effects : %s\n" #ifdef BETA_SETTINGS " Background Music : %s\n" - " Rumble Feedback : %s\n\n\n" + " Rumble Feedback : %s\n" #endif + "\n\n" "Note: Certain settings have the following caveats:\n\n" "* Settable from file browser options.\n" "** Requires a flashcart reboot.\n", From 1574a22bdb765ea02cf0bc9334afacc5d1d85586 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Fri, 5 Jul 2024 23:00:46 +0100 Subject: [PATCH 15/16] Improve expectations --- src/menu/views/settings_editor.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/menu/views/settings_editor.c b/src/menu/views/settings_editor.c index e0dbcd677..4dc2539c3 100644 --- a/src/menu/views/settings_editor.c +++ b/src/menu/views/settings_editor.c @@ -134,20 +134,19 @@ static void draw (menu_t *menu, surface_t *d) { component_main_text_draw( ALIGN_LEFT, VALIGN_TOP, "\n\n" + " Default Directory : %s\n\n" "To change the menu settings, press 'A'.\n\n" - "* Default Directory : %s\n" " PAL60 Mode : %s\n" " Show Hidden Files : %s\n" " Use Saves folder : %s\n" - "** Sound Effects : %s\n" + "* Sound Effects : %s\n" #ifdef BETA_SETTINGS " Background Music : %s\n" " Rumble Feedback : %s\n" #endif "\n\n" "Note: Certain settings have the following caveats:\n\n" - "* Settable from file browser options.\n" - "** Requires a flashcart reboot.\n", + "* Requires a flashcart reboot.\n", menu->settings.default_directory, format_switch(menu->settings.pal60_enabled), format_switch(menu->settings.show_protected_entries), From b1a7d5b58c28f729ebd431f943a2e8a5805ae839 Mon Sep 17 00:00:00 2001 From: Robin Jones Date: Sun, 7 Jul 2024 18:23:41 +0100 Subject: [PATCH 16/16] Update libdragon --- libdragon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdragon b/libdragon index 536df10ad..4d4449aac 160000 --- a/libdragon +++ b/libdragon @@ -1 +1 @@ -Subproject commit 536df10ad65614f519bea40482b6e2657b9c4c84 +Subproject commit 4d4449aac2af2ba8306cd4e61974ac682f1ea400