Skip to content

Commit

Permalink
rg_gui: Moved emulator options to a sub menu
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ducalex committed Dec 17, 2024
1 parent 157ae61 commit 98b6ac4
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 28 deletions.
22 changes: 18 additions & 4 deletions components/retro-go/rg_gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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[] = {
Expand All @@ -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,
};

Expand All @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions components/retro-go/translations.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
37 changes: 13 additions & 24 deletions launcher/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 98b6ac4

Please sign in to comment.