Skip to content

Commit 79dbd3f

Browse files
authored
Add option for returning to Main Menu from tabs (#18184)
1 parent c317273 commit 79dbd3f

File tree

12 files changed

+65
-15
lines changed

12 files changed

+65
-15
lines changed

config.def.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,7 @@
967967

968968
#define DEFAULT_MENU_SWAP_OK_CANCEL_BUTTONS true
969969
#define DEFAULT_MENU_SWAP_SCROLL_BUTTONS false
970+
#define DEFAULT_MENU_ALLOW_TABS_BACK true
970971

971972
#if defined(WIIU)
972973
#define DEFAULT_ALL_USERS_CONTROL_MENU true

configuration.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2176,10 +2176,11 @@ static struct config_bool_setting *populate_settings_bool(
21762176
SETTING_BOOL("input_remap_binds_enable", &settings->bools.input_remap_binds_enable, true, true, false);
21772177
SETTING_BOOL("input_remap_sort_by_controller_enable", &settings->bools.input_remap_sort_by_controller_enable, true, false, false);
21782178
SETTING_BOOL("input_hotkey_device_merge", &settings->bools.input_hotkey_device_merge, true, DEFAULT_INPUT_HOTKEY_DEVICE_MERGE, false);
2179-
SETTING_BOOL("all_users_control_menu", &settings->bools.input_all_users_control_menu, true, DEFAULT_ALL_USERS_CONTROL_MENU, false);
21802179
#ifdef HAVE_MENU
2180+
SETTING_BOOL("all_users_control_menu", &settings->bools.input_all_users_control_menu, true, DEFAULT_ALL_USERS_CONTROL_MENU, false);
21812181
SETTING_BOOL("menu_swap_ok_cancel_buttons", &settings->bools.input_menu_swap_ok_cancel_buttons, true, DEFAULT_MENU_SWAP_OK_CANCEL_BUTTONS, false);
21822182
SETTING_BOOL("menu_swap_scroll_buttons", &settings->bools.input_menu_swap_scroll_buttons, true, DEFAULT_MENU_SWAP_SCROLL_BUTTONS, false);
2183+
SETTING_BOOL("menu_allow_tabs_back", &settings->bools.input_menu_allow_tabs_back, true, DEFAULT_MENU_ALLOW_TABS_BACK, false);
21832184
#endif
21842185
#if defined(HAVE_DINPUT) || defined(HAVE_WINRAWINPUT)
21852186
SETTING_BOOL("input_nowinkey_enable", &settings->bools.input_nowinkey_enable, true, false, false);

configuration.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,7 @@ typedef struct settings
719719
bool input_descriptor_label_show;
720720
bool input_descriptor_hide_unbound;
721721
bool input_all_users_control_menu;
722+
bool input_menu_allow_tabs_back;
722723
bool input_menu_swap_ok_cancel_buttons;
723724
bool input_menu_swap_scroll_buttons;
724725
bool input_backtouch_enable;

intl/msg_hash_lbl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,6 +1834,10 @@ MSG_HASH(
18341834
MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU,
18351835
"all_users_control_menu"
18361836
)
1837+
MSG_HASH(
1838+
MENU_ENUM_LABEL_MENU_ALLOW_TABS_BACK,
1839+
"menu_allow_tabs_back"
1840+
)
18371841
MSG_HASH(
18381842
MENU_ENUM_LABEL_MENU_INPUT_SWAP_OK_CANCEL,
18391843
"menu_swap_ok_cancel"

intl/msg_hash_us.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3728,6 +3728,14 @@ MSG_HASH(
37283728
MENU_ENUM_SUBLABEL_INPUT_ALL_USERS_CONTROL_MENU,
37293729
"Allow any user to control the menu. If disabled, only User 1 can control the menu."
37303730
)
3731+
MSG_HASH(
3732+
MENU_ENUM_LABEL_VALUE_MENU_ALLOW_TABS_BACK,
3733+
"Allow Back From Tabs"
3734+
)
3735+
MSG_HASH(
3736+
MENU_ENUM_SUBLABEL_MENU_ALLOW_TABS_BACK,
3737+
"Return to Main Menu from tabs/sidebar when pressing Back."
3738+
)
37313739

37323740
/* Settings > Input > Hotkeys */
37333741

menu/cbs/menu_cbs_sublabel.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,6 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_camera_allow, MENU_
550550
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_location_allow, MENU_ENUM_SUBLABEL_LOCATION_ALLOW)
551551
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_max_users, MENU_ENUM_SUBLABEL_INPUT_MAX_USERS)
552552
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_poll_type_behavior, MENU_ENUM_SUBLABEL_INPUT_POLL_TYPE_BEHAVIOR)
553-
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_all_users_control_menu, MENU_ENUM_SUBLABEL_INPUT_ALL_USERS_CONTROL_MENU)
554553
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_bind_timeout, MENU_ENUM_SUBLABEL_INPUT_BIND_TIMEOUT)
555554
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_bind_hold, MENU_ENUM_SUBLABEL_INPUT_BIND_HOLD)
556555
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_audio_volume, MENU_ENUM_SUBLABEL_AUDIO_VOLUME)
@@ -830,6 +829,8 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_auto_mouse_grab, MENU_
830829
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_auto_game_focus, MENU_ENUM_SUBLABEL_INPUT_AUTO_GAME_FOCUS)
831830
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_swap_ok_cancel, MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_OK_CANCEL)
832831
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_swap_scroll, MENU_ENUM_SUBLABEL_MENU_INPUT_SWAP_SCROLL)
832+
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_all_users_control_menu, MENU_ENUM_SUBLABEL_INPUT_ALL_USERS_CONTROL_MENU)
833+
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_allow_tabs_back, MENU_ENUM_SUBLABEL_MENU_ALLOW_TABS_BACK)
833834
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_pause_libretro, MENU_ENUM_SUBLABEL_PAUSE_LIBRETRO)
834835
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_savestate_resume, MENU_ENUM_SUBLABEL_MENU_SAVESTATE_RESUME)
835836
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_menu_insert_disk_resume, MENU_ENUM_SUBLABEL_MENU_INSERT_DISK_RESUME)
@@ -4077,6 +4078,12 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
40774078
case MENU_ENUM_LABEL_MENU_INPUT_SWAP_SCROLL:
40784079
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_swap_scroll);
40794080
break;
4081+
case MENU_ENUM_LABEL_MENU_ALLOW_TABS_BACK:
4082+
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_allow_tabs_back);
4083+
break;
4084+
case MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU:
4085+
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_all_users_control_menu);
4086+
break;
40804087
case MENU_ENUM_LABEL_INPUT_AUTODETECT_ENABLE:
40814088
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_autodetect_enable);
40824089
break;
@@ -4758,9 +4765,6 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
47584765
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_audio_mixer_volume);
47594766
#endif
47604767
break;
4761-
case MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU:
4762-
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_all_users_control_menu);
4763-
break;
47644768
case MENU_ENUM_LABEL_INPUT_POLL_TYPE_BEHAVIOR:
47654769
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_poll_type_behavior);
47664770
break;

menu/drivers/materialui.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10430,8 +10430,9 @@ static enum menu_action materialui_parse_menu_entry_action(
1043010430
}
1043110431

1043210432
/* If current tab is not main, switch to main */
10433-
if (main_menu_tab &&
10434-
(main_menu_tab_index != mui->nav_bar.active_menu_tab_index))
10433+
if ( main_menu_tab
10434+
&& main_menu_tab_index != mui->nav_bar.active_menu_tab_index
10435+
&& config_get_ptr()->bools.input_menu_allow_tabs_back)
1043510436
{
1043610437
materialui_switch_tabs(mui, main_menu_tab, MENU_ACTION_NOOP);
1043710438
new_action = MENU_ACTION_NOOP;

menu/drivers/ozone.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8698,7 +8698,8 @@ static enum menu_action ozone_parse_menu_entry_action(
86988698
if (ozone->flags & OZONE_FLAG_CURSOR_IN_SIDEBAR)
86998699
{
87008700
/* Go back to main menu tab */
8701-
if (ozone->categories_selection_ptr != 0)
8701+
if ( ozone->categories_selection_ptr != 0
8702+
&& settings->bools.input_menu_allow_tabs_back)
87028703
{
87038704
ozone_sidebar_goto(ozone, 0);
87048705
#ifdef HAVE_AUDIOMIXER

menu/drivers/xmb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5847,7 +5847,7 @@ static enum menu_action xmb_parse_menu_entry_action(
58475847
menu_st->selection_ptr = 0;
58485848
xmb_selection_pointer_changed(xmb, true);
58495849
}
5850-
else
5850+
else if (config_get_ptr()->bools.input_menu_allow_tabs_back)
58515851
{
58525852
/* Jump to Main Menu */
58535853
size_t i = 0;

menu/menu_displaylist.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8167,11 +8167,13 @@ unsigned menu_displaylist_build_list(
81678167
}
81688168
case DISPLAYLIST_INPUT_MENU_SETTINGS_LIST:
81698169
{
8170+
const char *menu_driver = menu_driver_ident();
81708171
menu_displaylist_build_info_selective_t build_list[] = {
81718172
{MENU_ENUM_LABEL_INPUT_UNIFIED_MENU_CONTROLS, PARSE_ONLY_BOOL, true},
81728173
{MENU_ENUM_LABEL_MENU_INPUT_SWAP_OK_CANCEL, PARSE_ONLY_BOOL, true},
81738174
{MENU_ENUM_LABEL_MENU_INPUT_SWAP_SCROLL, PARSE_ONLY_BOOL, true},
81748175
{MENU_ENUM_LABEL_INPUT_ALL_USERS_CONTROL_MENU, PARSE_ONLY_BOOL, true},
8176+
{MENU_ENUM_LABEL_MENU_ALLOW_TABS_BACK, PARSE_ONLY_BOOL, true},
81758177
{MENU_ENUM_LABEL_MENU_SCROLL_FAST, PARSE_ONLY_BOOL, true},
81768178
{MENU_ENUM_LABEL_MENU_SCROLL_DELAY, PARSE_ONLY_UINT, true},
81778179
{MENU_ENUM_LABEL_INPUT_DISABLE_INFO_BUTTON, PARSE_ONLY_BOOL, true},
@@ -8180,6 +8182,19 @@ unsigned menu_displaylist_build_list(
81808182
{MENU_ENUM_LABEL_INPUT_DISABLE_RIGHT_ANALOG_IN_MENU, PARSE_ONLY_BOOL, true},
81818183
};
81828184

8185+
for (i = 0; i < ARRAY_SIZE(build_list); i++)
8186+
{
8187+
switch (build_list[i].enum_idx)
8188+
{
8189+
case MENU_ENUM_LABEL_MENU_ALLOW_TABS_BACK:
8190+
if (string_is_equal(menu_driver, "rgui"))
8191+
build_list[i].checked = false;
8192+
break;
8193+
default:
8194+
break;
8195+
}
8196+
}
8197+
81838198
for (i = 0; i < ARRAY_SIZE(build_list); i++)
81848199
{
81858200
if (!build_list[i].checked && !include_everything)
@@ -9598,7 +9613,7 @@ unsigned menu_displaylist_build_list(
95989613
{MENU_ENUM_LABEL_MENU_SAVESTATE_RESUME, PARSE_ONLY_BOOL, true},
95999614
{MENU_ENUM_LABEL_MENU_INSERT_DISK_RESUME, PARSE_ONLY_BOOL, true},
96009615
{MENU_ENUM_LABEL_NAVIGATION_WRAPAROUND, PARSE_ONLY_BOOL, true},
9601-
{MENU_ENUM_LABEL_MENU_REMEMBER_SELECTION, PARSE_ONLY_UINT, false},
9616+
{MENU_ENUM_LABEL_MENU_REMEMBER_SELECTION, PARSE_ONLY_UINT, true},
96029617
{MENU_ENUM_LABEL_MENU_STARTUP_PAGE, PARSE_ONLY_UINT, true},
96039618
{MENU_ENUM_LABEL_SHOW_ADVANCED_SETTINGS, PARSE_ONLY_BOOL, true},
96049619
{MENU_ENUM_LABEL_MENU_ENABLE_KIOSK_MODE, PARSE_ONLY_BOOL, true},
@@ -9663,9 +9678,6 @@ unsigned menu_displaylist_build_list(
96639678
build_list[i].checked = true;
96649679
break;
96659680
#endif
9666-
case MENU_ENUM_LABEL_MENU_REMEMBER_SELECTION:
9667-
build_list[i].checked = true;
9668-
break;
96699681
#if defined(HAVE_QT) || defined(HAVE_COCOA)
96709682
case MENU_ENUM_LABEL_UI_COMPANION_TOGGLE:
96719683
if (desktop_menu_enable)

0 commit comments

Comments
 (0)