mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-28 02:30:35 +00:00
Turn check_block_hotkey into static function
This commit is contained in:
parent
cd51102281
commit
1639f27f8c
@ -77,6 +77,8 @@ typedef struct video_driver_state
|
|||||||
* TODO: Refactor this better. */
|
* TODO: Refactor this better. */
|
||||||
static bool gfx_use_rgba;
|
static bool gfx_use_rgba;
|
||||||
|
|
||||||
|
static uint64_t video_frame_count;
|
||||||
|
|
||||||
static void *video_data;
|
static void *video_data;
|
||||||
static const video_driver_t *current_video;
|
static const video_driver_t *current_video;
|
||||||
|
|
||||||
@ -312,7 +314,6 @@ uintptr_t video_driver_get_current_framebuffer(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t video_frame_count;
|
|
||||||
|
|
||||||
retro_proc_address_t video_driver_get_proc_address(const char *sym)
|
retro_proc_address_t video_driver_get_proc_address(const char *sym)
|
||||||
{
|
{
|
||||||
|
@ -504,6 +504,46 @@ void input_pop_analog_dpad(struct retro_keybind *binds)
|
|||||||
binds[i].joyaxis = binds[i].orig_joyaxis;
|
binds[i].joyaxis = binds[i].orig_joyaxis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check_block_hotkey:
|
||||||
|
* @enable_hotkey : Is hotkey enable key enabled?
|
||||||
|
*
|
||||||
|
* Checks if 'hotkey enable' key is pressed.
|
||||||
|
**/
|
||||||
|
static bool check_block_hotkey(bool enable_hotkey)
|
||||||
|
{
|
||||||
|
bool use_hotkey_enable;
|
||||||
|
driver_t *driver = driver_get_ptr();
|
||||||
|
settings_t *settings = config_get_ptr();
|
||||||
|
global_t *global = global_get_ptr();
|
||||||
|
const struct retro_keybind *bind =
|
||||||
|
&settings->input.binds[0][RARCH_ENABLE_HOTKEY];
|
||||||
|
const struct retro_keybind *autoconf_bind =
|
||||||
|
&settings->input.autoconf_binds[0][RARCH_ENABLE_HOTKEY];
|
||||||
|
|
||||||
|
/* Don't block the check to RARCH_ENABLE_HOTKEY
|
||||||
|
* unless we're really supposed to. */
|
||||||
|
driver->block_hotkey = input_driver_keyboard_mapping_is_blocked();
|
||||||
|
|
||||||
|
/* If we haven't bound anything to this,
|
||||||
|
* always allow hotkeys. */
|
||||||
|
use_hotkey_enable =
|
||||||
|
(bind->key != RETROK_UNKNOWN)
|
||||||
|
|| (bind->joykey != NO_BTN)
|
||||||
|
|| (bind->joyaxis != AXIS_NONE)
|
||||||
|
|| (autoconf_bind->key != RETROK_UNKNOWN )
|
||||||
|
|| (autoconf_bind->joykey != NO_BTN)
|
||||||
|
|| (autoconf_bind->joyaxis != AXIS_NONE);
|
||||||
|
|
||||||
|
driver->block_hotkey =
|
||||||
|
input_driver_keyboard_mapping_is_blocked() ||
|
||||||
|
(use_hotkey_enable && !enable_hotkey);
|
||||||
|
|
||||||
|
/* If we hold ENABLE_HOTKEY button, block all libretro input to allow
|
||||||
|
* hotkeys to be bound to same keys as RetroPad. */
|
||||||
|
return (use_hotkey_enable && enable_hotkey);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* input_keys_pressed:
|
* input_keys_pressed:
|
||||||
*
|
*
|
||||||
@ -564,45 +604,6 @@ retro_input_t input_keys_pressed(void)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* check_block_hotkey:
|
|
||||||
* @enable_hotkey : Is hotkey enable key enabled?
|
|
||||||
*
|
|
||||||
* Checks if 'hotkey enable' key is pressed.
|
|
||||||
**/
|
|
||||||
bool check_block_hotkey(bool enable_hotkey)
|
|
||||||
{
|
|
||||||
bool use_hotkey_enable;
|
|
||||||
driver_t *driver = driver_get_ptr();
|
|
||||||
settings_t *settings = config_get_ptr();
|
|
||||||
global_t *global = global_get_ptr();
|
|
||||||
const struct retro_keybind *bind =
|
|
||||||
&settings->input.binds[0][RARCH_ENABLE_HOTKEY];
|
|
||||||
const struct retro_keybind *autoconf_bind =
|
|
||||||
&settings->input.autoconf_binds[0][RARCH_ENABLE_HOTKEY];
|
|
||||||
|
|
||||||
/* Don't block the check to RARCH_ENABLE_HOTKEY
|
|
||||||
* unless we're really supposed to. */
|
|
||||||
driver->block_hotkey = input_driver_keyboard_mapping_is_blocked();
|
|
||||||
|
|
||||||
/* If we haven't bound anything to this,
|
|
||||||
* always allow hotkeys. */
|
|
||||||
use_hotkey_enable =
|
|
||||||
(bind->key != RETROK_UNKNOWN)
|
|
||||||
|| (bind->joykey != NO_BTN)
|
|
||||||
|| (bind->joyaxis != AXIS_NONE)
|
|
||||||
|| (autoconf_bind->key != RETROK_UNKNOWN )
|
|
||||||
|| (autoconf_bind->joykey != NO_BTN)
|
|
||||||
|| (autoconf_bind->joyaxis != AXIS_NONE);
|
|
||||||
|
|
||||||
driver->block_hotkey =
|
|
||||||
input_driver_keyboard_mapping_is_blocked() ||
|
|
||||||
(use_hotkey_enable && !enable_hotkey);
|
|
||||||
|
|
||||||
/* If we hold ENABLE_HOTKEY button, block all libretro input to allow
|
|
||||||
* hotkeys to be bound to same keys as RetroPad. */
|
|
||||||
return (use_hotkey_enable && enable_hotkey);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* input_poll:
|
* input_poll:
|
||||||
|
@ -121,8 +121,6 @@ void input_pop_analog_dpad(struct retro_keybind *binds);
|
|||||||
|
|
||||||
retro_input_t input_keys_pressed(void);
|
retro_input_t input_keys_pressed(void);
|
||||||
|
|
||||||
bool check_block_hotkey(bool enable_hotkey);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* input_poll:
|
* input_poll:
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user