From 863d022bc59171d3e193673222152144dea80343 Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 5 Jun 2020 20:10:20 -0500 Subject: [PATCH] fix an NRE I caused in movie code. The old code was wrong, this one is better --- src/BizHawk.Client.Common/movie/MovieSession.cs | 5 ++++- src/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/BizHawk.Client.Common/movie/MovieSession.cs b/src/BizHawk.Client.Common/movie/MovieSession.cs index 3f5b173e9e..15ae1a5f7a 100644 --- a/src/BizHawk.Client.Common/movie/MovieSession.cs +++ b/src/BizHawk.Client.Common/movie/MovieSession.cs @@ -267,6 +267,8 @@ namespace BizHawk.Client.Common { Movie.StartNewPlayback(); } + + MultiTrack.Restart(emulator.ControllerDefinition.PlayerCount); } public void ToggleMultitrack() @@ -310,6 +312,8 @@ namespace BizHawk.Client.Common message += "stopped."; + MultiTrack.Restart(1); + var result = Movie.Stop(saveChanges); if (result) { @@ -319,7 +323,6 @@ namespace BizHawk.Client.Common Output(message); ReadOnly = true; - MultiTrack.Restart(Movie.Emulator.ControllerDefinition.PlayerCount); _modeChangedCallback(); } diff --git a/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs b/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs index 9faae0a3d1..2f83fe5e62 100644 --- a/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs +++ b/src/BizHawk.Client.Common/movie/bk2/Bk2Movie.InputLog.cs @@ -39,7 +39,7 @@ namespace BizHawk.Client.Common int? stateFrame = null; // We are in record mode so replace the movie log with the one from the savestate - if (!Global.MovieSession.MultiTrack.IsActive) // TODO: this is run before being attached + if (!Session.MultiTrack.IsActive) { if (Global.Config.Movies.EnableBackupMovies && MakeBackup && Log.Count != 0) {