rename a StateManager method, and delete some unused methods
This commit is contained in:
parent
8f116a8428
commit
cb4e71ebf7
|
@ -37,6 +37,8 @@ namespace BizHawk.Client.Common
|
||||||
// TODO: rename to Last
|
// TODO: rename to Last
|
||||||
int LastStatedFrame { get; }
|
int LastStatedFrame { get; }
|
||||||
|
|
||||||
|
bool IsMarkerState(int frame);
|
||||||
|
|
||||||
// ********* Delete these **********
|
// ********* Delete these **********
|
||||||
void MountWriteAccess();
|
void MountWriteAccess();
|
||||||
|
|
||||||
|
@ -50,8 +52,6 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
bool RemoveState(int frame);
|
bool RemoveState(int frame);
|
||||||
|
|
||||||
bool StateIsMarker(int frame);
|
|
||||||
|
|
||||||
int StateCount { get; }
|
int StateCount { get; }
|
||||||
|
|
||||||
int GetStateIndexByFrame(int frame);
|
int GetStateIndexByFrame(int frame);
|
||||||
|
|
|
@ -78,7 +78,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
int currentFrame = _tsm.GetStateFrameByIndex(currentStateIndex);
|
int currentFrame = _tsm.GetStateFrameByIndex(currentStateIndex);
|
||||||
|
|
||||||
if (_tsm.StateIsMarker(currentFrame))
|
if (_tsm.IsMarkerState(currentFrame))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
int currentFrame = _tsm.GetStateFrameByIndex(currentStateIndex);
|
int currentFrame = _tsm.GetStateFrameByIndex(currentStateIndex);
|
||||||
|
|
||||||
if (_tsm.StateIsMarker(currentFrame))
|
if (_tsm.IsMarkerState(currentFrame))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ namespace BizHawk.Client.Common
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Requests that the current emulator state be captured
|
/// Requests that the current emulator state be captured
|
||||||
/// Unless force is true, the state may or may not be captured depending on the logic employed by "greenzone" management
|
/// Unless force is true, the state may or may not be captured depending on the logic employed by "green-zone" management
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Capture(bool force = false)
|
public void Capture(bool force = false)
|
||||||
{
|
{
|
||||||
|
@ -165,13 +165,13 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
shouldCapture = force;
|
shouldCapture = force;
|
||||||
}
|
}
|
||||||
else if (frame == 0) // For now, long term, TasMovie should have a .StartState property, and a tasproj file for the start state in non-savestate anchored movies
|
else if (frame == 0) // For now, long term, TasMovie should have a .StartState property, and a .tasproj file for the start state in non-savestate anchored movies
|
||||||
{
|
{
|
||||||
shouldCapture = true;
|
shouldCapture = true;
|
||||||
}
|
}
|
||||||
else if (StateIsMarker(frame))
|
else if (IsMarkerState(frame))
|
||||||
{
|
{
|
||||||
shouldCapture = true; // Markers shoudl always get priority
|
shouldCapture = true; // Markers should always get priority
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -184,18 +184,6 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MoveStateToDisk(int index)
|
|
||||||
{
|
|
||||||
Used -= (ulong)_states[index].Length;
|
|
||||||
_states[index].MoveToDisk();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MoveStateToMemory(int index)
|
|
||||||
{
|
|
||||||
_states[index].MoveToRAM();
|
|
||||||
Used += (ulong)_states[index].Length;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal void SetState(int frame, byte[] state, bool skipRemoval = true)
|
internal void SetState(int frame, byte[] state, bool skipRemoval = true)
|
||||||
{
|
{
|
||||||
if (!skipRemoval) // skipRemoval: false only when capturing new states
|
if (!skipRemoval) // skipRemoval: false only when capturing new states
|
||||||
|
@ -252,7 +240,7 @@ namespace BizHawk.Client.Common
|
||||||
return anyInvalidated;
|
return anyInvalidated;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool StateIsMarker(int frame)
|
public bool IsMarkerState(int frame)
|
||||||
{
|
{
|
||||||
if (frame == -1)
|
if (frame == -1)
|
||||||
{
|
{
|
||||||
|
@ -310,7 +298,7 @@ namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
int frame = GetStateFrameByIndex(i);
|
int frame = GetStateFrameByIndex(i);
|
||||||
|
|
||||||
if (StateIsMarker(frame) || frame % _fileStateGap < _stateFrequency)
|
if (IsMarkerState(frame) || frame % _fileStateGap < _stateFrequency)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -339,7 +327,7 @@ namespace BizHawk.Client.Common
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (StateIsMarker(GetStateFrameByIndex(index)));
|
while (IsMarkerState(GetStateFrameByIndex(index)));
|
||||||
|
|
||||||
if (index >= _states.Count)
|
if (index >= _states.Count)
|
||||||
{
|
{
|
||||||
|
@ -547,15 +535,5 @@ namespace BizHawk.Client.Common
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int FindState(StateManagerState s)
|
|
||||||
{
|
|
||||||
if (!_states.ContainsValue(s))
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return s.Frame;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue