evict savestates on branch update

This commit is contained in:
Morilli 2025-04-12 23:55:12 +02:00
parent f20d09c8c1
commit bf1930c3ff
3 changed files with 9 additions and 1 deletions

View File

@ -53,5 +53,7 @@ namespace BizHawk.Client.Common
void LoadBranch(TasBranch branch);
void CopyVerificationLog(IEnumerable<string> log);
bool IsReserved(int frame);
}
}

View File

@ -87,6 +87,9 @@ namespace BizHawk.Client.Common
newBranch.Uuid = old.Uuid;
if (newBranch.UserText.Length is 0) newBranch.UserText = old.UserText;
this[index] = newBranch;
if (!_movie.IsReserved(old.Frame))
_movie.TasStateManager.EvictReserved(old.Frame);
_movie.FlagChanges();
}
@ -116,6 +119,9 @@ namespace BizHawk.Client.Common
var result = base.Remove(item);
if (result)
{
if (!_movie.IsReserved(item!.Frame))
_movie.TasStateManager.EvictReserved(item.Frame);
_movie.FlagChanges();
}

View File

@ -340,7 +340,7 @@ namespace BizHawk.Client.Common
public void ClearChanges() => Changes = false;
public void FlagChanges() => Changes = true;
private bool IsReserved(int frame)
public bool IsReserved(int frame)
{
// Why the frame before?
// because we always navigate to the frame before and emulate 1 frame so that we ensure a proper frame buffer on the screen