From eaef1f3829742db259c912d9cfa5106ded3de14b Mon Sep 17 00:00:00 2001 From: Morilli <35152647+Morilli@users.noreply.github.com> Date: Thu, 26 Sep 2024 21:02:26 +0200 Subject: [PATCH] Fix display issue in TAStudio when <3 frames are visible also left a giant TODO, not sure what else to do about it --- src/BizHawk.Client.Common/movie/tasproj/TasMovie.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/BizHawk.Client.Common/movie/tasproj/TasMovie.cs b/src/BizHawk.Client.Common/movie/tasproj/TasMovie.cs index 26f9279015..1bac723f7c 100644 --- a/src/BizHawk.Client.Common/movie/tasproj/TasMovie.cs +++ b/src/BizHawk.Client.Common/movie/tasproj/TasMovie.cs @@ -139,7 +139,7 @@ namespace BizHawk.Client.Common public void InvalidateEntireGreenzone() => InvalidateAfter(0); - private (int Frame, IMovieController Controller) _displayCache = (-1, new Bk2Controller(NullController.Instance.Definition)); + private (int Frame, IMovieController Controller) _displayCache = (-1, null); /// /// Returns the mnemonic value for boolean buttons, and actual value for axes, @@ -147,7 +147,11 @@ namespace BizHawk.Client.Common /// public string DisplayValue(int frame, string buttonName) { - if (_displayCache.Frame != frame) + // TODO: there are display issues in TAStudio when less than 3 frames are visible + // this is because the Bk2Controller returned from GetInputState is a shared object and mutated elsewhere (like the OSDManager), + // but it's getting cached here. this "works" in the >= 2 frames case because the _displayCache.Frame != frame condition + // will invalidate the cache. Can we do this properly somehow? + if (_displayCache.Frame != frame || FrameCount < 3) { _displayCache = (frame, GetInputState(frame)); }