diff --git a/BizHawk.Client.Common/movie/MovieSession.cs b/BizHawk.Client.Common/movie/MovieSession.cs index 0f4a2e0e89..2eee27d1c9 100644 --- a/BizHawk.Client.Common/movie/MovieSession.cs +++ b/BizHawk.Client.Common/movie/MovieSession.cs @@ -248,48 +248,60 @@ namespace BizHawk.Client.Common { LatchInputFromLog(); - // Movie may go into finished mode as a result from latching - if (!Movie.IsFinished) + if (Movie.IsRecording) // The movie end situation can cause the switch to record mode, in that case we need to capture some input for this frame { - if (Global.ClientControls["Scrub Input"]) + HandleFrameLoopForRecordMode(); + } + else + { + // Movie may go into finished mode as a result from latching + if (!Movie.IsFinished) { - LatchInputFromPlayer(Global.MovieInputSourceAdapter); - ClearFrame(); - } - else if (Global.Config.MoviePlaybackPokeMode) - { - LatchInputFromPlayer(Global.MovieInputSourceAdapter); - var lg = Movie.LogGeneratorInstance(); - lg.SetSource(Global.MovieOutputHardpoint); - if (!lg.IsEmpty) + if (Global.ClientControls["Scrub Input"]) { LatchInputFromPlayer(Global.MovieInputSourceAdapter); - Movie.PokeFrame(Global.Emulator.Frame, Global.MovieOutputHardpoint); + ClearFrame(); } - else + else if (Global.Config.MoviePlaybackPokeMode) { - LatchInputFromLog(); + LatchInputFromPlayer(Global.MovieInputSourceAdapter); + var lg = Movie.LogGeneratorInstance(); + lg.SetSource(Global.MovieOutputHardpoint); + if (!lg.IsEmpty) + { + LatchInputFromPlayer(Global.MovieInputSourceAdapter); + Movie.PokeFrame(Global.Emulator.Frame, Global.MovieOutputHardpoint); + } + else + { + LatchInputFromLog(); + } } } } } else if (Movie.IsRecording) { - if (MultiTrack.IsActive) - { - LatchMultitrackPlayerInput(Global.MovieInputSourceAdapter, Global.MultitrackRewiringAdapter); - } - else - { - LatchInputFromPlayer(Global.MovieInputSourceAdapter); - } - - // the movie session makes sure that the correct input has been read and merged to its MovieControllerAdapter; - // this has been wired to Global.MovieOutputHardpoint in RewireInputChain - Movie.RecordFrame(Global.Emulator.Frame, Global.MovieOutputHardpoint); + HandleFrameLoopForRecordMode(); } } + private void HandleFrameLoopForRecordMode() + { + if (MultiTrack.IsActive) + { + LatchMultitrackPlayerInput(Global.MovieInputSourceAdapter, Global.MultitrackRewiringAdapter); + } + else + { + LatchInputFromPlayer(Global.MovieInputSourceAdapter); + } + + // the movie session makes sure that the correct input has been read and merged to its MovieControllerAdapter; + // this has been wired to Global.MovieOutputHardpoint in RewireInputChain + Movie.RecordFrame(Global.Emulator.Frame, Global.MovieOutputHardpoint); + } + public bool HandleMovieLoadState(string path) { using (var sr = new StreamReader(path))