diff --git a/BizHawk.Emulation/BizHawk.Emulation.csproj b/BizHawk.Emulation/BizHawk.Emulation.csproj
index 0365d14c0b..02c5015e4d 100644
--- a/BizHawk.Emulation/BizHawk.Emulation.csproj
+++ b/BizHawk.Emulation/BizHawk.Emulation.csproj
@@ -94,6 +94,7 @@
+
diff --git a/BizHawk.Emulation/Computers/Commodore64/C64.core.cs b/BizHawk.Emulation/Computers/Commodore64/C64.core.cs
index 8b526d629a..e97ac2bbd8 100644
--- a/BizHawk.Emulation/Computers/Commodore64/C64.core.cs
+++ b/BizHawk.Emulation/Computers/Commodore64/C64.core.cs
@@ -35,10 +35,6 @@ namespace BizHawk.Emulation.Computers.Commodore64
public VicIINew vic;
public ChipSignals signal;
- // sid stuff
- //private Emulation.Sound.Utilities.DCFilter sidDCFilter;
- //private SidSyncSoundProvider syncSid;
-
public bool DriveLED
{
get
diff --git a/BizHawk.Emulation/Computers/Commodore64/C64.cs b/BizHawk.Emulation/Computers/Commodore64/C64.cs
index 435c5c1ad4..88e5b612b3 100644
--- a/BizHawk.Emulation/Computers/Commodore64/C64.cs
+++ b/BizHawk.Emulation/Computers/Commodore64/C64.cs
@@ -37,16 +37,6 @@ namespace BizHawk.Emulation.Computers.Commodore64
private IList memoryDomains;
public IList MemoryDomains { get { return memoryDomains; } }
- // save state/ram
- public void ClearSaveRam() { }
- public void LoadStateBinary(BinaryReader br) { }
- public void LoadStateText(TextReader reader) { }
- public byte[] ReadSaveRam() { return null; }
- public bool SaveRamModified { get; set; }
- public void SaveStateBinary(BinaryWriter bw) { }
- public void SaveStateText(TextWriter writer) { }
- public void StoreSaveRam(byte[] data) { }
-
// running state
public bool DeterministicEmulation { get { return true; } set { ; } }
public int Frame { get { return _frame; } set { _frame = value; } }
diff --git a/BizHawk.Emulation/Computers/Commodore64/DataPort.cs b/BizHawk.Emulation/Computers/Commodore64/DataPort.cs
index d1d9f8e8b8..a03c4c4181 100644
--- a/BizHawk.Emulation/Computers/Commodore64/DataPort.cs
+++ b/BizHawk.Emulation/Computers/Commodore64/DataPort.cs
@@ -138,6 +138,14 @@ namespace BizHawk.Emulation.Computers.Commodore64
ClearHooks();
}
+ public void LoadState(byte direction0, byte direction1, byte latch0, byte latch1)
+ {
+ direction[0] = direction0;
+ direction[1] = direction1;
+ latch[0] = latch0;
+ latch[1] = latch1;
+ }
+
protected virtual byte ReadData0()
{
byte result;
diff --git a/BizHawk.Emulation/Computers/Commodore64/Savestate.cs b/BizHawk.Emulation/Computers/Commodore64/Savestate.cs
new file mode 100644
index 0000000000..c7b5683623
--- /dev/null
+++ b/BizHawk.Emulation/Computers/Commodore64/Savestate.cs
@@ -0,0 +1,179 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace BizHawk.Emulation.Computers.Commodore64
+{
+ public partial class C64 : IEmulator
+ {
+ public void ClearSaveRam()
+ {
+ }
+ public void LoadStateBinary(BinaryReader br)
+ {
+ }
+ public void LoadStateText(TextReader reader)
+ {
+ }
+ public byte[] ReadSaveRam()
+ {
+ return null;
+ }
+ public bool SaveRamModified
+ {
+ get;
+ set;
+ }
+ public void SaveStateBinary(BinaryWriter bw)
+ {
+ }
+ public void SaveStateText(TextWriter writer)
+ {
+ }
+ public void StoreSaveRam(byte[] data)
+ {
+ }
+ }
+
+ public class State
+ {
+ private Dictionary paramList = new Dictionary();
+
+
+ }
+
+ public class StateParameters
+ {
+ private Dictionary integerList = new Dictionary();
+ private Dictionary stringList = new Dictionary();
+
+ public int this[string key]
+ {
+ get
+ {
+ if (integerList.ContainsKey(key))
+ {
+ return integerList[key];
+ }
+ return 0;
+ }
+ set
+ {
+ integerList[key] = value;
+ }
+ }
+
+ public string this[string key]
+ {
+ get
+ {
+ if (stringList.ContainsKey(key))
+ {
+ return stringList[key];
+ }
+ return "";
+ }
+ set
+ {
+ stringList[key] = value;
+ }
+ }
+
+ public void ExportBinary(Stream target)
+ {
+ BinaryWriter writer = new BinaryWriter(target);
+
+ writer.Write((Int32)integerList.Count);
+ foreach (KeyValuePair kv in integerList)
+ {
+ writer.Write(kv.Key);
+ writer.Write(kv.Value);
+ }
+
+ writer.Write((Int32)stringList.Count);
+ foreach (KeyValuePair kv in stringList)
+ {
+ writer.Write(kv.Key);
+ writer.Write(kv.Value);
+ }
+
+ writer.Flush();
+ }
+
+ public void ExportText(Stream target)
+ {
+ StringBuilder sb = new StringBuilder();
+
+ foreach (KeyValuePair kv in integerList)
+ {
+ sb.Append("i" + kv.Key + "=");
+ sb.AppendLine(kv.Value.ToString());
+ }
+
+ foreach (KeyValuePair kv in stringList)
+ {
+ sb.Append("s" + kv.Key + "=");
+ sb.AppendLine(kv.Value.ToString());
+ }
+
+ StreamWriter writer = new StreamWriter(target);
+ writer.Write(sb.ToString());
+ writer.Flush();
+ }
+
+ public void ImportBinary(Stream source)
+ {
+ BinaryReader reader = new BinaryReader(source);
+
+ int count = reader.ReadInt32();
+ for (int i = 0; i < count; i++)
+ {
+ string key = reader.ReadString();
+ int val = reader.ReadInt32();
+ integerList[key] = val;
+ }
+
+ count = reader.ReadInt32();
+ for (int i = 0; i < count; i++)
+ {
+ string key = reader.ReadString();
+ string val = reader.ReadString();
+ stringList[key] = val;
+ }
+ }
+
+ public void ImportText(Stream source)
+ {
+ StreamReader reader = new StreamReader(source);
+
+ while (!reader.EndOfStream)
+ {
+ string line = reader.ReadLine();
+ int equalsIndex = line.IndexOf("=");
+
+ if (equalsIndex >= 0 && equalsIndex < (line.Length - 1))
+ {
+ string key = line.Substring(0, equalsIndex - 1);
+ string val = line.Substring(equalsIndex + 1);
+
+ if (val.Length > 0 && key.Length > 0)
+ {
+ string valType = val.Substring(0, 1);
+ val = val.Substring(1);
+ switch (valType)
+ {
+ case @"i":
+ integerList[key] = int.Parse(val);
+ break;
+ case @"s":
+ stringList[key] = val;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/BizHawk.Emulation/Computers/Commodore64/Via.cs b/BizHawk.Emulation/Computers/Commodore64/Via.cs
index 59f5d2b4e9..98bf66cf8d 100644
--- a/BizHawk.Emulation/Computers/Commodore64/Via.cs
+++ b/BizHawk.Emulation/Computers/Commodore64/Via.cs
@@ -201,7 +201,6 @@ namespace BizHawk.Emulation.Computers.Commodore64
break;
}
}
-
}
public void Connect(DataPortConnector connector, int index)
diff --git a/BizHawk.Emulation/Computers/Commodore64/VicIINewPipeline.cs b/BizHawk.Emulation/Computers/Commodore64/VicIINewPipeline.cs
index 95142866e4..e6ea7e1554 100644
--- a/BizHawk.Emulation/Computers/Commodore64/VicIINewPipeline.cs
+++ b/BizHawk.Emulation/Computers/Commodore64/VicIINewPipeline.cs
@@ -454,6 +454,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
PipelineCycle,
PipelineIRQ0,
PipelineFetchSprite3P,
+ PipelineBadlineDelay,
PipelineRender
},
new Action[]
@@ -461,6 +462,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
PipelineCycle,
PipelineIRQ1,
PipelineFetchSprite3S,
+ PipelineBadlineDelay,
PipelineRender
},
new Action[]