diff --git a/configuration.c b/configuration.c index 3c0bb87be5..50530a9b96 100644 --- a/configuration.c +++ b/configuration.c @@ -773,6 +773,7 @@ static int populate_settings_bool(settings_t *settings, struct config_bool_setti SETTING_BOOL("video_vfilter", &settings->video.vfilter, true, video_vfilter, false); #endif #ifdef HAVE_MENU + SETTING_BOOL("menu_unified_controls", &settings->menu.unified_controls, true, false, false); #ifdef HAVE_THREADS SETTING_BOOL("threaded_data_runloop_enable", &settings->threaded_data_runloop_enable, true, threaded_data_runloop_enable, false); #endif diff --git a/configuration.h b/configuration.h index 3612a07615..d4cc94cf91 100644 --- a/configuration.h +++ b/configuration.h @@ -204,6 +204,8 @@ typedef struct settings { unsigned menu_color_theme; } materialui; + + bool unified_controls; } menu; #endif diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index 6117c5a6d5..9a340fe5d9 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -846,3 +846,5 @@ MSG_HASH(MENU_ENUM_SUBLABEL_HISTORY_LIST_ENABLE, "Enable or disable recent playlist for games, images, music, and videos.") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE, "Limit the number of entries in recent playlist for games, images, music, and videos.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, + "Unified Menu Controls") diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index 311dffe647..cbb044b7c0 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -2245,3 +2245,5 @@ MSG_HASH(MENU_ENUM_SUBLABEL_HISTORY_LIST_ENABLE, "Enable or disable recent playlist for games, images, music, and videos.") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE, "Limit the number of entries in recent playlist for games, images, music, and videos.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, + "Unified Menu Controls") diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index ffe5013be0..7a63ea1932 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -2211,3 +2211,5 @@ MSG_HASH(MENU_ENUM_SUBLABEL_HISTORY_LIST_ENABLE, "Enable or disable recent playlist for games, images, music, and videos.") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE, "Limit the number of entries in recent playlist for games, images, music, and videos.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, + "Unified Menu Controls") diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 4ce00a91e4..e63f10a684 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -2265,3 +2265,5 @@ MSG_HASH(MENU_ENUM_SUBLABEL_HISTORY_LIST_ENABLE, "Enable or disable recent playlist for games, images, music, and videos.") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE, "Limit the number of entries in recent playlist for games, images, music, and videos.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, + "Unified Menu Controls") diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 8e9547099c..77618556b5 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1151,3 +1151,5 @@ MSG_HASH(MENU_ENUM_LABEL_SHADER_PIPELINE_SIMPLE_SNOW, "shader_pipeline_simple_snow") MSG_HASH(MENU_ENUM_LABEL_SHADER_PIPELINE_SNOW, "shader_pipeline_snow") +MSG_HASH(MENU_ENUM_LABEL_INPUT_UNIFIED_MENU_CONTROLS, + "unified_menu_controls") diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 3f6c3d41db..4e307c7585 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -2245,3 +2245,5 @@ MSG_HASH(MENU_ENUM_SUBLABEL_HISTORY_LIST_ENABLE, "Enable or disable recent playlist for games, images, music, and videos.") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE, "Limit the number of entries in recent playlist for games, images, music, and videos.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, + "Unified Menu Controls") diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 2ef320b97e..f1b0b369f0 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -2239,3 +2239,5 @@ MSG_HASH(MENU_ENUM_SUBLABEL_HISTORY_LIST_ENABLE, "Enable or disable recent playlist for games, images, music, and videos.") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE, "Limit the number of entries in recent playlist for games, images, music, and videos.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, + "Unified Menu Controls") diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index b50457c8c5..b700be4636 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -2277,3 +2277,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_HISTORY_LIST_ENABLE, "Enable or disable recent playlist for games, images, music, and videos.") MSG_HASH(MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE, "Limit the number of entries in recent playlist for games, images, music, and videos.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, + "Unified Menu Controls") +MSG_HASH(MENU_ENUM_SUBLABEL_INPUT_UNIFIED_MENU_CONTROLS, + "Use the same controls for both the menu and the game. Applies to the keyboard.") diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index a9310f195e..51f179f964 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -114,6 +114,7 @@ default_sublabel_macro(action_bind_sublabel_pause_nonactive, MENU_ default_sublabel_macro(action_bind_sublabel_video_disable_composition, MENU_ENUM_SUBLABEL_VIDEO_DISABLE_COMPOSITION) default_sublabel_macro(action_bind_sublabel_history_list_enable, MENU_ENUM_SUBLABEL_HISTORY_LIST_ENABLE) default_sublabel_macro(action_bind_sublabel_content_history_size, MENU_ENUM_SUBLABEL_CONTENT_HISTORY_SIZE) +default_sublabel_macro(action_bind_sublabel_menu_input_unified_controls, MENU_ENUM_SUBLABEL_INPUT_UNIFIED_MENU_CONTROLS) static int action_bind_sublabel_cheevos_entry( file_list_t *list, @@ -155,6 +156,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, { switch (cbs->enum_idx) { + case MENU_ENUM_LABEL_INPUT_UNIFIED_MENU_CONTROLS: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_input_unified_controls); + break; case MENU_ENUM_LABEL_AUDIO_MAX_TIMING_SKEW: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_audio_max_timing_skew); break; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index b987e4b5b4..1fc78c7600 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5376,6 +5376,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) MENU_ENUM_LABEL_INPUT_SMALL_KEYBOARD_ENABLE, PARSE_ONLY_BOOL, false); #endif + ret = menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_INPUT_UNIFIED_MENU_CONTROLS, + PARSE_ONLY_BOOL, false); ret = menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_INPUT_POLL_TYPE_BEHAVIOR, PARSE_ONLY_UINT, false); diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 89951b1cf5..1fc9357c0f 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -3912,6 +3912,22 @@ static bool setting_append_list( general_read_handler); menu_settings_list_current_add_range(list, list_info, 1, MAX_USERS, 1, true, true); + CONFIG_BOOL( + list, list_info, + &settings->menu.unified_controls, + MENU_ENUM_LABEL_INPUT_UNIFIED_MENU_CONTROLS, + MENU_ENUM_LABEL_VALUE_INPUT_UNIFIED_MENU_CONTROLS, + false, + MENU_ENUM_LABEL_VALUE_OFF, + MENU_ENUM_LABEL_VALUE_ON, + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler, + SD_FLAG_NONE + ); + CONFIG_UINT( list, list_info, &settings->input.poll_type_behavior, diff --git a/msg_hash.h b/msg_hash.h index 14146274b8..777a62f85d 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -568,6 +568,7 @@ enum msg_hash_enums MENU_LABEL(INPUT_ICADE_ENABLE), MENU_LABEL(INPUT_ALL_USERS_CONTROL_MENU), MENU_LABEL(INPUT_POLL_TYPE_BEHAVIOR), + MENU_LABEL(INPUT_UNIFIED_MENU_CONTROLS), /* Video */ MENU_LABEL(VIDEO_FONT_ENABLE), diff --git a/retroarch.cfg b/retroarch.cfg index 2de7ae0e85..4f660bd41f 100644 --- a/retroarch.cfg +++ b/retroarch.cfg @@ -640,6 +640,9 @@ # are in the menu. # menu_pause_libretro = false +# If disabled, we use separate controls for menu operation. +# menu_unified_controls = false + # Enable mouse input inside the menu. # menu_mouse_enable = false diff --git a/runloop.c b/runloop.c index 82bf765c90..dd9326258b 100644 --- a/runloop.c +++ b/runloop.c @@ -1076,6 +1076,8 @@ static enum runloop_state runloop_check_state( return RUNLOOP_STATE_ITERATE; } +#define runloop_menu_unified_controls_pressed() (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) && settings->menu.unified_controls) + /** * runloop_iterate: * @@ -1090,15 +1092,19 @@ int runloop_iterate(unsigned *sleep_ms) unsigned i; retro_time_t current, target, to_sleep_ms; uint64_t trigger_input = 0; + uint64_t current_input = 0; static uint64_t last_input = 0; settings_t *settings = config_get_ptr(); uint64_t old_input = last_input; - uint64_t current_input = + #ifdef HAVE_MENU - menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL) ? - input_menu_keys_pressed(old_input, &last_input, &trigger_input, runloop_paused) : + if (!runloop_menu_unified_controls_pressed()) + current_input = input_menu_keys_pressed(old_input, + &last_input, &trigger_input, runloop_paused); + else #endif - input_keys_pressed (old_input, &last_input, &trigger_input, runloop_paused); + current_input = input_keys_pressed(old_input, &last_input, + &trigger_input, runloop_paused); if (runloop_frame_time.callback) {