Refactor input_keys_pressed_func

This commit is contained in:
twinaphex 2014-09-17 00:46:16 +02:00
parent d8d9b35a57
commit 4a84e0e609

View File

@ -197,25 +197,6 @@ void input_push_analog_dpad(struct retro_keybind *binds, unsigned mode);
void input_pop_analog_dpad(struct retro_keybind *binds);
static inline bool input_key_pressed_func(int key)
{
bool ret = false;
if (!driver.block_hotkey)
ret = driver.input->key_pressed(driver.input_data, key);
#ifdef HAVE_OVERLAY
ret = ret || (driver.overlay_state.buttons & (1ULL << key));
#endif
#ifdef HAVE_COMMAND
if (driver.command)
ret = ret || rarch_cmd_get(driver.command, key);
#endif
return ret;
}
/* Returns a 64-bit mask of all pressed buttons, starting
* from the specified key up until the last queryable key
* (key_end).
@ -232,7 +213,21 @@ static inline retro_input_t input_keys_pressed_func(unsigned key,
for (; key < key_end; key++)
{
if (input_key_pressed_func(key))
bool state = false;
if (!driver.block_hotkey)
state = driver.input->key_pressed(driver.input_data, key);
#ifdef HAVE_OVERLAY
state = state || (driver.overlay_state.buttons & (1ULL << key));
#endif
#ifdef HAVE_COMMAND
if (driver.command)
state = state || rarch_cmd_get(driver.command, key);
#endif
if (state)
ret |= (1ULL << key);
}