tsm decay: try to work around some more removal bugs

This commit is contained in:
vadosnaprimer 2019-04-18 19:11:27 +03:00
parent 6214de366b
commit 7915ec8bc1
1 changed files with 5 additions and 2 deletions

View File

@ -156,6 +156,8 @@ namespace BizHawk.Client.Common
backwardFrame = currentFrame;
}
}
int decayStatesLast = decayStates;
if (forwardFrame > -1 && backwardFrame > -1)
{
@ -192,10 +194,11 @@ namespace BizHawk.Client.Common
decayStates--;
}
}
else
{
// we're very sorry about failing to find states to remove, but we can't go beyond capacity, so remove at least something
// this shouldn't happen, but if we don't do it here, nothing good will happen either
if (decayStatesLast == decayStates)
{
if (_tsm.RemoveState(_tsm.GetStateFrameByIndex(1)))
{
// decrementing this if no state was removed is BAD