Tastudio - tweak rerecord counting to what was probably intended, only increment rerecord count on Invalidate() if Invalidate() actually invalidated any states

This commit is contained in:
adelikat 2015-08-04 20:24:49 -04:00
parent 64126fbad3
commit 07fddd31d7
2 changed files with 14 additions and 3 deletions

View File

@ -176,9 +176,13 @@ namespace BizHawk.Client.Common
private void InvalidateAfter(int frame)
{
LagLog.RemoveFrom(frame);
StateManager.Invalidate(frame + 1);
var anyInvalidated = StateManager.Invalidate(frame + 1);
Changes = true; // TODO check if this actually removed anything before flagging changes
base.Rerecords++;
if (anyInvalidated)
{
base.Rerecords++;
}
}
/// <summary>

View File

@ -322,8 +322,10 @@ namespace BizHawk.Client.Common
/// <summary>
/// Clears out all savestates after the given frame number
/// </summary>
public void Invalidate(int frame)
public bool Invalidate(int frame)
{
bool anyInvalidated = false;
if (Any())
{
if (!_movie.StartsFromSavestate && frame == 0) // Never invalidate frame 0 on a non-savestate-anchored movie
@ -334,6 +336,9 @@ namespace BizHawk.Client.Common
var statesToRemove = States
.Where(x => x.Key >= frame)
.ToList();
anyInvalidated = statesToRemove.Any();
foreach (var state in statesToRemove)
{
if (state.Value == null)
@ -346,6 +351,8 @@ namespace BizHawk.Client.Common
CallInvalidateCallback(frame);
}
return anyInvalidated;
}
/// <summary>