rename a StateManager method, and delete some unused methods

This commit is contained in:
adelikat 2019-06-15 14:40:18 -05:00
parent 8f116a8428
commit cb4e71ebf7
3 changed files with 11 additions and 33 deletions

View File

@ -37,6 +37,8 @@ namespace BizHawk.Client.Common
// TODO: rename to Last
int LastStatedFrame { get; }
bool IsMarkerState(int frame);
// ********* Delete these **********
void MountWriteAccess();
@ -50,8 +52,6 @@ namespace BizHawk.Client.Common
bool RemoveState(int frame);
bool StateIsMarker(int frame);
int StateCount { get; }
int GetStateIndexByFrame(int frame);

View File

@ -78,7 +78,7 @@ namespace BizHawk.Client.Common
{
int currentFrame = _tsm.GetStateFrameByIndex(currentStateIndex);
if (_tsm.StateIsMarker(currentFrame))
if (_tsm.IsMarkerState(currentFrame))
{
continue;
}
@ -123,7 +123,7 @@ namespace BizHawk.Client.Common
{
int currentFrame = _tsm.GetStateFrameByIndex(currentStateIndex);
if (_tsm.StateIsMarker(currentFrame))
if (_tsm.IsMarkerState(currentFrame))
{
continue;
}

View File

@ -150,7 +150,7 @@ namespace BizHawk.Client.Common
/// <summary>
/// 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>
public void Capture(bool force = false)
{
@ -165,13 +165,13 @@ namespace BizHawk.Client.Common
{
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;
}
else if (StateIsMarker(frame))
else if (IsMarkerState(frame))
{
shouldCapture = true; // Markers shoudl always get priority
shouldCapture = true; // Markers should always get priority
}
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)
{
if (!skipRemoval) // skipRemoval: false only when capturing new states
@ -252,7 +240,7 @@ namespace BizHawk.Client.Common
return anyInvalidated;
}
public bool StateIsMarker(int frame)
public bool IsMarkerState(int frame)
{
if (frame == -1)
{
@ -310,7 +298,7 @@ namespace BizHawk.Client.Common
{
int frame = GetStateFrameByIndex(i);
if (StateIsMarker(frame) || frame % _fileStateGap < _stateFrequency)
if (IsMarkerState(frame) || frame % _fileStateGap < _stateFrequency)
{
continue;
}
@ -339,7 +327,7 @@ namespace BizHawk.Client.Common
break;
}
}
while (StateIsMarker(GetStateFrameByIndex(index)));
while (IsMarkerState(GetStateFrameByIndex(index)));
if (index >= _states.Count)
{
@ -547,15 +535,5 @@ namespace BizHawk.Client.Common
return 0;
}
}
private int FindState(StateManagerState s)
{
if (!_states.ContainsValue(s))
{
return -1;
}
return s.Frame;
}
}
}