mirror of
https://github.com/libretro/RetroArch
synced 2025-02-20 06:40:18 +00:00
Create input_driver_keys_pressed
This commit is contained in:
parent
94856393a9
commit
207181135c
@ -25,8 +25,6 @@ extern "C" {
|
||||
#include <stdint.h>
|
||||
#include "../driver.h"
|
||||
|
||||
typedef uint64_t retro_input_t ;
|
||||
|
||||
/* Input config. */
|
||||
struct input_bind_map
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
23
runloop.c
23
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++)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user