From 4a84e0e609a052aff2ee56491fffacfb7df201ef Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 17 Sep 2014 00:46:16 +0200 Subject: [PATCH] Refactor input_keys_pressed_func --- input/input_common.h | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/input/input_common.h b/input/input_common.h index b8d4f2dfdd..becfcd3dae 100644 --- a/input/input_common.h +++ b/input/input_common.h @@ -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); }