From e48e6c69f243c42ac7474a541e36bc1f8528ee93 Mon Sep 17 00:00:00 2001 From: CasualPokePlayer <50538166+CasualPokePlayer@users.noreply.github.com> Date: Thu, 4 Jul 2024 21:34:09 -0700 Subject: [PATCH] respect GreenZoneSettings.txt even if greenzone is missing; fix ClientSettings.json loading (probably regressed in 42aa9d991dc3dde03234a15ddfdc2efdebf1c097?) --- .../movie/tasproj/TasMovie.IO.cs | 20 ++++++++++++++++--- .../tools/TAStudio/TAStudio.cs | 8 +++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs b/src/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs index 70ee5ff6c6..83a4fb5687 100644 --- a/src/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs +++ b/src/BizHawk.Client.Common/movie/tasproj/TasMovie.IO.cs @@ -141,7 +141,7 @@ namespace BizHawk.Client.Common } }); - ZwinderStateManagerSettings settings = new ZwinderStateManagerSettings(); + var settings = new ZwinderStateManagerSettings(); bl.GetLump(BinaryStateLump.StateHistorySettings, abort: false, tr => { var json = tr.ReadToEnd(); @@ -155,11 +155,11 @@ namespace BizHawk.Client.Common } }); - bl.GetLump(BinaryStateLump.StateHistory, abort: false, br => + TasStateManager?.Dispose(); + var hasHistory = bl.GetLump(BinaryStateLump.StateHistory, abort: false, br => { try { - TasStateManager?.Dispose(); TasStateManager = ZwinderStateManager.Create(br, settings, IsReserved); } catch @@ -173,6 +173,20 @@ namespace BizHawk.Client.Common Session.PopupMessage("State history was corrupted, clearing and working with a fresh history."); } }); + + if (!hasHistory) + { + try + { + TasStateManager = new ZwinderStateManager(settings, IsReserved); + } + catch + { + TasStateManager = new ZwinderStateManager( + Session.Settings.DefaultTasStateManagerSettings, + IsReserved); + } + } } } } diff --git a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs index e07f4e71a4..43ef8ace9d 100644 --- a/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs +++ b/src/BizHawk.Client.EmuHawk/tools/TAStudio/TAStudio.cs @@ -668,8 +668,14 @@ namespace BizHawk.Client.EmuHawk } else { - var movie = MovieSession.Get(path, true); + 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 tasMovie = movie as ITasMovie ?? movie.ToTasMovie(); movieLoadSucceeded = LoadMovie(tasMovie); }