Create input_driver_keys_pressed

This commit is contained in:
twinaphex 2015-02-15 01:19:06 +01:00
parent 94856393a9
commit 207181135c
4 changed files with 32 additions and 24 deletions

View File

@ -25,8 +25,6 @@ extern "C" {
#include <stdint.h>
#include "../driver.h"
typedef uint64_t retro_input_t ;
/* Input config. */
struct input_bind_map
{

View File

@ -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;
}

View File

@ -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

View File

@ -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++)
{