Reimplement FLUSH_INPUT

This commit is contained in:
twinaphex 2014-09-25 04:58:26 +02:00
parent aa6d779fbc
commit eec0724175
3 changed files with 7 additions and 6 deletions

View File

@ -484,6 +484,7 @@ typedef struct driver
unsigned block_hotkey_until;
bool block_input;
bool block_libretro_input;
unsigned block_libretro_input_until;
bool nonblock_state;
/* Opaque handles to currently running window.

View File

@ -181,8 +181,11 @@ static int16_t input_state(unsigned port, unsigned device,
g_settings.input.binds[15],
};
if (!driver.block_libretro_input && (id < RARCH_FIRST_META_KEY ||
device == RETRO_DEVICE_KEYBOARD))
if (!driver.block_libretro_input &&
((id < RARCH_FIRST_META_KEY ||
device == RETRO_DEVICE_KEYBOARD) &&
(g_extern.frame_count > driver.block_libretro_input_until))
)
res = driver.input->input_state(driver.input_data, binds, port,
device, index, id);

View File

@ -2866,10 +2866,7 @@ void rarch_main_set_state(unsigned cmd)
rarch_main_set_state(RARCH_ACTION_STATE_QUIT);
break;
case RARCH_ACTION_STATE_FLUSH_INPUT:
driver.retro_ctx.poll_cb();
#ifdef HAVE_MENU
menu_input();
#endif
driver.block_libretro_input_until = g_extern.frame_count + (5);
/* Restore libretro keyboard callback. */
g_extern.system.key_event = g_extern.frontend_key_event;
break;