From 488cc94e77e98453a169bcb3f720d09ee9c1a7fb Mon Sep 17 00:00:00 2001 From: gocha Date: Sat, 11 Aug 2012 10:20:54 +0900 Subject: [PATCH] movie: add resetFunc() callback pointer to read_frame_controller_data, for future expansion. It might be useful to solve the movie reset desync problem, well, I'm not sure. --- movie.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/movie.cpp b/movie.cpp index 41e093d6..58b1a1dc 100644 --- a/movie.cpp +++ b/movie.cpp @@ -265,7 +265,7 @@ static void restore_movie_settings (void); static int bytes_per_sample (void); static void reserve_buffer_space (uint32); static void reset_controllers (void); -static void read_frame_controller_data (bool); +static void read_frame_controller_data (bool, void (*resetFunc)() = S9xSoftReset); static void write_frame_controller_data (void); static void flush_movie (void); static void truncate_movie (void); @@ -431,8 +431,13 @@ static void reset_controllers (void) } } -static void read_frame_controller_data (bool addFrame) +static void read_frame_controller_data (bool addFrame, void (*resetFunc)()) { + if (Movie.CurrentFrame >= Movie.MaxFrame || Movie.CurrentSample >= Movie.MaxSample) + { + return; + } + // reset code check if (Movie.InputBufferPtr[0] == 0xff) { @@ -449,7 +454,8 @@ static void read_frame_controller_data (bool addFrame) if (reset) { Movie.InputBufferPtr += Movie.BytesPerSample; - S9xSoftReset(); + if (resetFunc != (void(*)())NULL) + (*resetFunc)(); return; } }