2017-05-24 23:36:34 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
using BizHawk.Common;
|
|
|
|
|
using BizHawk.Emulation.Common;
|
|
|
|
|
|
|
|
|
|
namespace BizHawk.Emulation.Cores.Atari.A7800Hawk
|
|
|
|
|
{
|
|
|
|
|
public partial class A7800Hawk : IStatable
|
|
|
|
|
{
|
|
|
|
|
public bool BinarySaveStatesPreferred => true;
|
|
|
|
|
|
|
|
|
|
public void SaveStateText(TextWriter writer)
|
|
|
|
|
{
|
|
|
|
|
SyncState(new Serializer(writer));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void LoadStateText(TextReader reader)
|
|
|
|
|
{
|
|
|
|
|
SyncState(new Serializer(reader));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SaveStateBinary(BinaryWriter bw)
|
|
|
|
|
{
|
|
|
|
|
SyncState(new Serializer(bw));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void LoadStateBinary(BinaryReader br)
|
|
|
|
|
{
|
|
|
|
|
SyncState(new Serializer(br));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public byte[] SaveStateBinary()
|
|
|
|
|
{
|
|
|
|
|
MemoryStream ms = new MemoryStream();
|
|
|
|
|
BinaryWriter bw = new BinaryWriter(ms);
|
|
|
|
|
SaveStateBinary(bw);
|
|
|
|
|
bw.Flush();
|
|
|
|
|
return ms.ToArray();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SyncState(Serializer ser)
|
|
|
|
|
{
|
|
|
|
|
byte[] core = null;
|
|
|
|
|
if (ser.IsWriter)
|
|
|
|
|
{
|
|
|
|
|
var ms = new MemoryStream();
|
|
|
|
|
ms.Close();
|
|
|
|
|
core = ms.ToArray();
|
|
|
|
|
}
|
2017-07-02 22:01:36 +00:00
|
|
|
|
cpu.SyncState(ser);
|
|
|
|
|
tia.SyncState(ser);
|
|
|
|
|
maria.SyncState(ser);
|
|
|
|
|
m6532.SyncState(ser);
|
2017-07-21 23:32:50 +00:00
|
|
|
|
mapper.SyncState(ser);
|
2017-05-24 23:36:34 +00:00
|
|
|
|
|
|
|
|
|
ser.BeginSection("Atari7800");
|
|
|
|
|
ser.Sync("core", ref core, false);
|
|
|
|
|
ser.Sync("Lag", ref _lagcount);
|
|
|
|
|
ser.Sync("Frame", ref _frame);
|
|
|
|
|
ser.Sync("IsLag", ref _islag);
|
2017-06-11 22:06:50 +00:00
|
|
|
|
_controllerDeck.SyncState(ser);
|
|
|
|
|
|
2017-07-05 20:14:27 +00:00
|
|
|
|
ser.Sync("A7800_control_register", ref A7800_control_register);
|
|
|
|
|
ser.Sync("_isPAL", ref _isPAL);
|
2017-08-25 15:28:19 +00:00
|
|
|
|
ser.Sync("_spf", ref _spf);
|
2017-07-02 22:01:36 +00:00
|
|
|
|
|
2017-07-05 20:14:27 +00:00
|
|
|
|
ser.Sync("Maria_regs", ref Maria_regs, false);
|
|
|
|
|
ser.Sync("RAM", ref RAM, false);
|
|
|
|
|
ser.Sync("RAM_6532", ref RAM_6532, false);
|
|
|
|
|
ser.Sync("hs_bios_mem", ref hs_bios_mem, false);
|
2017-07-02 22:01:36 +00:00
|
|
|
|
|
2017-07-05 20:14:27 +00:00
|
|
|
|
ser.Sync("cycle", ref cycle);
|
|
|
|
|
ser.Sync("cpu_cycle", ref cpu_cycle);
|
|
|
|
|
ser.Sync("cpu_is_haltable", ref cpu_is_haltable);
|
|
|
|
|
ser.Sync("cpu_is_halted", ref cpu_is_halted);
|
|
|
|
|
ser.Sync("cpu_halt_pending", ref cpu_halt_pending);
|
|
|
|
|
ser.Sync("cpu_resume_pending", ref cpu_resume_pending);
|
2017-07-02 22:01:36 +00:00
|
|
|
|
|
2017-07-05 20:14:27 +00:00
|
|
|
|
ser.Sync("slow_access", ref slow_access);
|
2017-07-25 15:30:53 +00:00
|
|
|
|
ser.Sync("slow_access", ref slow_countdown);
|
2017-07-21 20:33:45 +00:00
|
|
|
|
ser.Sync("small flag", ref small_flag);
|
|
|
|
|
ser.Sync("pal kara", ref PAL_Kara);
|
2017-07-22 16:28:23 +00:00
|
|
|
|
ser.Sync("Cart RAM", ref cart_RAM);
|
2017-08-25 14:21:10 +00:00
|
|
|
|
ser.Sync("is_pokey", ref is_pokey);
|
2017-07-22 16:28:23 +00:00
|
|
|
|
ser.Sync("left_toggle", ref left_toggle);
|
|
|
|
|
ser.Sync("right_toggle", ref right_toggle);
|
|
|
|
|
ser.Sync("left_was_pressed", ref left_was_pressed);
|
|
|
|
|
ser.Sync("right_was_pressed", ref right_was_pressed);
|
2017-07-02 22:01:36 +00:00
|
|
|
|
|
2017-07-22 16:28:23 +00:00
|
|
|
|
ser.EndSection();
|
2017-05-24 23:36:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|