diff --git a/config.def.h b/config.def.h index d002b96da14..449a5b603ab 100644 --- a/config.def.h +++ b/config.def.h @@ -1562,6 +1562,7 @@ #define DEFAULT_INPUT_BIND_HOLD 0 #define DEFAULT_INPUT_POLL_TYPE_BEHAVIOR 2 #define DEFAULT_INPUT_HOTKEY_BLOCK_DELAY 5 +#define DEFAULT_INPUT_HOTKEY_DEVICE_MERGE false #define DEFAULT_GFX_THUMBNAILS_DEFAULT 3 diff --git a/configuration.c b/configuration.c index a227ee11b5c..15c163bdc12 100644 --- a/configuration.c +++ b/configuration.c @@ -2077,6 +2077,7 @@ static struct config_bool_setting *populate_settings_bool( SETTING_BOOL("input_allow_turbo_dpad", &settings->bools.input_allow_turbo_dpad, true, DEFAULT_ALLOW_TURBO_DPAD, false); SETTING_BOOL("input_auto_mouse_grab", &settings->bools.input_auto_mouse_grab, true, false, false); SETTING_BOOL("input_remap_binds_enable", &settings->bools.input_remap_binds_enable, true, true, false); + SETTING_BOOL("input_hotkey_device_merge", &settings->bools.input_hotkey_device_merge, true, DEFAULT_INPUT_HOTKEY_DEVICE_MERGE, false); SETTING_BOOL("all_users_control_menu", &settings->bools.input_all_users_control_menu, true, DEFAULT_ALL_USERS_CONTROL_MENU, false); #ifdef HAVE_MENU SETTING_BOOL("menu_swap_ok_cancel_buttons", &settings->bools.input_menu_swap_ok_cancel_buttons, true, DEFAULT_MENU_SWAP_OK_CANCEL_BUTTONS, false); diff --git a/configuration.h b/configuration.h index f6bb9d122b4..2ecc2556f02 100644 --- a/configuration.h +++ b/configuration.h @@ -674,6 +674,7 @@ typedef struct settings bool input_keyboard_gamepad_enable; bool input_auto_mouse_grab; bool input_allow_turbo_dpad; + bool input_hotkey_device_merge; #if defined(HAVE_DINPUT) || defined(HAVE_WINRAWINPUT) bool input_nowinkey_enable; #endif diff --git a/input/input_driver.c b/input/input_driver.c index 3e44dab9375..0aa0f2efdcf 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -4738,7 +4738,8 @@ static void input_keys_pressed( const struct retro_keybind *binds_auto, const input_device_driver_t *joypad, const input_device_driver_t *sec_joypad, - rarch_joypad_info_t *joypad_info) + rarch_joypad_info_t *joypad_info, + settings_t *settings) { unsigned i; input_driver_state_t *input_st = &input_driver_st; @@ -4754,6 +4755,10 @@ static void input_keys_pressed( if (!binds) return; + if ( settings->bools.input_hotkey_device_merge + && (libretro_hotkey_set || keyboard_hotkey_set)) + libretro_hotkey_set = keyboard_hotkey_set = true; + if ( binds[port][RARCH_ENABLE_HOTKEY].valid && CHECK_INPUT_DRIVER_BLOCK_HOTKEY(binds_norm, binds_auto)) { @@ -6265,7 +6270,8 @@ void input_driver_collect_system_input(input_driver_state_t *input_st, binds_auto, joypad, sec_joypad, - &joypad_info); + &joypad_info, + settings); #ifdef HAVE_MENU if (menu_is_alive) diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 8f93b852c1e..364eda6228b 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1943,6 +1943,10 @@ MSG_HASH( MENU_ENUM_LABEL_INPUT_HOTKEY_BLOCK_DELAY, "input_hotkey_block_delay" ) +MSG_HASH( + MENU_ENUM_LABEL_INPUT_HOTKEY_DEVICE_MERGE, + "input_hotkey_device_merge" + ) MSG_HASH( MENU_ENUM_LABEL_INPUT_ICADE_ENABLE, "input_icade_enable" diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index f94edffd331..e299152890d 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -3532,6 +3532,14 @@ MSG_HASH( MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BLOCK_DELAY, "Add a delay in frames before normal input is blocked after pressing the assigned 'Hotkey Enable' key. Allows normal input from the 'Hotkey Enable' key to be captured when it is mapped to another action (e.g. RetroPad 'Select')." ) +MSG_HASH( + MENU_ENUM_LABEL_VALUE_INPUT_HOTKEY_DEVICE_MERGE, + "Hotkey Device Type Merge" + ) +MSG_HASH( + MENU_ENUM_SUBLABEL_INPUT_HOTKEY_DEVICE_MERGE, + "Block all hotkeys from both keyboard and controller device types if either type has 'Hotkey Enable' set." + ) MSG_HASH( MENU_ENUM_LABEL_VALUE_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO, "Menu Toggle (Controller Combo)" diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 3a74adfe928..dd5d6805458 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -476,6 +476,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_meta_netplay_player_chat, ME DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_meta_netplay_fade_chat_toggle, MENU_ENUM_SUBLABEL_INPUT_META_NETPLAY_FADE_CHAT_TOGGLE) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_hotkey_block_delay, MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BLOCK_DELAY) +DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_hotkey_device_merge, MENU_ENUM_SUBLABEL_INPUT_HOTKEY_DEVICE_MERGE) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_device_type, MENU_ENUM_SUBLABEL_INPUT_DEVICE_TYPE) DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_adc_type, MENU_ENUM_SUBLABEL_INPUT_ADC_TYPE) #ifdef HAVE_MATERIALUI @@ -4777,6 +4778,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_INPUT_HOTKEY_BLOCK_DELAY: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_hotkey_block_delay); break; + case MENU_ENUM_LABEL_INPUT_HOTKEY_DEVICE_MERGE: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_hotkey_device_merge); + break; case MENU_ENUM_LABEL_INPUT_USER_1_BINDS: case MENU_ENUM_LABEL_INPUT_USER_2_BINDS: case MENU_ENUM_LABEL_INPUT_USER_3_BINDS: diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 8906a1c82c3..ae81c446da0 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -6829,6 +6829,10 @@ unsigned menu_displaylist_build_list( MENU_ENUM_LABEL_INPUT_HOTKEY_BLOCK_DELAY, PARSE_ONLY_UINT, false) == 0) count++; + if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list, + MENU_ENUM_LABEL_INPUT_HOTKEY_DEVICE_MERGE, + PARSE_ONLY_BOOL, false) == 0) + count++; /* All other binds come last */ for (i = 0; i < RARCH_BIND_LIST_END; i++) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index b8229b31108..407ffccbbfb 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -14936,6 +14936,22 @@ static bool setting_append_list( menu_settings_list_current_add_range(list, list_info, 0, 600, 1, true, true); SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_ADVANCED); + CONFIG_BOOL( + list, list_info, + &settings->bools.input_hotkey_device_merge, + MENU_ENUM_LABEL_INPUT_HOTKEY_DEVICE_MERGE, + MENU_ENUM_LABEL_VALUE_INPUT_HOTKEY_DEVICE_MERGE, + DEFAULT_INPUT_HOTKEY_DEVICE_MERGE, + 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_BOOL( list, list_info, &settings->bools.input_menu_swap_ok_cancel_buttons, diff --git a/msg_hash.h b/msg_hash.h index d87b113ed45..76c3a185b08 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -876,6 +876,7 @@ enum msg_hash_enums MENU_LABEL(INPUT_RETROPAD_BINDS), MENU_LABEL(INPUT_HOTKEY_BINDS), MENU_LABEL(INPUT_HOTKEY_BLOCK_DELAY), + MENU_LABEL(INPUT_HOTKEY_DEVICE_MERGE), MENU_LABEL(INPUT_SPLIT_JOYCON), MENU_ENUM_LABEL_INPUT_HOTKEY_BINDS_BEGIN,