Backport polling updates - mouse smoothness was broken in cores

This commit is contained in:
twinaphex 2017-05-29 20:30:01 +02:00
parent dfae380f33
commit 1cdd0e47cb
1 changed files with 34 additions and 22 deletions

View File

@ -161,6 +161,7 @@ enum
enum runloop_state
{
RUNLOOP_STATE_ITERATE = 0,
RUNLOOP_STATE_POLLED_AND_SLEEP,
RUNLOOP_STATE_SLEEP,
RUNLOOP_STATE_MENU_ITERATE,
RUNLOOP_STATE_END,
@ -2468,6 +2469,10 @@ static enum runloop_state runloop_check_state(
{
static uint64_t old_input = 0;
menu_ctx_iterate_t iter;
retro_ctx.poll_cb();
{
uint64_t trigger_input = current_input & ~old_input;
enum menu_action action = (enum menu_action)menu_event(current_input, trigger_input);
bool focused = pause_nonactive ? is_focused : true;
@ -2488,13 +2493,17 @@ static enum runloop_state runloop_check_state(
old_input = current_input;
if (!focused)
return RUNLOOP_STATE_SLEEP;
return RUNLOOP_STATE_POLLED_AND_SLEEP;
if (action == MENU_ACTION_QUIT && !menu_driver_binding_state)
return RUNLOOP_STATE_QUIT;
}
#endif
if (runloop_idle)
return RUNLOOP_STATE_POLLED_AND_SLEEP;
}
else
#endif
if (runloop_idle)
return RUNLOOP_STATE_SLEEP;
@ -2953,8 +2962,6 @@ int runloop_iterate(unsigned *sleep_ms)
settings_t *settings = config_get_ptr();
unsigned max_users = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS));
retro_ctx.poll_cb();
if (runloop_frame_time.callback)
{
/* Updates frame timing if frame timing callback is in use by the core.
@ -2991,7 +2998,12 @@ int runloop_iterate(unsigned *sleep_ms)
frame_limit_last_time = 0.0;
command_event(CMD_EVENT_QUIT, NULL);
return -1;
case RUNLOOP_STATE_POLLED_AND_SLEEP:
runloop_netplay_pause();
*sleep_ms = 10;
return 1;
case RUNLOOP_STATE_SLEEP:
retro_ctx.poll_cb();
runloop_netplay_pause();
*sleep_ms = 10;
return 1;