From 76d637822811a3fa434b305ddda6f673f185e3ad Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 23 Nov 2015 15:01:49 +0100 Subject: [PATCH] Go through video_driver_ctl --- gfx/video_driver.c | 2 ++ gfx/video_driver.h | 1 + runloop.c | 15 ++++++--------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gfx/video_driver.c b/gfx/video_driver.c index da63f2c29d..a6b417b119 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -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: diff --git a/gfx/video_driver.h b/gfx/video_driver.h index f3846cf76c..27ef3df810 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -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, diff --git a/runloop.c b/runloop.c index 4d3f6193af..d48123633a 100644 --- a/runloop.c +++ b/runloop.c @@ -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;