Tastudio - Fix some erroneous StateManager logic

This commit is contained in:
adelikat 2014-09-22 22:52:34 +00:00
parent 7a1fe8d51d
commit ea3f86c11e
3 changed files with 15 additions and 7 deletions

View File

@ -21,7 +21,6 @@ namespace BizHawk.Client.Common
LagLog.Add(Global.Emulator.IsLagFrame);
StateManager.Invalidate(frame);
StateManager.Capture();
}

View File

@ -123,11 +123,20 @@ namespace BizHawk.Client.Common
if (States.Count > 0 && frame > 0) // Never invalidate frame 0, TODO: Only if movie is a power-on movie should we keep frame 0, check this
{
// TODO be more efficient, this could get slow
while (LastKey >= frame)
//while (LastKey >= frame)
//{
// var state = States[LastKey];
// Used -= state.Length;
// States.RemoveAt(States.Count - 1);
//}
var statesToRemove = States
.Where(x => x.Key >= frame)
.ToList();
foreach (var state in statesToRemove)
{
var state = States[LastKey];
Used -= state.Length;
States.RemoveAt(States.Count - 1);
Used -= state.Value.Length;
States.Remove(state.Key);
}
}
}

View File

@ -233,7 +233,7 @@ namespace BizHawk.Client.EmuHawk
{
_startFrameDrag = true;
}
else//User changed input
else // User changed input
{
var frame = TasView.CurrentCell.RowIndex.Value;
var buttonName = TasView.CurrentCell.Column.Name;
@ -242,7 +242,7 @@ namespace BizHawk.Client.EmuHawk
{
ToggleBoolState(TasView.CurrentCell.RowIndex.Value, buttonName);
GoToLastEmulatedFrameIfNecessary(TasView.CurrentCell.RowIndex.Value);
TasView.Refresh();
UpdateValues();
_startBoolDrawColumn = buttonName;