Create input_driver_get_joypad_driver

This commit is contained in:
twinaphex 2015-03-23 03:40:09 +01:00
parent c274ab94a0
commit d9ba52e018
3 changed files with 15 additions and 12 deletions

View File

@ -240,3 +240,12 @@ bool input_driver_key_pressed(int key)
return driver->input->key_pressed(driver->input_data, key);
return false;
}
const rarch_joypad_driver_t * input_driver_get_joypad_driver(void)
{
driver_t *driver = driver_get_ptr();
if (driver && driver->input && driver->input->get_joypad_driver)
return driver->input->get_joypad_driver(driver->input_data);
return NULL;
}

View File

@ -144,6 +144,8 @@ void input_driver_poll(void);
bool input_driver_key_pressed(int key);
const rarch_joypad_driver_t * input_driver_get_joypad_driver(void);
#ifdef __cplusplus
}
#endif

View File

@ -197,9 +197,8 @@ void menu_input_key_event(bool down, unsigned keycode,
void menu_input_poll_bind_state(struct menu_bind_state *state)
{
unsigned i, b, a, h;
const rarch_joypad_driver_t *joypad = NULL;
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
const rarch_joypad_driver_t *joypad = input_driver_get_joypad_driver();
settings_t *settings = config_get_ptr();
if (!state)
return;
@ -208,9 +207,6 @@ void menu_input_poll_bind_state(struct menu_bind_state *state)
state->skip = input_driver_state(NULL, 0,
RETRO_DEVICE_KEYBOARD, 0, RETROK_RETURN);
if (driver->input && driver->input_data && driver->input->get_joypad_driver)
joypad = driver->input->get_joypad_driver(driver->input_data);
if (!joypad)
{
RARCH_ERR("Cannot poll raw joypad state.");
@ -245,16 +241,12 @@ void menu_input_poll_bind_state(struct menu_bind_state *state)
void menu_input_poll_bind_get_rested_axes(struct menu_bind_state *state)
{
unsigned i, a;
const rarch_joypad_driver_t *joypad = NULL;
driver_t *driver = driver_get_ptr();
settings_t *settings = config_get_ptr();
const rarch_joypad_driver_t *joypad = input_driver_get_joypad_driver();
settings_t *settings = config_get_ptr();
if (!state)
return;
if (driver->input && driver->input_data && driver->input->get_joypad_driver)
joypad = driver->input->get_joypad_driver(driver->input_data);
if (!joypad)
{
RARCH_ERR("Cannot poll raw joypad state.");