From 98b6ac49734fd6bcc919d4ac9c0b1e163046278e Mon Sep 17 00:00:00 2001 From: Alex Duchesne Date: Tue, 17 Dec 2024 16:27:57 -0500 Subject: [PATCH] rg_gui: Moved emulator options to a sub menu It is now an extra step to access these options but they aren't frequently needed and I think the improved consistency is more important. --- components/retro-go/rg_gui.c | 22 ++++++++++++++---- components/retro-go/translations.h | 4 ++++ launcher/main/main.c | 37 +++++++++++------------------- 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/components/retro-go/rg_gui.c b/components/retro-go/rg_gui.c index 474f2d1d..d888a6a6 100644 --- a/components/retro-go/rg_gui.c +++ b/components/retro-go/rg_gui.c @@ -1544,9 +1544,24 @@ static rg_gui_event_t wifi_cb(rg_gui_option_t *option, rg_gui_event_t event) } #endif +static rg_gui_event_t app_options_cb(rg_gui_option_t *option, rg_gui_event_t event) +{ + if (event == RG_DIALOG_ENTER) + { + const rg_app_t *app = rg_system_get_app(); + rg_gui_option_t options[16] = {0}; + if (app->handlers.options) + app->handlers.options(options); + rg_display_force_redraw(); + rg_gui_dialog(option->label, options, 0); + return RG_DIALOG_REDRAW; + } + return RG_DIALOG_VOID; +} + void rg_gui_options_menu(void) { - rg_gui_option_t options[24] = { + rg_gui_option_t options[16] = { #if RG_SCREEN_BACKLIGHT {0, _("Brightness"), "-", RG_DIALOG_FLAG_NORMAL, &brightness_update_cb}, #endif @@ -1566,6 +1581,7 @@ void rg_gui_options_menu(void) #ifdef RG_ENABLE_NETWORKING {0, _("Wi-Fi options"), NULL, RG_DIALOG_FLAG_NORMAL, &wifi_cb}, #endif + {0, _("Launcher options"), NULL, RG_DIALOG_FLAG_NORMAL, &app_options_cb}, RG_DIALOG_END, }; const rg_gui_option_t game_options[] = { @@ -1575,6 +1591,7 @@ void rg_gui_options_menu(void) {0, _("Border"), "-", RG_DIALOG_FLAG_NORMAL, &border_update_cb}, {0, _("Speed"), "-", RG_DIALOG_FLAG_NORMAL, &speedup_update_cb}, // {0, _("Misc options"), NULL, RG_DIALOG_FLAG_NORMAL, &misc_options_cb}, + {0, _("Emulator options"), NULL, RG_DIALOG_FLAG_NORMAL, &app_options_cb}, RG_DIALOG_END, }; @@ -1584,9 +1601,6 @@ void rg_gui_options_menu(void) else memcpy(options + get_dialog_items_count(options), game_options, sizeof(game_options)); - if (app->handlers.options) - app->handlers.options(options + get_dialog_items_count(options)); - rg_audio_set_mute(true); rg_gui_dialog(_("Options"), options, 0); diff --git a/components/retro-go/translations.h b/components/retro-go/translations.h index c71e5a37..19be8977 100644 --- a/components/retro-go/translations.h +++ b/components/retro-go/translations.h @@ -170,6 +170,10 @@ static const char *translations[][RG_LANG_MAX] = [RG_LANG_EN] = "Launcher options", [RG_LANG_FR] = "Options du lanceur" }, + { + [RG_LANG_EN] = "Emulator options", + [RG_LANG_FR] = "Options emulateur" + }, { [RG_LANG_EN] = "Date", [RG_LANG_FR] = "Date" diff --git a/launcher/main/main.c b/launcher/main/main.c index 0f9c5e3b..439c868b 100644 --- a/launcher/main/main.c +++ b/launcher/main/main.c @@ -175,28 +175,6 @@ static rg_gui_event_t webui_switch_cb(rg_gui_option_t *option, rg_gui_event_t ev } #endif -static rg_gui_event_t launcher_options_cb(rg_gui_option_t *option, rg_gui_event_t event) -{ - if (event == RG_DIALOG_ENTER) - { - const rg_gui_option_t options[] = { - {0, _("Color theme"), "-", RG_DIALOG_FLAG_NORMAL, &color_theme_cb}, - {0, _("Preview"), "-", RG_DIALOG_FLAG_NORMAL, &show_preview_cb}, - {0, _("Scroll mode"), "-", RG_DIALOG_FLAG_NORMAL, &scroll_mode_cb}, - {0, _("Start screen"), "-", RG_DIALOG_FLAG_NORMAL, &start_screen_cb}, - {0, _("Hide tabs"), "-", RG_DIALOG_FLAG_NORMAL, &toggle_tabs_cb}, - #ifdef RG_ENABLE_NETWORKING - {0, _("File server"), "-", RG_DIALOG_FLAG_NORMAL, &webui_switch_cb}, - #endif - {0, _("Startup app"), "-", RG_DIALOG_FLAG_NORMAL, &startup_app_cb}, - RG_DIALOG_END, - }; - gui_redraw(); // clear main menu - rg_gui_dialog(option->label, options, 0); - } - return RG_DIALOG_VOID; -} - static rg_gui_event_t prebuild_cache_cb(rg_gui_option_t *option, rg_gui_event_t event) { if (event == RG_DIALOG_ENTER) @@ -430,8 +408,19 @@ void event_handler(int event, void *arg) static void options_handler(rg_gui_option_t *dest) { - *dest++ = (rg_gui_option_t){0, _("Launcher options"), NULL, RG_DIALOG_FLAG_NORMAL, &launcher_options_cb}; - *dest++ = (rg_gui_option_t)RG_DIALOG_END; + const rg_gui_option_t options[] = { + {0, _("Color theme"), "-", RG_DIALOG_FLAG_NORMAL, &color_theme_cb}, + {0, _("Preview"), "-", RG_DIALOG_FLAG_NORMAL, &show_preview_cb}, + {0, _("Scroll mode"), "-", RG_DIALOG_FLAG_NORMAL, &scroll_mode_cb}, + {0, _("Start screen"), "-", RG_DIALOG_FLAG_NORMAL, &start_screen_cb}, + {0, _("Hide tabs"), "-", RG_DIALOG_FLAG_NORMAL, &toggle_tabs_cb}, + #ifdef RG_ENABLE_NETWORKING + {0, _("File server"), "-", RG_DIALOG_FLAG_NORMAL, &webui_switch_cb}, + #endif + {0, _("Startup app"), "-", RG_DIALOG_FLAG_NORMAL, &startup_app_cb}, + RG_DIALOG_END, + }; + memcpy(dest, options, sizeof(options)); } static void about_handler(rg_gui_option_t *dest)