Pass TasMovie into StateManagerDecay and have it get the last edited frame instead of from IStateManager
This commit is contained in:
parent
3c27a332bb
commit
8f116a8428
|
@ -50,7 +50,6 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
bool RemoveState(int frame);
|
bool RemoveState(int frame);
|
||||||
|
|
||||||
int LastEditedFrame { get; }
|
|
||||||
bool StateIsMarker(int frame);
|
bool StateIsMarker(int frame);
|
||||||
|
|
||||||
int StateCount { get; }
|
int StateCount { get; }
|
||||||
|
|
|
@ -44,7 +44,9 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
internal class StateManagerDecay
|
internal class StateManagerDecay
|
||||||
{
|
{
|
||||||
private readonly IStateManager _tsm; // access tsm methods to make life easier
|
private readonly TasMovie _movie;
|
||||||
|
private readonly IStateManager _tsm;
|
||||||
|
|
||||||
private List<int> _zeros; // amount of least significant zeros in bitwise view (also max pattern step)
|
private List<int> _zeros; // amount of least significant zeros in bitwise view (also max pattern step)
|
||||||
private int _bits; // size of _zeros is 2 raised to the power of _bits
|
private int _bits; // size of _zeros is 2 raised to the power of _bits
|
||||||
private int _mask; // for remainder calculation using bitwise instead of division
|
private int _mask; // for remainder calculation using bitwise instead of division
|
||||||
|
@ -53,8 +55,9 @@ namespace BizHawk.Client.Common
|
||||||
private int _step; // initial memory state gap
|
private int _step; // initial memory state gap
|
||||||
private bool _align; // extra care about fine alignment. TODO: do we want it?
|
private bool _align; // extra care about fine alignment. TODO: do we want it?
|
||||||
|
|
||||||
public StateManagerDecay(IStateManager tsm)
|
public StateManagerDecay(TasMovie movie, IStateManager tsm)
|
||||||
{
|
{
|
||||||
|
_movie = movie;
|
||||||
_tsm = tsm;
|
_tsm = tsm;
|
||||||
_align = false;
|
_align = false;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +82,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (currentFrame + 1 == _tsm.LastEditedFrame)
|
else if (currentFrame + 1 == _movie.LastEditedFrame)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -124,7 +127,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if ((currentFrame % _step > 0) && (currentFrame + 1 != _tsm.LastEditedFrame))
|
else if ((currentFrame % _step > 0) && (currentFrame + 1 != _movie.LastEditedFrame))
|
||||||
{
|
{
|
||||||
// ignore the pattern if the state doesn't belong already, drop it blindly and skip everything
|
// ignore the pattern if the state doesn't belong already, drop it blindly and skip everything
|
||||||
if (_tsm.RemoveState(currentFrame))
|
if (_tsm.RemoveState(currentFrame))
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace BizHawk.Client.Common
|
||||||
SetState(0, _movie.BinarySavestate);
|
SetState(0, _movie.BinarySavestate);
|
||||||
}
|
}
|
||||||
|
|
||||||
_decay = new StateManagerDecay(this);
|
_decay = new StateManagerDecay(_movie, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
@ -511,7 +511,6 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
|
|
||||||
public int StateCount => _states.Count;
|
public int StateCount => _states.Count;
|
||||||
public int LastEditedFrame => _movie.LastEditedFrame;
|
|
||||||
|
|
||||||
public bool Any()
|
public bool Any()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue