Tastudio - more go to frame stuff

This commit is contained in:
adelikat 2014-08-30 00:40:53 +00:00
parent 21ab01817f
commit e6d6dc7e51
2 changed files with 20 additions and 0 deletions

View File

@ -298,6 +298,14 @@ namespace BizHawk.Client.Common
} }
} }
/// <summary>
/// For the given frame, returns a savestate that is that frame or before it, as close as possible to it
/// </summary>
public byte[] GetStateClosestToFrame(int frame)
{
return StateManager.GetStateClosestToFrame(frame);
}
/// <summary> /// <summary>
/// Captures the current frame into the greenzone /// Captures the current frame into the greenzone
/// </summary> /// </summary>

View File

@ -74,6 +74,14 @@ namespace BizHawk.Client.Common
{ {
shouldCapture = force; shouldCapture = force;
} }
else if (Global.Emulator.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 (_movie.Markers.IsMarker(Global.Emulator.Frame))
{
shouldCapture = true; // Markers shoudl always get priority
}
else else
{ {
shouldCapture = Global.Emulator.Frame % 2 > 0; shouldCapture = Global.Emulator.Frame % 2 > 0;
@ -157,6 +165,10 @@ namespace BizHawk.Client.Common
} }
} }
public byte[] GetStateClosestToFrame(int frame)
{
return States.LastOrDefault(state => state.Key < frame).Value;
}
// Map: // Map:
// 4 bytes - total savestate count // 4 bytes - total savestate count