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
BizHawk.Client.Common/movie/tasproj

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>
/// Captures the current frame into the greenzone
/// </summary>

View File

@ -74,6 +74,14 @@ namespace BizHawk.Client.Common
{
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
{
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:
// 4 bytes - total savestate count