Create input_driver_key_pressed

This commit is contained in:
twinaphex 2015-11-29 16:45:38 +01:00
parent dc7e8bc52b
commit 9a743ec357
3 changed files with 15 additions and 10 deletions

View File

@ -799,14 +799,9 @@ static void android_input_poll_user(void *data)
static void android_input_poll(void *data)
{
int ident;
driver_t *driver = driver_get_ptr();
const input_driver_t *input = driver ? (const input_driver_t*)driver->input : NULL;
if (!input)
return;
while ((ident =
ALooper_pollAll((input->key_pressed(driver->input_data, RARCH_PAUSE_TOGGLE))
ALooper_pollAll((input_driver_key_pressed(RARCH_PAUSE_TOGGLE))
? -1 : 0,
NULL, NULL, NULL)) >= 0)
{

View File

@ -250,6 +250,15 @@ float input_sensor_get_input(unsigned port, unsigned id)
return 0.0f;
}
bool input_driver_key_pressed(unsigned key)
{
driver_t *driver = driver_get_ptr();
if (driver->input && driver->input->key_pressed)
return driver->input->key_pressed(driver->input_data, key);
return false;
}
static retro_input_t input_driver_keys_pressed(void)
{
int key;
@ -262,7 +271,7 @@ static retro_input_t input_driver_keys_pressed(void)
bool state = false;
if ((!driver->block_libretro_input && ((key < RARCH_FIRST_META_KEY)))
|| !driver->block_hotkey)
state = input->key_pressed(driver->input_data, key);
state = input_driver_key_pressed(key);
if (key >= RARCH_FIRST_META_KEY)
state |= input->meta_key_pressed(driver->input_data, key);
@ -589,9 +598,8 @@ retro_input_t input_keys_pressed(void)
global->turbo.count++;
driver->block_libretro_input = check_block_hotkey(driver->input->key_pressed(
driver->input_data, RARCH_ENABLE_HOTKEY));
driver->block_libretro_input =
check_block_hotkey(input_driver_key_pressed(RARCH_ENABLE_HOTKEY));
for (i = 0; i < settings->input.max_users; i++)
{

View File

@ -253,6 +253,8 @@ void input_poll(void);
int16_t input_state(unsigned port, unsigned device,
unsigned idx, unsigned id);
bool input_driver_key_pressed(unsigned key);
retro_input_t input_keys_pressed(void);
bool input_driver_ctl(enum rarch_input_ctl_state state, void *data);