Go through video_driver_ctl

This commit is contained in:
twinaphex 2015-11-23 15:01:49 +01:00
parent 60fec26bcf
commit 76d6378228
3 changed files with 9 additions and 9 deletions

View File

@ -1532,6 +1532,8 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
return (video_state.frame_cache.data == RETRO_HW_FRAME_BUFFER_VALID);
case RARCH_DISPLAY_CTL_CACHED_FRAME_RENDER:
return video_driver_cached_frame(driver);
case RARCH_DISPLAY_CTL_IS_ALIVE:
return video->alive(driver->video_data);
case RARCH_DISPLAY_CTL_IS_FOCUSED:
return video->focus(driver->video_data);
case RARCH_DISPLAY_CTL_HAS_WINDOWED:

View File

@ -300,6 +300,7 @@ enum rarch_display_ctl_state
RARCH_DISPLAY_CTL_GET_NEXT_VIDEO_OUT,
RARCH_DISPLAY_CTL_HAS_WINDOWED,
RARCH_DISPLAY_CTL_IS_FOCUSED,
RARCH_DISPLAY_CTL_IS_ALIVE,
RARCH_DISPLAY_CTL_SET_ASPECT_RATIO,
/* Sets viewport to aspect ratio set by core. */
RARCH_DISPLAY_CTL_SET_VIEWPORT_CORE,

View File

@ -66,21 +66,19 @@ static retro_time_t frame_limit_minimum_time;
*
* Returns: true if libretro pause key was toggled, otherwise false.
**/
static bool check_pause(driver_t *driver, settings_t *settings,
static bool check_pause(settings_t *settings,
bool pause_pressed, bool frameadvance_pressed)
{
static bool old_focus = true;
bool focus = true;
enum event_command cmd = EVENT_CMD_NONE;
bool old_is_paused = main_is_paused;
const video_driver_t *video = driver ?
(const video_driver_t*)driver->current_video : NULL;
/* FRAMEADVANCE will set us into pause mode. */
pause_pressed |= !main_is_paused && frameadvance_pressed;
if (settings->pause_nonactive)
focus = video->focus(driver->video_data);
focus = video_driver_ctl(RARCH_DISPLAY_CTL_IS_FOCUSED, NULL);
if (focus && pause_pressed)
cmd = EVENT_CMD_PAUSE_TOGGLE;
@ -386,7 +384,7 @@ bool rarch_main_ctl(enum rarch_main_ctl_state state, void *data)
}
#endif
check_pause(driver, settings,
check_pause(settings,
cmd->pause_pressed, cmd->frameadvance_pressed);
if (!rarch_main_ctl(RARCH_MAIN_CTL_CHECK_PAUSE_STATE, cmd))
@ -869,13 +867,10 @@ static void rarch_main_cmd_get_state(driver_t *driver,
static INLINE int rarch_main_iterate_time_to_exit(event_cmd_state_t *cmd)
{
uint64_t *frame_count = NULL;
settings_t *settings = config_get_ptr();
global_t *global = global_get_ptr();
driver_t *driver = driver_get_ptr();
rarch_system_info_t *system = rarch_system_info_get_ptr();
video_driver_t *video = driver ? (video_driver_t*)driver->current_video : NULL;
bool shutdown_pressed = (system && system->shutdown) || cmd->quit_key_pressed;
bool video_alive = video && video->alive(driver->video_data);
bool video_alive = video_driver_ctl(RARCH_DISPLAY_CTL_IS_ALIVE, NULL);
bool movie_end = (global->bsv.movie_end && global->bsv.eof_exit);
bool frame_count_end = false;
@ -884,6 +879,8 @@ static INLINE int rarch_main_iterate_time_to_exit(event_cmd_state_t *cmd)
if (shutdown_pressed || frame_count_end || movie_end || !video_alive || global->exec)
{
settings_t *settings = config_get_ptr();
if (global->exec)
global->exec = false;