diff --git a/input/input_common.h b/input/input_common.h index f80ee90cd6..1b1433a58b 100644 --- a/input/input_common.h +++ b/input/input_common.h @@ -25,8 +25,6 @@ extern "C" { #include #include "../driver.h" -typedef uint64_t retro_input_t ; - /* Input config. */ struct input_bind_map { diff --git a/input/input_driver.c b/input/input_driver.c index fd901f9eb6..ab32098f50 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -182,3 +182,30 @@ bool input_driver_set_rumble_state(unsigned port, port, effect, strength); return false; } + +retro_input_t input_driver_keys_pressed(void) +{ + int key; + retro_input_t ret = 0; + + for (key = 0; key < RARCH_BIND_LIST_END; key++) + { + bool state = false; + if ((!driver.block_libretro_input && (key < RARCH_FIRST_META_KEY)) || + !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); + } + return ret; +} diff --git a/input/input_driver.h b/input/input_driver.h index c4bcc128b7..f62e452502 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -33,6 +33,8 @@ extern "C" { #endif +typedef uint64_t retro_input_t ; + struct retro_keybind { bool valid; @@ -133,6 +135,8 @@ void find_input_driver(void); bool input_driver_set_rumble_state(unsigned port, enum retro_rumble_effect effect, uint16_t strength); +retro_input_t input_driver_keys_pressed(void); + #ifdef __cplusplus } #endif diff --git a/runloop.c b/runloop.c index 7ea59670a3..fcb73d1dcf 100644 --- a/runloop.c +++ b/runloop.c @@ -770,7 +770,6 @@ static bool check_block_hotkey(bool enable_hotkey) */ static inline retro_input_t input_keys_pressed(void) { - int key; unsigned i; static const struct retro_keybind *binds[MAX_USERS] = { g_settings.input.binds[0], @@ -821,27 +820,7 @@ static inline retro_input_t input_keys_pressed(void) } } - for (key = 0; key < RARCH_BIND_LIST_END; key++) - { - bool state = false; - - if ( - (!driver.block_libretro_input && (key < RARCH_FIRST_META_KEY)) || - !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); - } + ret = input_driver_keys_pressed(); for (i = 0; i < g_settings.input.max_users; i++) {