mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-26 13:25:28 +00:00
Create RARCH_INPUT_CTL_KEY_PRESSED
This commit is contained in:
parent
7274e6bc3e
commit
4727ddb52d
@ -946,10 +946,11 @@ static void android_input_poll_memcpy(void *data)
|
||||
static void android_input_poll(void *data)
|
||||
{
|
||||
int ident;
|
||||
unsigned key = RARCH_PAUSE_TOGGLE;
|
||||
struct android_app *android_app = (struct android_app*)g_android;
|
||||
|
||||
while ((ident =
|
||||
ALooper_pollAll((input_driver_key_pressed(RARCH_PAUSE_TOGGLE))
|
||||
ALooper_pollAll((input_driver_ctl(RARCH_INPUT_CTL_KEY_PRESSED, &key))
|
||||
? -1 : 0,
|
||||
NULL, NULL, NULL)) >= 0)
|
||||
{
|
||||
|
@ -254,16 +254,9 @@ float input_sensor_get_input(unsigned port, unsigned id)
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
bool input_driver_key_pressed(unsigned key)
|
||||
{
|
||||
if (current_input->key_pressed)
|
||||
return current_input->key_pressed(current_input_data, key);
|
||||
return false;
|
||||
}
|
||||
|
||||
static retro_input_t input_driver_keys_pressed(void)
|
||||
{
|
||||
int key;
|
||||
unsigned key;
|
||||
retro_input_t ret = 0;
|
||||
|
||||
for (key = 0; key < RARCH_BIND_LIST_END; key++)
|
||||
@ -271,7 +264,7 @@ static retro_input_t input_driver_keys_pressed(void)
|
||||
bool state = false;
|
||||
if ((!input_driver_ctl(RARCH_INPUT_CTL_IS_LIBRETRO_INPUT_BLOCKED, NULL) && ((key < RARCH_FIRST_META_KEY)))
|
||||
|| !input_driver_ctl(RARCH_INPUT_CTL_IS_HOTKEY_BLOCKED, NULL))
|
||||
state = input_driver_key_pressed(key);
|
||||
state = input_driver_ctl(RARCH_INPUT_CTL_KEY_PRESSED, &key);
|
||||
|
||||
if (key >= RARCH_FIRST_META_KEY)
|
||||
state |= current_input->meta_key_pressed(current_input_data, key);
|
||||
@ -583,7 +576,7 @@ static bool check_input_driver_block_hotkey(bool enable_hotkey)
|
||||
*/
|
||||
retro_input_t input_keys_pressed(void)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned i, key;
|
||||
const struct retro_keybind *binds[MAX_USERS];
|
||||
retro_input_t ret = 0;
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -595,8 +588,10 @@ retro_input_t input_keys_pressed(void)
|
||||
return 0;
|
||||
|
||||
input_driver_turbo_btns.count++;
|
||||
|
||||
key = RARCH_ENABLE_HOTKEY;
|
||||
|
||||
if (check_input_driver_block_hotkey(input_driver_key_pressed(RARCH_ENABLE_HOTKEY)))
|
||||
if (check_input_driver_block_hotkey(input_driver_ctl(RARCH_INPUT_CTL_KEY_PRESSED, &key)))
|
||||
input_driver_ctl(RARCH_INPUT_CTL_SET_LIBRETRO_INPUT_BLOCKED, NULL);
|
||||
else
|
||||
input_driver_ctl(RARCH_INPUT_CTL_UNSET_LIBRETRO_INPUT_BLOCKED, NULL);
|
||||
@ -693,6 +688,13 @@ bool input_driver_ctl(enum rarch_input_ctl_state state, void *data)
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case RARCH_INPUT_CTL_KEY_PRESSED:
|
||||
{
|
||||
unsigned *key = (unsigned*)data;
|
||||
if (key && current_input->key_pressed)
|
||||
return current_input->key_pressed(current_input_data, *key);
|
||||
}
|
||||
return false;
|
||||
case RARCH_INPUT_CTL_HAS_CAPABILITIES:
|
||||
if (current_input->get_capabilities && current_input_data)
|
||||
return true;
|
||||
|
@ -81,7 +81,8 @@ enum rarch_input_ctl_state
|
||||
RARCH_INPUT_CTL_COMMAND_INIT,
|
||||
RARCH_INPUT_CTL_COMMAND_DEINIT,
|
||||
RARCH_INPUT_CTL_REMOTE_INIT,
|
||||
RARCH_INPUT_CTL_REMOTE_DEINIT
|
||||
RARCH_INPUT_CTL_REMOTE_DEINIT,
|
||||
RARCH_INPUT_CTL_KEY_PRESSED
|
||||
};
|
||||
|
||||
struct retro_keybind
|
||||
@ -278,8 +279,6 @@ void input_poll(void);
|
||||
int16_t input_state(unsigned port, unsigned device,
|
||||
unsigned idx, unsigned id);
|
||||
|
||||
bool input_driver_key_pressed(unsigned key);
|
||||
|
||||
retro_input_t input_keys_pressed(void);
|
||||
|
||||
bool input_driver_ctl(enum rarch_input_ctl_state state, void *data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user