@@ -5859,6 +5859,26 @@ static bool input_keys_pressed_other_sources(
58595859 return false;
58605860}
58615861
5862+ #define CHECK_GAME_FOCUS_ENABLE_HOTKEY_COMBO (i ) \
5863+ if ( (input_st->flags & INP_FLAG_KB_MAPPING_BLOCKED) \
5864+ && ( (i == RARCH_ENABLE_HOTKEY) \
5865+ || (i != RARCH_ENABLE_HOTKEY && !block_hotkey[RARCH_ENABLE_HOTKEY])) \
5866+ ) \
5867+ { \
5868+ if (input_state_wrap( \
5869+ input_st->current_driver, \
5870+ input_st->current_data, \
5871+ input_st->primary_joypad, \
5872+ sec_joypad, \
5873+ joypad_info, \
5874+ binds, \
5875+ (input_st->flags & INP_FLAG_KB_MAPPING_BLOCKED) ? true : false, \
5876+ port, RETRO_DEVICE_JOYPAD, 0, \
5877+ i)) \
5878+ block_hotkey[i] = false; \
5879+ } \
5880+
5881+
58625882/**
58635883 * input_keys_pressed:
58645884 *
@@ -5884,6 +5904,7 @@ static void input_keys_pressed(
58845904 int32_t ret = 0 ;
58855905 input_driver_state_t * input_st = & input_driver_st ;
58865906 bool block_hotkey [RARCH_BIND_LIST_END ];
5907+ bool enable_hotkey_pressed = false;
58875908 bool any_pressed = false;
58885909 bool libretro_hotkey_set =
58895910 binds_norm -> joykey != NO_BTN
@@ -5915,6 +5936,7 @@ static void input_keys_pressed(
59155936 port , RETRO_DEVICE_JOYPAD , 0 ,
59165937 RARCH_ENABLE_HOTKEY ))
59175938 {
5939+ enable_hotkey_pressed = true;
59185940 if (input_st -> input_hotkey_block_counter < input_hotkey_block_delay )
59195941 input_st -> input_hotkey_block_counter ++ ;
59205942 else
@@ -6016,6 +6038,7 @@ static void input_keys_pressed(
60166038 /* Ignore hotkey block delay when menu toggle and hotkey enabler share the same key */
60176039 if ( !any_pressed
60186040 && !(input_st -> flags & INP_FLAG_WAIT_INPUT_RELEASE )
6041+ && !(input_st -> flags & INP_FLAG_KB_MAPPING_BLOCKED )
60196042 && binds [port ][RARCH_MENU_TOGGLE ].key == binds [port ][RARCH_ENABLE_HOTKEY ].key )
60206043 {
60216044 i = RARCH_MENU_TOGGLE ;
@@ -6049,7 +6072,12 @@ static void input_keys_pressed(
60496072 {
60506073 /* Block everything when hotkey bind exists for both device types */
60516074 for (i = RARCH_FIRST_META_KEY ; i < RARCH_BIND_LIST_END ; i ++ )
6075+ {
60526076 block_hotkey [i ] = true;
6077+
6078+ /* Don't block controller hotkey enabler with Game Focus */
6079+ CHECK_GAME_FOCUS_ENABLE_HOTKEY_COMBO (i );
6080+ }
60536081 }
60546082 else if (input_st -> flags & INP_FLAG_BLOCK_HOTKEY
60556083 && (!libretro_hotkey_set || !keyboard_hotkey_set ))
@@ -6150,6 +6178,9 @@ static void input_keys_pressed(
61506178 }
61516179 }
61526180 }
6181+
6182+ /* Don't block controller hotkey enabler with Game Focus */
6183+ CHECK_GAME_FOCUS_ENABLE_HOTKEY_COMBO (i );
61536184 }
61546185 }
61556186 else
@@ -6206,8 +6237,14 @@ static void input_keys_pressed(
62066237 continue ;
62076238 }
62086239 else if (i != RARCH_ENABLE_HOTKEY )
6240+ {
62096241 input_st -> flags |= INP_FLAG_MENU_PRESS_CANCEL ;
62106242
6243+ /* Game Focus toggle is always allowed, so it must clear menu cancel */
6244+ if (i == RARCH_GAME_FOCUS_TOGGLE )
6245+ input_st -> flags &= ~INP_FLAG_MENU_PRESS_CANCEL ;
6246+ }
6247+
62116248 BIT256_SET_PTR (p_new_state , i );
62126249 }
62136250 else
@@ -6237,7 +6274,7 @@ static void input_keys_pressed(
62376274 if ((input_st -> flags & INP_FLAG_WAIT_INPUT_RELEASE ) && !any_pressed )
62386275 input_st -> flags &= ~INP_FLAG_WAIT_INPUT_RELEASE ;
62396276
6240- if (input_st -> flags & INP_FLAG_BLOCK_HOTKEY )
6277+ if (input_st -> flags & INP_FLAG_BLOCK_HOTKEY && ! enable_hotkey_pressed )
62416278 input_st -> input_hotkey_block_counter = 0 ;
62426279}
62436280
0 commit comments