Skip to content

Commit 266d3ed

Browse files
authored
Add option for merging 'Hotkey Enable' device types (#16152)
1 parent cd9fb0d commit 266d3ed

10 files changed

Lines changed: 48 additions & 2 deletions

File tree

config.def.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,6 +1562,7 @@
15621562
#define DEFAULT_INPUT_BIND_HOLD 0
15631563
#define DEFAULT_INPUT_POLL_TYPE_BEHAVIOR 2
15641564
#define DEFAULT_INPUT_HOTKEY_BLOCK_DELAY 5
1565+
#define DEFAULT_INPUT_HOTKEY_DEVICE_MERGE false
15651566

15661567
#define DEFAULT_GFX_THUMBNAILS_DEFAULT 3
15671568

configuration.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,6 +2077,7 @@ static struct config_bool_setting *populate_settings_bool(
20772077
SETTING_BOOL("input_allow_turbo_dpad", &settings->bools.input_allow_turbo_dpad, true, DEFAULT_ALLOW_TURBO_DPAD, false);
20782078
SETTING_BOOL("input_auto_mouse_grab", &settings->bools.input_auto_mouse_grab, true, false, false);
20792079
SETTING_BOOL("input_remap_binds_enable", &settings->bools.input_remap_binds_enable, true, true, false);
2080+
SETTING_BOOL("input_hotkey_device_merge", &settings->bools.input_hotkey_device_merge, true, DEFAULT_INPUT_HOTKEY_DEVICE_MERGE, false);
20802081
SETTING_BOOL("all_users_control_menu", &settings->bools.input_all_users_control_menu, true, DEFAULT_ALL_USERS_CONTROL_MENU, false);
20812082
#ifdef HAVE_MENU
20822083
SETTING_BOOL("menu_swap_ok_cancel_buttons", &settings->bools.input_menu_swap_ok_cancel_buttons, true, DEFAULT_MENU_SWAP_OK_CANCEL_BUTTONS, false);

configuration.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,7 @@ typedef struct settings
674674
bool input_keyboard_gamepad_enable;
675675
bool input_auto_mouse_grab;
676676
bool input_allow_turbo_dpad;
677+
bool input_hotkey_device_merge;
677678
#if defined(HAVE_DINPUT) || defined(HAVE_WINRAWINPUT)
678679
bool input_nowinkey_enable;
679680
#endif

input/input_driver.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4738,7 +4738,8 @@ static void input_keys_pressed(
47384738
const struct retro_keybind *binds_auto,
47394739
const input_device_driver_t *joypad,
47404740
const input_device_driver_t *sec_joypad,
4741-
rarch_joypad_info_t *joypad_info)
4741+
rarch_joypad_info_t *joypad_info,
4742+
settings_t *settings)
47424743
{
47434744
unsigned i;
47444745
input_driver_state_t *input_st = &input_driver_st;
@@ -4754,6 +4755,10 @@ static void input_keys_pressed(
47544755
if (!binds)
47554756
return;
47564757

4758+
if ( settings->bools.input_hotkey_device_merge
4759+
&& (libretro_hotkey_set || keyboard_hotkey_set))
4760+
libretro_hotkey_set = keyboard_hotkey_set = true;
4761+
47574762
if ( binds[port][RARCH_ENABLE_HOTKEY].valid
47584763
&& CHECK_INPUT_DRIVER_BLOCK_HOTKEY(binds_norm, binds_auto))
47594764
{
@@ -6265,7 +6270,8 @@ void input_driver_collect_system_input(input_driver_state_t *input_st,
62656270
binds_auto,
62666271
joypad,
62676272
sec_joypad,
6268-
&joypad_info);
6273+
&joypad_info,
6274+
settings);
62696275

62706276
#ifdef HAVE_MENU
62716277
if (menu_is_alive)

intl/msg_hash_lbl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,6 +1943,10 @@ MSG_HASH(
19431943
MENU_ENUM_LABEL_INPUT_HOTKEY_BLOCK_DELAY,
19441944
"input_hotkey_block_delay"
19451945
)
1946+
MSG_HASH(
1947+
MENU_ENUM_LABEL_INPUT_HOTKEY_DEVICE_MERGE,
1948+
"input_hotkey_device_merge"
1949+
)
19461950
MSG_HASH(
19471951
MENU_ENUM_LABEL_INPUT_ICADE_ENABLE,
19481952
"input_icade_enable"

intl/msg_hash_us.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3532,6 +3532,14 @@ MSG_HASH(
35323532
MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BLOCK_DELAY,
35333533
"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')."
35343534
)
3535+
MSG_HASH(
3536+
MENU_ENUM_LABEL_VALUE_INPUT_HOTKEY_DEVICE_MERGE,
3537+
"Hotkey Device Type Merge"
3538+
)
3539+
MSG_HASH(
3540+
MENU_ENUM_SUBLABEL_INPUT_HOTKEY_DEVICE_MERGE,
3541+
"Block all hotkeys from both keyboard and controller device types if either type has 'Hotkey Enable' set."
3542+
)
35353543
MSG_HASH(
35363544
MENU_ENUM_LABEL_VALUE_INPUT_MENU_ENUM_TOGGLE_GAMEPAD_COMBO,
35373545
"Menu Toggle (Controller Combo)"

menu/cbs/menu_cbs_sublabel.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_meta_netplay_player_chat, ME
476476
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_meta_netplay_fade_chat_toggle, MENU_ENUM_SUBLABEL_INPUT_META_NETPLAY_FADE_CHAT_TOGGLE)
477477

478478
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_hotkey_block_delay, MENU_ENUM_SUBLABEL_INPUT_HOTKEY_BLOCK_DELAY)
479+
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_hotkey_device_merge, MENU_ENUM_SUBLABEL_INPUT_HOTKEY_DEVICE_MERGE)
479480
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_device_type, MENU_ENUM_SUBLABEL_INPUT_DEVICE_TYPE)
480481
DEFAULT_SUBLABEL_MACRO(action_bind_sublabel_input_adc_type, MENU_ENUM_SUBLABEL_INPUT_ADC_TYPE)
481482
#ifdef HAVE_MATERIALUI
@@ -4777,6 +4778,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
47774778
case MENU_ENUM_LABEL_INPUT_HOTKEY_BLOCK_DELAY:
47784779
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_hotkey_block_delay);
47794780
break;
4781+
case MENU_ENUM_LABEL_INPUT_HOTKEY_DEVICE_MERGE:
4782+
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_input_hotkey_device_merge);
4783+
break;
47804784
case MENU_ENUM_LABEL_INPUT_USER_1_BINDS:
47814785
case MENU_ENUM_LABEL_INPUT_USER_2_BINDS:
47824786
case MENU_ENUM_LABEL_INPUT_USER_3_BINDS:

menu/menu_displaylist.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6829,6 +6829,10 @@ unsigned menu_displaylist_build_list(
68296829
MENU_ENUM_LABEL_INPUT_HOTKEY_BLOCK_DELAY,
68306830
PARSE_ONLY_UINT, false) == 0)
68316831
count++;
6832+
if (MENU_DISPLAYLIST_PARSE_SETTINGS_ENUM(list,
6833+
MENU_ENUM_LABEL_INPUT_HOTKEY_DEVICE_MERGE,
6834+
PARSE_ONLY_BOOL, false) == 0)
6835+
count++;
68326836

68336837
/* All other binds come last */
68346838
for (i = 0; i < RARCH_BIND_LIST_END; i++)

menu/menu_setting.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14936,6 +14936,22 @@ static bool setting_append_list(
1493614936
menu_settings_list_current_add_range(list, list_info, 0, 600, 1, true, true);
1493714937
SETTINGS_DATA_LIST_CURRENT_ADD_FLAGS(list, list_info, SD_FLAG_ADVANCED);
1493814938

14939+
CONFIG_BOOL(
14940+
list, list_info,
14941+
&settings->bools.input_hotkey_device_merge,
14942+
MENU_ENUM_LABEL_INPUT_HOTKEY_DEVICE_MERGE,
14943+
MENU_ENUM_LABEL_VALUE_INPUT_HOTKEY_DEVICE_MERGE,
14944+
DEFAULT_INPUT_HOTKEY_DEVICE_MERGE,
14945+
MENU_ENUM_LABEL_VALUE_OFF,
14946+
MENU_ENUM_LABEL_VALUE_ON,
14947+
&group_info,
14948+
&subgroup_info,
14949+
parent_group,
14950+
general_write_handler,
14951+
general_read_handler,
14952+
SD_FLAG_NONE
14953+
);
14954+
1493914955
CONFIG_BOOL(
1494014956
list, list_info,
1494114957
&settings->bools.input_menu_swap_ok_cancel_buttons,

msg_hash.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,7 @@ enum msg_hash_enums
876876
MENU_LABEL(INPUT_RETROPAD_BINDS),
877877
MENU_LABEL(INPUT_HOTKEY_BINDS),
878878
MENU_LABEL(INPUT_HOTKEY_BLOCK_DELAY),
879+
MENU_LABEL(INPUT_HOTKEY_DEVICE_MERGE),
879880
MENU_LABEL(INPUT_SPLIT_JOYCON),
880881

881882
MENU_ENUM_LABEL_INPUT_HOTKEY_BINDS_BEGIN,

0 commit comments

Comments
 (0)