diff --git a/command_event.c b/command_event.c index eab4c55119..19144e852a 100644 --- a/command_event.c +++ b/command_event.c @@ -1224,8 +1224,6 @@ bool event_command(enum event_command cmd) { const struct retro_hw_render_callback *hw_render = (const struct retro_hw_render_callback*)video_driver_callback(); - const input_driver_t *input = driver ? - (const input_driver_t*)driver->input : NULL; driver->video_cache_context = hw_render->cache_context; driver->video_cache_context_ack = false; @@ -1233,7 +1231,7 @@ bool event_command(enum event_command cmd) driver->video_cache_context = false; /* Poll input to avoid possibly stale data to corrupt things. */ - input->poll(driver->input_data); + input_driver_ctl(RARCH_INPUT_CTL_POLL, NULL); #ifdef HAVE_MENU menu_display_ctl(MENU_DISPLAY_CTL_SET_FRAMEBUFFER_DIRTY_FLAG, NULL); diff --git a/input/input_common.c b/input/input_common.c index 1a9612c96a..66ea8698a3 100644 --- a/input/input_common.c +++ b/input/input_common.c @@ -443,14 +443,14 @@ void input_get_bind_string(char *buf, const struct retro_keybind *bind, **/ void input_poll(void) { +#ifdef HAVE_COMMAND driver_t *driver = driver_get_ptr(); +#endif +#ifdef HAVE_OVERLAY settings_t *settings = config_get_ptr(); - const input_driver_t *input = driver ? - (const input_driver_t*)driver->input : NULL; +#endif - (void)settings; - - input->poll(driver->input_data); + input_driver_ctl(RARCH_INPUT_CTL_POLL, NULL); #ifdef HAVE_OVERLAY input_poll_overlay(settings->input.overlay_opacity); diff --git a/input/input_driver.c b/input/input_driver.c index 2b6fb2c89b..5485f2f3d5 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -455,6 +455,9 @@ bool input_driver_ctl(enum rarch_input_ctl_state state, void *data) switch (state) { + case RARCH_INPUT_CTL_POLL: + input->poll(driver->input_data); + return true; case RARCH_INPUT_CTL_INIT: if (driver && driver->input) driver->input_data = driver->input->init(); diff --git a/input/input_driver.h b/input/input_driver.h index 91e24b99bb..2e336113eb 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -52,6 +52,7 @@ enum rarch_input_ctl_state RARCH_INPUT_CTL_INIT, RARCH_INPUT_CTL_DEINIT, RARCH_INPUT_CTL_DESTROY, + RARCH_INPUT_CTL_POLL, RARCH_INPUT_CTL_FIND_DRIVER, RARCH_INPUT_CTL_GRAB_STDIN, RARCH_INPUT_CTL_KB_MAPPING_IS_BLOCKED