Move input code to runloop_check_state
This commit is contained in:
parent
954b95cc81
commit
08521a02ba
57
retroarch.c
57
retroarch.c
|
@ -2243,11 +2243,10 @@ bool runloop_msg_queue_pull(const char **ret)
|
||||||
|
|
||||||
static enum runloop_state runloop_check_state(
|
static enum runloop_state runloop_check_state(
|
||||||
settings_t *settings,
|
settings_t *settings,
|
||||||
uint64_t current_input,
|
|
||||||
bool input_nonblock_state,
|
bool input_nonblock_state,
|
||||||
bool menu_is_alive,
|
|
||||||
unsigned *sleep_ms)
|
unsigned *sleep_ms)
|
||||||
{
|
{
|
||||||
|
static uint64_t last_input = 0;
|
||||||
static bool old_fs_toggle_pressed= false;
|
static bool old_fs_toggle_pressed= false;
|
||||||
static bool old_focus = true;
|
static bool old_focus = true;
|
||||||
bool is_focused = false;
|
bool is_focused = false;
|
||||||
|
@ -2256,12 +2255,36 @@ static enum runloop_state runloop_check_state(
|
||||||
bool focused = true;
|
bool focused = true;
|
||||||
bool pause_nonactive = settings->bools.pause_nonactive;
|
bool pause_nonactive = settings->bools.pause_nonactive;
|
||||||
bool fs_toggle_triggered = false;
|
bool fs_toggle_triggered = false;
|
||||||
|
#ifdef HAVE_MENU
|
||||||
|
bool menu_is_alive = menu_driver_is_alive();
|
||||||
|
uint64_t current_input =
|
||||||
|
menu_is_alive ?
|
||||||
|
input_menu_keys_pressed(settings, last_input) :
|
||||||
|
input_keys_pressed(settings, last_input);
|
||||||
|
#else
|
||||||
|
uint64_t current_input =
|
||||||
|
input_keys_pressed(settings, last_input);
|
||||||
|
#endif
|
||||||
|
last_input = current_input;
|
||||||
|
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
bool menu_driver_binding_state = menu_driver_is_binding_state();
|
bool menu_driver_binding_state = menu_driver_is_binding_state();
|
||||||
if (menu_driver_binding_state)
|
if (menu_driver_binding_state)
|
||||||
current_input = 0;
|
current_input = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (input_driver_flushing_input)
|
||||||
|
{
|
||||||
|
input_driver_flushing_input = false;
|
||||||
|
if (current_input)
|
||||||
|
{
|
||||||
|
current_input = 0;
|
||||||
|
if (runloop_paused)
|
||||||
|
BIT64_SET(current_input, RARCH_PAUSE_TOGGLE);
|
||||||
|
input_driver_flushing_input = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
video_driver_get_status(&frame_count, &is_alive, &is_focused);
|
video_driver_get_status(&frame_count, &is_alive, &is_focused);
|
||||||
|
|
||||||
#ifdef HAVE_OVERLAY
|
#ifdef HAVE_OVERLAY
|
||||||
|
@ -2866,39 +2889,11 @@ int runloop_iterate(unsigned *sleep_ms)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
bool input_nonblock_state = input_driver_is_nonblock_state();
|
bool input_nonblock_state = input_driver_is_nonblock_state();
|
||||||
static uint64_t last_input = 0;
|
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
#ifdef HAVE_MENU
|
|
||||||
bool menu_is_alive = menu_driver_is_alive();
|
|
||||||
#else
|
|
||||||
bool menu_is_alive = false;
|
|
||||||
#endif
|
|
||||||
unsigned max_users = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS));
|
unsigned max_users = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS));
|
||||||
uint64_t current_input = 0;
|
|
||||||
|
|
||||||
retro_ctx.poll_cb();
|
retro_ctx.poll_cb();
|
||||||
|
|
||||||
current_input =
|
|
||||||
#ifdef HAVE_MENU
|
|
||||||
menu_is_alive ?
|
|
||||||
input_menu_keys_pressed(settings, last_input) :
|
|
||||||
#endif
|
|
||||||
input_keys_pressed(settings, last_input);
|
|
||||||
|
|
||||||
last_input = current_input;
|
|
||||||
|
|
||||||
if (input_driver_flushing_input)
|
|
||||||
{
|
|
||||||
input_driver_flushing_input = false;
|
|
||||||
if (current_input)
|
|
||||||
{
|
|
||||||
current_input = 0;
|
|
||||||
if (runloop_paused)
|
|
||||||
BIT64_SET(current_input, RARCH_PAUSE_TOGGLE);
|
|
||||||
input_driver_flushing_input = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (runloop_frame_time.callback)
|
if (runloop_frame_time.callback)
|
||||||
{
|
{
|
||||||
/* Updates frame timing if frame timing callback is in use by the core.
|
/* Updates frame timing if frame timing callback is in use by the core.
|
||||||
|
@ -2928,9 +2923,7 @@ int runloop_iterate(unsigned *sleep_ms)
|
||||||
switch ((enum runloop_state)
|
switch ((enum runloop_state)
|
||||||
runloop_check_state(
|
runloop_check_state(
|
||||||
settings,
|
settings,
|
||||||
current_input,
|
|
||||||
input_nonblock_state,
|
input_nonblock_state,
|
||||||
menu_is_alive,
|
|
||||||
sleep_ms))
|
sleep_ms))
|
||||||
{
|
{
|
||||||
case RUNLOOP_STATE_QUIT:
|
case RUNLOOP_STATE_QUIT:
|
||||||
|
|
Loading…
Reference in New Issue