Add 'unified menu controls' setting

This commit is contained in:
twinaphex 2016-12-11 01:29:53 +01:00
parent 3188c3c57b
commit 9957099bf0
16 changed files with 58 additions and 4 deletions

View File

@ -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

View File

@ -204,6 +204,8 @@ typedef struct settings
{
unsigned menu_color_theme;
} materialui;
bool unified_controls;
} menu;
#endif

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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")

View File

@ -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.")

View File

@ -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;

View File

@ -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);

View File

@ -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,

View File

@ -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),

View File

@ -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

View File

@ -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)
{