From 7895722f03fb865d5b072a6485f0b61f270151f1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 6 Jul 2020 10:15:59 +0200 Subject: [PATCH] Revert "Refactor CHECK_INPUT_DRIVER_BLOCK_HOTKEY" This reverts commit b9cb839abf05da747ba6a1e6b58af3a533697640. --- retroarch.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/retroarch.c b/retroarch.c index d10b506c84..7c04702f5d 100644 --- a/retroarch.c +++ b/retroarch.c @@ -1298,12 +1298,26 @@ static const camera_driver_t *camera_drivers[] = { #define INPUT_REMOTE_KEY_PRESSED(key, port) (p_rarch->remote_st_ptr.buttons[(port)] & (UINT64_C(1) << (key))) #endif -#define CHECK_INPUT_DRIVER_BLOCK_HOTKEY(normal_bind) \ +/** + * check_input_driver_block_hotkey: + * + * Checks if 'hotkey enable' key is pressed. + * + * If we haven't bound anything to this, + * always allow hotkeys. + + * If we hold ENABLE_HOTKEY button, block all libretro input to allow + * hotkeys to be bound to same keys as RetroPad. + **/ +#define CHECK_INPUT_DRIVER_BLOCK_HOTKEY(normal_bind, autoconf_bind) \ ( \ (((normal_bind)->key != RETROK_UNKNOWN) \ || ((normal_bind)->mbutton != NO_BTN) \ || ((normal_bind)->joykey != NO_BTN) \ - || ((normal_bind)->joyaxis != AXIS_NONE)) \ + || ((normal_bind)->joyaxis != AXIS_NONE) \ + || ((autoconf_bind)->key != RETROK_UNKNOWN) \ + || ((autoconf_bind)->joykey != NO_BTN) \ + || ((autoconf_bind)->joyaxis != AXIS_NONE)) \ ) #define INHERIT_JOYAXIS(binds) (((binds)[x_plus].joyaxis == (binds)[x_minus].joyaxis) || ( (binds)[y_plus].joyaxis == (binds)[y_minus].joyaxis)) @@ -25650,15 +25664,8 @@ static void input_keys_pressed( { unsigned i; - if ( CHECK_INPUT_DRIVER_BLOCK_HOTKEY(binds_norm) - || CHECK_INPUT_DRIVER_BLOCK_HOTKEY(binds_auto)) + if (CHECK_INPUT_DRIVER_BLOCK_HOTKEY(binds_norm, binds_auto)) { - /* If we hold ENABLE_HOTKEY button, block all libretro input to allow - * hotkeys to be bound to same keys as RetroPad. - * - * If we haven't bound anything to this, - * always allow hotkeys. - **/ if ( p_rarch->current_input->input_state( p_rarch->current_input_data, joypad_info, &binds[port], port, RETRO_DEVICE_JOYPAD, 0, @@ -25686,8 +25693,8 @@ static void input_keys_pressed( /* Allows rarch_focus_toggle hotkey to still work * even though every hotkey is blocked */ - if ( CHECK_INPUT_DRIVER_BLOCK_HOTKEY(focus_normal) - || CHECK_INPUT_DRIVER_BLOCK_HOTKEY(focus_binds_auto)) + if (CHECK_INPUT_DRIVER_BLOCK_HOTKEY( + focus_normal, focus_binds_auto)) { if (p_rarch->current_input->input_state( p_rarch->current_input_data,