From b5b1e1785172850ad28a73f2743b64cb868fff30 Mon Sep 17 00:00:00 2001 From: SuuperW Date: Sun, 20 Dec 2020 18:06:50 -0600 Subject: [PATCH] Fix eviction logic for _gapFiller. (we were attempting to remove the wrong value from StateCache, and also weren't checking for reserved) --- .../movie/tasproj/ZwinderStateManager.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/BizHawk.Client.Common/movie/tasproj/ZwinderStateManager.cs b/src/BizHawk.Client.Common/movie/tasproj/ZwinderStateManager.cs index ea1c68e9b7..bc52ce4686 100644 --- a/src/BizHawk.Client.Common/movie/tasproj/ZwinderStateManager.cs +++ b/src/BizHawk.Client.Common/movie/tasproj/ZwinderStateManager.cs @@ -389,7 +389,17 @@ namespace BizHawk.Client.Common AddStateCache(frame); source.SaveStateBinary(new BinaryWriter(s)); }, - index => StateCache.Remove(index)); + index => + { + var state = _gapFiller.GetState(index); + StateCache.Remove(state.Frame); + + if (_reserveCallback(state.Frame)) + { + AddToReserved(state); + return; + } + }); } public void Clear()