remove IStateManager.IsMarkerState

This commit is contained in:
adelikat 2019-06-15 16:17:49 -05:00
parent e89bb6c276
commit d79a00f035
3 changed files with 22 additions and 17 deletions

View File

@ -46,8 +46,6 @@ namespace BizHawk.Client.Common
int Last { get; }
bool IsMarkerState(int frame);
void UpdateStateFrequency();
/// <summary>
@ -60,6 +58,10 @@ namespace BizHawk.Client.Common
/// </summary>
int GetStateFrameByIndex(int index);
/// <summary>
/// Directly remove a state from the given frame, if it exists
/// Should only be called by pruning operations
/// </summary>
bool Remove(int frame);
}
}

View File

@ -79,15 +79,17 @@ namespace BizHawk.Client.Common
{
int currentFrame = _tsm.GetStateFrameByIndex(currentStateIndex);
if (_tsm.IsMarkerState(currentFrame))
if (_movie.Markers.IsMarker(currentFrame + 1))
{
continue;
}
else if (currentFrame + 1 == _movie.LastEditedFrame)
if (currentFrame + 1 == _movie.LastEditedFrame)
{
continue;
}
else if (currentFrame % _step > 0)
if (currentFrame % _step > 0)
{
// ignore the pattern if the state doesn't belong already, drop it blindly and skip everything
if (_tsm.Remove(currentFrame))
@ -124,11 +126,12 @@ namespace BizHawk.Client.Common
{
int currentFrame = _tsm.GetStateFrameByIndex(currentStateIndex);
if (_tsm.IsMarkerState(currentFrame))
if (_movie.Markers.IsMarker(currentFrame + 1))
{
continue;
}
else if ((currentFrame % _step > 0) && (currentFrame + 1 != _movie.LastEditedFrame))
if ((currentFrame % _step > 0) && (currentFrame + 1 != _movie.LastEditedFrame))
{
// ignore the pattern if the state doesn't belong already, drop it blindly and skip everything
if (_tsm.Remove(currentFrame))

View File

@ -198,16 +198,6 @@ namespace BizHawk.Client.Common
return anyInvalidated;
}
public bool IsMarkerState(int frame)
{
if (frame == -1)
{
return false;
}
return _movie.Markers.IsMarker(frame + 1);
}
public bool Remove(int frame)
{
int index = _states.IndexOfKey(frame);
@ -291,6 +281,16 @@ namespace BizHawk.Client.Common
return _states.Keys[index];
}
private bool IsMarkerState(int frame)
{
if (frame == -1)
{
return false;
}
return _movie.Markers.IsMarker(frame + 1);
}
private void SetState(int frame, byte[] state, bool skipRemoval = true)
{
if (!skipRemoval) // skipRemoval: false only when capturing new states