Skip to content

Commit bf1930c

Browse files
committed
evict savestates on branch update
1 parent f20d09c commit bf1930c

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/BizHawk.Client.Common/movie/interfaces/ITasMovie.cs

+2
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,7 @@ public interface ITasMovie : IMovie, INotifyPropertyChanged, IDisposable
5353
void LoadBranch(TasBranch branch);
5454

5555
void CopyVerificationLog(IEnumerable<string> log);
56+
57+
bool IsReserved(int frame);
5658
}
5759
}

src/BizHawk.Client.Common/movie/tasproj/TasBranch.cs

+6
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ public void Replace(TasBranch old, TasBranch newBranch)
8787
newBranch.Uuid = old.Uuid;
8888
if (newBranch.UserText.Length is 0) newBranch.UserText = old.UserText;
8989
this[index] = newBranch;
90+
if (!_movie.IsReserved(old.Frame))
91+
_movie.TasStateManager.EvictReserved(old.Frame);
92+
9093
_movie.FlagChanges();
9194
}
9295

@@ -116,6 +119,9 @@ public void Replace(TasBranch old, TasBranch newBranch)
116119
var result = base.Remove(item);
117120
if (result)
118121
{
122+
if (!_movie.IsReserved(item!.Frame))
123+
_movie.TasStateManager.EvictReserved(item.Frame);
124+
119125
_movie.FlagChanges();
120126
}
121127

src/BizHawk.Client.Common/movie/tasproj/TasMovie.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ private void Markers_CollectionChanged(object sender, System.Collections.Special
340340
public void ClearChanges() => Changes = false;
341341
public void FlagChanges() => Changes = true;
342342

343-
private bool IsReserved(int frame)
343+
public bool IsReserved(int frame)
344344
{
345345
// Why the frame before?
346346
// because we always navigate to the frame before and emulate 1 frame so that we ensure a proper frame buffer on the screen

0 commit comments

Comments
 (0)