2014-01-11 15:05:41 +00:00
|
|
|
|
using System.Collections.Generic;
|
2013-12-01 20:55:52 +00:00
|
|
|
|
using System.Linq;
|
2013-12-07 01:50:52 +00:00
|
|
|
|
|
2013-12-01 20:55:52 +00:00
|
|
|
|
namespace BizHawk.Client.Common
|
|
|
|
|
{
|
2013-12-07 17:29:47 +00:00
|
|
|
|
public class MovieRecord
|
2013-12-01 20:55:52 +00:00
|
|
|
|
{
|
2013-12-09 17:24:32 +00:00
|
|
|
|
private byte[] _state = new byte[0];
|
2013-12-06 15:47:23 +00:00
|
|
|
|
|
2014-02-08 22:41:47 +00:00
|
|
|
|
public MovieRecord(string serializedInput, bool captureState)
|
2013-12-07 17:29:47 +00:00
|
|
|
|
{
|
2014-02-08 22:41:47 +00:00
|
|
|
|
SerializedInput = serializedInput;
|
2013-12-07 17:29:47 +00:00
|
|
|
|
if (captureState)
|
|
|
|
|
{
|
2013-12-14 20:32:00 +00:00
|
|
|
|
CaptureSate();
|
2013-12-07 17:29:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-08 22:41:47 +00:00
|
|
|
|
public string SerializedInput { get; private set; }
|
2013-12-01 20:55:52 +00:00
|
|
|
|
public bool Lagged { get; private set; }
|
2013-12-07 21:37:52 +00:00
|
|
|
|
|
2014-02-08 22:41:47 +00:00
|
|
|
|
public void ClearInput()
|
2013-12-07 21:37:52 +00:00
|
|
|
|
{
|
2014-02-08 22:41:47 +00:00
|
|
|
|
SerializedInput = string.Empty;
|
2013-12-07 21:37:52 +00:00
|
|
|
|
}
|
2013-12-07 01:50:52 +00:00
|
|
|
|
|
2014-02-08 22:41:47 +00:00
|
|
|
|
public void SetInput(string input)
|
2013-12-01 20:55:52 +00:00
|
|
|
|
{
|
2014-02-08 22:41:47 +00:00
|
|
|
|
SerializedInput = input ?? string.Empty;
|
2013-12-06 15:47:23 +00:00
|
|
|
|
}
|
2013-12-01 20:55:52 +00:00
|
|
|
|
|
2013-12-14 20:32:00 +00:00
|
|
|
|
public void CaptureSate()
|
|
|
|
|
{
|
|
|
|
|
Lagged = Global.Emulator.IsLagFrame;
|
2013-12-23 20:34:02 +00:00
|
|
|
|
_state = (byte[])Global.Emulator.SaveStateBinary().Clone();
|
2013-12-14 20:32:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-09 21:40:27 +00:00
|
|
|
|
public IEnumerable<byte> State
|
2013-12-09 17:24:32 +00:00
|
|
|
|
{
|
2013-12-09 21:40:27 +00:00
|
|
|
|
get { return _state; }
|
2013-12-09 17:24:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-06 15:47:23 +00:00
|
|
|
|
public bool HasState
|
|
|
|
|
{
|
2013-12-07 21:37:52 +00:00
|
|
|
|
get { return State.Any(); }
|
2013-12-03 01:43:02 +00:00
|
|
|
|
}
|
2013-12-09 21:40:27 +00:00
|
|
|
|
|
|
|
|
|
public void ClearState()
|
|
|
|
|
{
|
|
|
|
|
_state = new byte[0];
|
|
|
|
|
}
|
2013-12-01 20:55:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|