2015-03-21 21:45:12 +00:00
|
|
|
|
using BizHawk.Emulation.Common;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace BizHawk.Emulation.Cores.Computers.AppleII
|
|
|
|
|
{
|
|
|
|
|
public partial class AppleII : IStatable
|
|
|
|
|
{
|
|
|
|
|
public bool BinarySaveStatesPreferred { get { return true; } }
|
|
|
|
|
|
|
|
|
|
[FeatureNotImplemented]
|
|
|
|
|
public void SaveStateText(TextWriter writer)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[FeatureNotImplemented]
|
|
|
|
|
public void LoadStateText(TextReader reader)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SaveStateBinary(BinaryWriter writer)
|
|
|
|
|
{
|
2015-04-25 13:14:12 +00:00
|
|
|
|
writer.Write(Frame);
|
2015-04-26 12:40:21 +00:00
|
|
|
|
writer.Write(LagCount);
|
|
|
|
|
writer.Write(IsLagFrame);
|
2015-04-12 23:38:19 +00:00
|
|
|
|
writer.Write(CurrentDisk);
|
2015-03-21 21:45:12 +00:00
|
|
|
|
_machine.SaveState(writer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void LoadStateBinary(BinaryReader reader)
|
|
|
|
|
{
|
2015-04-25 13:14:12 +00:00
|
|
|
|
Frame = reader.ReadInt32();
|
2015-04-26 12:40:21 +00:00
|
|
|
|
LagCount = reader.ReadInt32();
|
|
|
|
|
IsLagFrame = reader.ReadBoolean();
|
2015-04-12 23:38:19 +00:00
|
|
|
|
CurrentDisk = reader.ReadInt32();
|
|
|
|
|
InitDisk();
|
2015-03-21 21:45:12 +00:00
|
|
|
|
_machine.LoadState(reader);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public byte[] SaveStateBinary()
|
|
|
|
|
{
|
|
|
|
|
if (_stateBuffer == null)
|
|
|
|
|
{
|
|
|
|
|
var stream = new MemoryStream();
|
|
|
|
|
var writer = new BinaryWriter(stream);
|
|
|
|
|
SaveStateBinary(writer);
|
|
|
|
|
_stateBuffer = stream.ToArray();
|
|
|
|
|
writer.Close();
|
|
|
|
|
return _stateBuffer;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var stream = new MemoryStream(_stateBuffer);
|
|
|
|
|
var writer = new BinaryWriter(stream);
|
|
|
|
|
SaveStateBinary(writer);
|
|
|
|
|
writer.Close();
|
|
|
|
|
return _stateBuffer;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private byte[] _stateBuffer;
|
|
|
|
|
}
|
|
|
|
|
}
|