From d349ea61cfcb1fa2ee32aa8d10af9893792e1aa8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 6 May 2017 18:11:18 +0200 Subject: [PATCH] Create bsv_movie_end_of_file --- movie.c | 7 +++++-- movie.h | 3 ++- runloop.c | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/movie.c b/movie.c index 4a5ff86a85..f79c53bbf4 100644 --- a/movie.c +++ b/movie.c @@ -390,6 +390,11 @@ bool bsv_movie_is_playback_off(void) return bsv_movie_state_handle && !bsv_movie_state.movie_playback; } +bool bsv_movie_is_end_of_file(void) +{ + return bsv_movie_state.movie_end && bsv_movie_state.eof_exit; +} + bool bsv_movie_ctl(enum bsv_ctl_state state, void *data) { switch (state) @@ -415,8 +420,6 @@ bool bsv_movie_ctl(enum bsv_ctl_state state, void *data) case BSV_MOVIE_CTL_SET_END_EOF: bsv_movie_state.eof_exit = true; break; - case BSV_MOVIE_CTL_END_EOF: - return bsv_movie_state.movie_end && bsv_movie_state.eof_exit; case BSV_MOVIE_CTL_SET_END: bsv_movie_state.movie_end = true; break; diff --git a/movie.h b/movie.h index 45b78c4dcd..b6744ec608 100644 --- a/movie.h +++ b/movie.h @@ -55,7 +55,6 @@ enum bsv_ctl_state BSV_MOVIE_CTL_FRAME_REWIND, BSV_MOVIE_CTL_DEINIT, BSV_MOVIE_CTL_INIT, - BSV_MOVIE_CTL_END_EOF, BSV_MOVIE_CTL_SET_END_EOF, BSV_MOVIE_CTL_SET_END, BSV_MOVIE_CTL_UNSET_END @@ -75,6 +74,8 @@ void bsv_movie_set_frame_end(void); bool bsv_movie_get_input(int16_t *bsv_data); +bool bsv_movie_is_end_of_file(void); + bool bsv_movie_ctl(enum bsv_ctl_state state, void *data); bool bsv_movie_check(void); diff --git a/runloop.c b/runloop.c index 5056fbf553..a949967756 100644 --- a/runloop.c +++ b/runloop.c @@ -672,7 +672,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data) * d) Video driver no longer alive. * e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better) */ -#define time_to_exit(quit_key_pressed) (runloop_shutdown_initiated || quit_key_pressed || !is_alive || bsv_movie_ctl(BSV_MOVIE_CTL_END_EOF, NULL) || (runloop_max_frames && (frame_count >= runloop_max_frames)) || runloop_exec) +#define time_to_exit(quit_key_pressed) (runloop_shutdown_initiated || quit_key_pressed || !is_alive || bsv_movie_is_end_of_file() || (runloop_max_frames && (frame_count >= runloop_max_frames)) || runloop_exec) #define runloop_check_cheevos() (settings->bools.cheevos_enable && cheevos_loaded && (!cheats_are_enabled && !cheats_were_enabled))