diff --git a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj
index 9904254733..31682556b2 100644
--- a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj
+++ b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj
@@ -165,6 +165,9 @@
Atari2600.cs
+
+ Atari2600.cs
+
Atari2600.cs
@@ -216,6 +219,9 @@
Atari7800.cs
+
+ Atari7800.cs
+
Atari7800.cs
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IStatable.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IStatable.cs
new file mode 100644
index 0000000000..5a0aa50693
--- /dev/null
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.IStatable.cs
@@ -0,0 +1,61 @@
+using System.IO;
+
+using BizHawk.Common;
+using BizHawk.Emulation.Common;
+
+namespace BizHawk.Emulation.Cores.Atari.Atari2600
+{
+ public partial class Atari2600 : IStatable
+ {
+ public bool BinarySaveStatesPreferred
+ {
+ get { return false; }
+ }
+
+ public void SaveStateText(TextWriter writer)
+ {
+ SyncState(Serializer.CreateTextWriter(writer));
+ }
+
+ public void LoadStateText(TextReader reader)
+ {
+ SyncState(Serializer.CreateTextReader(reader));
+ }
+
+ public void SaveStateBinary(BinaryWriter bw)
+ {
+ SyncState(Serializer.CreateBinaryWriter(bw));
+ }
+
+ public void LoadStateBinary(BinaryReader br)
+ {
+ SyncState(Serializer.CreateBinaryReader(br));
+ }
+
+ public byte[] SaveStateBinary()
+ {
+ var ms = new MemoryStream();
+ var bw = new BinaryWriter(ms);
+ SaveStateBinary(bw);
+ bw.Flush();
+ return ms.ToArray();
+ }
+
+ private void SyncState(Serializer ser)
+ {
+ ser.BeginSection("A2600");
+ Cpu.SyncState(ser);
+ ser.Sync("ram", ref this.Ram, false);
+ ser.Sync("Lag", ref _lagcount);
+ ser.Sync("Frame", ref _frame);
+ ser.Sync("IsLag", ref _islag);
+ ser.Sync("frameStartPending", ref _frameStartPending);
+ _tia.SyncState(ser);
+ M6532.SyncState(ser);
+ ser.BeginSection("Mapper");
+ _mapper.SyncState(ser);
+ ser.EndSection();
+ ser.EndSection();
+ }
+ }
+}
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs
index 4e804341b7..5f36600ee1 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/2600/Atari2600.cs
@@ -75,8 +75,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
public bool DeterministicEmulation { get; set; }
- public bool BinarySaveStatesPreferred { get { return false; } }
-
public A2600Settings Settings { get; private set; }
public A2600SyncSettings SyncSettings { get; private set; }
@@ -120,8 +118,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
};
}
-
-
public bool StartAsyncSound() { return true; }
public void EndAsyncSound() { }
@@ -133,52 +129,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
_islag = false;
}
- private void SyncState(Serializer ser)
- {
- ser.BeginSection("A2600");
- Cpu.SyncState(ser);
- ser.Sync("ram", ref this.Ram, false);
- ser.Sync("Lag", ref _lagcount);
- ser.Sync("Frame", ref _frame);
- ser.Sync("IsLag", ref _islag);
- ser.Sync("frameStartPending", ref _frameStartPending);
- _tia.SyncState(ser);
- M6532.SyncState(ser);
- ser.BeginSection("Mapper");
- _mapper.SyncState(ser);
- ser.EndSection();
- ser.EndSection();
- }
-
- public void SaveStateText(TextWriter writer)
- {
- SyncState(Serializer.CreateTextWriter(writer));
- }
-
- public void LoadStateText(TextReader reader)
- {
- SyncState(Serializer.CreateTextReader(reader));
- }
-
- public void SaveStateBinary(BinaryWriter bw)
- {
- SyncState(Serializer.CreateBinaryWriter(bw));
- }
-
- public void LoadStateBinary(BinaryReader br)
- {
- SyncState(Serializer.CreateBinaryReader(br));
- }
-
- public byte[] SaveStateBinary()
- {
- var ms = new MemoryStream();
- var bw = new BinaryWriter(ms);
- SaveStateBinary(bw);
- bw.Flush();
- return ms.ToArray();
- }
-
public void Dispose() { }
private static bool DetectPal(GameInfo game, byte[] rom)
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.IStatable.cs b/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.IStatable.cs
new file mode 100644
index 0000000000..d3da96efca
--- /dev/null
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.IStatable.cs
@@ -0,0 +1,66 @@
+using System.IO;
+
+using BizHawk.Common;
+using BizHawk.Emulation.Common;
+using EMU7800.Core;
+
+namespace BizHawk.Emulation.Cores.Atari.Atari7800
+{
+ public partial class Atari7800 : IStatable
+ {
+ public bool BinarySaveStatesPreferred { get { return 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();
+ theMachine.Serialize(new BinaryWriter(ms));
+ ms.Close();
+ core = ms.ToArray();
+ }
+
+ ser.BeginSection("Atari7800");
+ ser.Sync("core", ref core, false);
+ ser.Sync("Lag", ref _lagcount);
+ ser.Sync("Frame", ref _frame);
+ ser.Sync("IsLag", ref _islag);
+ ser.EndSection();
+ if (ser.IsReader)
+ {
+ theMachine = MachineBase.Deserialize(new BinaryReader(new MemoryStream(core, false)));
+ avProvider.ConnectToMachine(theMachine, GameInfo);
+ }
+ }
+ }
+}
diff --git a/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs b/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs
index fb089b9d06..53d41d67a1 100644
--- a/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Atari/7800/Atari7800.cs
@@ -87,7 +87,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
}
}
-
public void ResetCounters()
{
_frame = 0;
@@ -95,46 +94,6 @@ namespace BizHawk.Emulation.Cores.Atari.Atari7800
_islag = false;
}
- #region savestates
- 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();
- }
-
- public bool BinarySaveStatesPreferred { get { return true; } }
-
- void SyncState(Serializer ser)
- {
- byte[] core = null;
- if (ser.IsWriter)
- {
- var ms = new MemoryStream();
- theMachine.Serialize(new BinaryWriter(ms));
- ms.Close();
- core = ms.ToArray();
- }
- ser.BeginSection("Atari7800");
- ser.Sync("core", ref core, false);
- ser.Sync("Lag", ref _lagcount);
- ser.Sync("Frame", ref _frame);
- ser.Sync("IsLag", ref _islag);
- ser.EndSection();
- if (ser.IsReader)
- {
- theMachine = MachineBase.Deserialize(new BinaryReader(new MemoryStream(core, false)));
- avProvider.ConnectToMachine(theMachine, GameInfo);
- }
- }
- #endregion
-
public Atari7800Control ControlAdapter;
public ControllerDefinition ControllerDefinition { get; private set; }