From 51e1ee3a469ee7d587609d1218fda2d18d4f9ad8 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 13 Jun 2020 11:38:30 -0500 Subject: [PATCH] MovieSession - simplify and improve performance - remove unnecessary CopyController wrapper on MovieIn, and don't set movie controller state unless recording --- src/BizHawk.Client.Common/inputAdapters/InputManager.cs | 2 +- src/BizHawk.Client.Common/movie/MovieSession.cs | 5 ++--- src/BizHawk.Client.Common/movie/interfaces/IMovieSession.cs | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/BizHawk.Client.Common/inputAdapters/InputManager.cs b/src/BizHawk.Client.Common/inputAdapters/InputManager.cs index bfb90a948c..17987f6efa 100644 --- a/src/BizHawk.Client.Common/inputAdapters/InputManager.cs +++ b/src/BizHawk.Client.Common/inputAdapters/InputManager.cs @@ -68,7 +68,7 @@ namespace BizHawk.Client.Common StickyXorAdapter.Source = UdLRControllerAdapter; AutofireStickyXorAdapter.Source = StickyXorAdapter; - session.MovieIn.Source = AutofireStickyXorAdapter; + session.MovieIn = AutofireStickyXorAdapter; session.StickySource = AutofireStickyXorAdapter; ControllerOutput.Source = session.MovieOut; } diff --git a/src/BizHawk.Client.Common/movie/MovieSession.cs b/src/BizHawk.Client.Common/movie/MovieSession.cs index dad14e6444..64a00bb571 100644 --- a/src/BizHawk.Client.Common/movie/MovieSession.cs +++ b/src/BizHawk.Client.Common/movie/MovieSession.cs @@ -49,7 +49,7 @@ namespace BizHawk.Client.Common public bool NewMovieQueued => _queuedMovie != null; public string QueuedSyncSettings => _queuedMovie.SyncSettingsJson; - public IInputAdapter MovieIn { get; } = new CopyControllerAdapter(); + public IInputAdapter MovieIn { private get; set; } public IInputAdapter MovieOut { get; } = new CopyControllerAdapter(); public IStickyController StickySource { get; set; } @@ -318,7 +318,6 @@ namespace BizHawk.Client.Common private void LatchInputToUser() { MovieOut.Source = MovieIn; - MovieController.SetFrom(MovieIn); // TODO: this shouldn't be necessary anymore } // Latch input from the input log, if available @@ -385,7 +384,7 @@ namespace BizHawk.Client.Common } else { - LatchInputToUser(); + MovieController.SetFrom(MovieIn); } Movie.RecordFrame(Movie.Emulator.Frame, MovieController); diff --git a/src/BizHawk.Client.Common/movie/interfaces/IMovieSession.cs b/src/BizHawk.Client.Common/movie/interfaces/IMovieSession.cs index 6778d4d4e0..f83f202d52 100644 --- a/src/BizHawk.Client.Common/movie/interfaces/IMovieSession.cs +++ b/src/BizHawk.Client.Common/movie/interfaces/IMovieSession.cs @@ -32,7 +32,7 @@ namespace BizHawk.Client.Common /// the movie for the purpose of recording, if active, /// or to simply pass through if inactive /// - IInputAdapter MovieIn { get; } + IInputAdapter MovieIn { set; } /// /// Represents the movie input in the input chain