diff --git a/src/BizHawk.Client.Common/movie/interfaces/ITasMovie.cs b/src/BizHawk.Client.Common/movie/interfaces/ITasMovie.cs index 2464384e87..4a55199063 100644 --- a/src/BizHawk.Client.Common/movie/interfaces/ITasMovie.cs +++ b/src/BizHawk.Client.Common/movie/interfaces/ITasMovie.cs @@ -11,8 +11,8 @@ namespace BizHawk.Client.Common IMovieChangeLog ChangeLog { get; } IStateManager TasStateManager { get; } - Func ClientSettingsForSave { get; set; } - Action GetClientSettingsOnLoad { get; set; } + Func InputRollSettingsForSave { get; set; } + string InputRollSettings { get; } ITasMovieRecord this[int index] { get; } ITasSession TasSession { get; } TasMovieMarkerList Markers { get; } diff --git a/src/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs b/src/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs index a8c4951729..5b5dc737a1 100644 --- a/src/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs +++ b/src/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Linq; using BizHawk.Common.StringExtensions; @@ -9,8 +9,8 @@ namespace BizHawk.Client.Common { internal partial class TasMovie { - public Func ClientSettingsForSave { get; set; } - public Action GetClientSettingsOnLoad { get; set; } + public Func InputRollSettingsForSave { get; set; } + public string InputRollSettings { get; private set; } protected override void AddLumps(ZipStateSaver bs, bool isBackup = false) { @@ -27,10 +27,10 @@ namespace BizHawk.Client.Common bs.PutLump(BinaryStateLump.LagLog, tw => LagLog.Save(tw)); bs.PutLump(BinaryStateLump.Markers, tw => tw.WriteLine(Markers.ToString())); - if (ClientSettingsForSave != null) + if (InputRollSettingsForSave != null) { - var clientSettingsJson = ClientSettingsForSave(); - bs.PutLump(BinaryStateLump.ClientSettings, (TextWriter tw) => tw.Write(clientSettingsJson)); + var inputRollSettingsJson = InputRollSettingsForSave(); + bs.PutLump(BinaryStateLump.ClientSettings, (TextWriter tw) => tw.Write(inputRollSettingsJson)); } if (VerificationLog.Any()) @@ -99,16 +99,13 @@ namespace BizHawk.Client.Common } }); - if (GetClientSettingsOnLoad != null) + bl.GetLump(BinaryStateLump.ClientSettings, abort: false, tr => { - bl.GetLump(BinaryStateLump.ClientSettings, abort: false, tr => - { - string clientSettings = tr.ReadToEnd(); + string inputRollSettings = tr.ReadToEnd(); - if (!string.IsNullOrEmpty(clientSettings)) - GetClientSettingsOnLoad(clientSettings); - }); - } + if (!string.IsNullOrEmpty(inputRollSettings)) + InputRollSettings = inputRollSettings; + }); bl.GetLump(BinaryStateLump.VerificationLog, abort: false, tr => { diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index 91b28e1e82..1cebee4957 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -331,12 +331,6 @@ namespace BizHawk.Client.EmuHawk } } - private void SetTasMovieCallbacks(ITasMovie movie) - { - movie.ClientSettingsForSave = () => TasView.UserSettingsSerialized(); - movie.GetClientSettingsOnLoad = json => TasView.LoadSettingsSerialized(json); - } - private static readonly string[] N64CButtonSuffixes = { " C Up", " C Down", " C Left", " C Right" }; private void SetUpColumns() @@ -574,7 +568,7 @@ namespace BizHawk.Client.EmuHawk { _initializing = true; - SetTasMovieCallbacks(movie); + movie.InputRollSettingsForSave = () => TasView.UserSettingsSerialized(); movie.BindMarkersToInput = Settings.BindMarkersToInput; movie.GreenzoneInvalidated = GreenzoneInvalidated; movie.PropertyChanged += TasMovie_OnPropertyChanged; @@ -590,6 +584,10 @@ namespace BizHawk.Client.EmuHawk MarkerControl.UpdateTextColumnWidth(); TastudioPlayMode(); UpdateWindowTitle(); + if (CurrentTasMovie.InputRollSettings != null) + { + TasView.LoadSettingsSerialized(CurrentTasMovie.InputRollSettings); + } } _initializing = false; @@ -615,14 +613,7 @@ namespace BizHawk.Client.EmuHawk } else { - var movie = MovieSession.Get(path, loadMovie: false); - // we can't load the movie yet, we need to set the callbacks first... - if (movie is ITasMovie pendingTasMovie) - { - SetTasMovieCallbacks(pendingTasMovie); - } - - movie.Load(); + var movie = MovieSession.Get(path, loadMovie: true); var tasMovie = movie as ITasMovie ?? movie.ToTasMovie(); movieLoadSucceeded = LoadMovie(tasMovie); }