REmove RUNLOOP_CTL_CHECK_IDLE_STATE

This commit is contained in:
twinaphex 2016-05-15 10:14:23 +02:00
parent 73cc9c4b15
commit a9c959b7e5
2 changed files with 53 additions and 50 deletions

View File

@ -586,6 +586,54 @@ static bool rarch_game_specific_options(char **output)
return true;
}
static bool runloop_is_focused(void)
{
settings_t *settings = config_get_ptr();
if (settings->pause_nonactive)
return video_driver_is_focused();
return true;
}
static bool runloop_check_pause_state(event_cmd_state_t *cmd)
{
bool check_is_oneshot = false;
if (!cmd)
return false;
check_is_oneshot = runloop_cmd_triggered(cmd,
RARCH_FRAMEADVANCE)
|| runloop_cmd_press(cmd, RARCH_REWIND);
if (!runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL))
return true;
if (runloop_cmd_triggered(cmd, RARCH_FULLSCREEN_TOGGLE_KEY))
{
command_event(CMD_EVENT_FULLSCREEN_TOGGLE, NULL);
video_driver_cached_frame_render();
}
if (!check_is_oneshot)
return false;
return true;
}
static bool runloop_check_idle_state(event_cmd_state_t *cmd)
{
settings_t *settings = config_get_ptr();
bool focused = runloop_is_focused();
runloop_check_pause(settings, focused,
runloop_cmd_triggered(cmd, RARCH_PAUSE_TOGGLE),
runloop_cmd_triggered(cmd, RARCH_FRAMEADVANCE));
if (!runloop_check_pause_state(cmd) || !focused)
return false;
return true;
}
static bool runloop_check_state(event_cmd_state_t *cmd, rarch_dir_list_t *shader_dir)
{
bool tmp = false;
@ -622,7 +670,7 @@ static bool runloop_check_state(event_cmd_state_t *cmd, rarch_dir_list_t *shader
tmp = runloop_cmd_triggered(cmd, RARCH_FULLSCREEN_TOGGLE_KEY);
netplay_driver_ctl(RARCH_NETPLAY_CTL_FULLSCREEN_TOGGLE, &tmp);
#endif
if (!runloop_ctl(RUNLOOP_CTL_CHECK_IDLE_STATE, cmd))
if (!runloop_check_idle_state(cmd))
return false;
runloop_check_fast_forward_button(
@ -673,44 +721,11 @@ static bool runloop_check_state(event_cmd_state_t *cmd, rarch_dir_list_t *shader
return true;
}
static bool runloop_check_pause_state(event_cmd_state_t *cmd)
{
bool check_is_oneshot = false;
if (!cmd)
return false;
check_is_oneshot = runloop_cmd_triggered(cmd,
RARCH_FRAMEADVANCE)
|| runloop_cmd_press(cmd, RARCH_REWIND);
if (!runloop_ctl(RUNLOOP_CTL_IS_PAUSED, NULL))
return true;
if (runloop_cmd_triggered(cmd, RARCH_FULLSCREEN_TOGGLE_KEY))
{
command_event(CMD_EVENT_FULLSCREEN_TOGGLE, NULL);
video_driver_cached_frame_render();
}
if (!check_is_oneshot)
return false;
return true;
}
void runloop_iterate_data(void)
{
task_queue_ctl(TASK_QUEUE_CTL_CHECK, NULL);
}
static bool runloop_is_focused(void)
{
settings_t *settings = config_get_ptr();
if (settings->pause_nonactive)
return video_driver_is_focused();
return true;
}
static bool runloop_is_frame_count_end(void)
{
@ -740,6 +755,7 @@ bool runloop_prepare_dummy(void)
return true;
}
bool runloop_ctl(enum runloop_ctl_state state, void *data)
{
settings_t *settings = config_get_ptr();
@ -936,19 +952,6 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
strlcpy(runloop_fullpath, fullpath, sizeof(runloop_fullpath));
}
break;
case RUNLOOP_CTL_CHECK_IDLE_STATE:
{
event_cmd_state_t *cmd = (event_cmd_state_t*)data;
bool focused = runloop_is_focused();
runloop_check_pause(settings, focused,
runloop_cmd_triggered(cmd, RARCH_PAUSE_TOGGLE),
runloop_cmd_triggered(cmd, RARCH_FRAMEADVANCE));
if (!runloop_check_pause_state(cmd) || !focused)
return false;
}
break;
case RUNLOOP_CTL_FRAME_TIME_FREE:
memset(&runloop_frame_time, 0, sizeof(struct retro_frame_time_callback));
runloop_frame_time_last = 0;

View File

@ -49,7 +49,6 @@ enum runloop_ctl_state
RUNLOOP_CTL_IS_NONBLOCK_FORCED,
RUNLOOP_CTL_SET_NONBLOCK_FORCED,
RUNLOOP_CTL_UNSET_NONBLOCK_FORCED,
RUNLOOP_CTL_CHECK_IDLE_STATE,
RUNLOOP_CTL_GET_CONTENT_PATH,
RUNLOOP_CTL_SET_CONTENT_PATH,
RUNLOOP_CTL_CLEAR_CONTENT_PATH,
@ -81,13 +80,12 @@ enum runloop_ctl_state
/* Initializes message queue. */
RUNLOOP_CTL_MSG_QUEUE_INIT,
/* Deinitializes message queue. */
RUNLOOP_CTL_MSG_QUEUE_DEINIT,
RUNLOOP_CTL_MSG_QUEUE_FREE,
RUNLOOP_CTL_MSG_QUEUE_PULL,
RUNLOOP_CTL_MSG_QUEUE_CLEAR,
RUNLOOP_CTL_HAS_CORE_OPTIONS,
RUNLOOP_CTL_GET_CORE_OPTION_SIZE,
RUNLOOP_CTL_IS_CORE_OPTION_UPDATED,
@ -98,8 +96,10 @@ enum runloop_ctl_state
RUNLOOP_CTL_CORE_OPTIONS_INIT,
RUNLOOP_CTL_CORE_OPTIONS_DEINIT,
RUNLOOP_CTL_CORE_OPTIONS_FREE,
RUNLOOP_CTL_SHADER_DIR_DEINIT,
RUNLOOP_CTL_SHADER_DIR_INIT,
RUNLOOP_CTL_SYSTEM_INFO_GET,
RUNLOOP_CTL_SYSTEM_INFO_INIT,
RUNLOOP_CTL_SYSTEM_INFO_FREE