commodore64: savestate code added (not connected yet, devices still need to report state)
This commit is contained in:
parent
54b3f28f7b
commit
a304b5666b
|
@ -94,6 +94,7 @@
|
||||||
<Compile Include="Computers\Commodore64\Input.cs" />
|
<Compile Include="Computers\Commodore64\Input.cs" />
|
||||||
<Compile Include="Computers\Commodore64\PRGFile.cs" />
|
<Compile Include="Computers\Commodore64\PRGFile.cs" />
|
||||||
<Compile Include="Computers\Commodore64\MemBus.cs" />
|
<Compile Include="Computers\Commodore64\MemBus.cs" />
|
||||||
|
<Compile Include="Computers\Commodore64\Savestate.cs" />
|
||||||
<Compile Include="Computers\Commodore64\SerialCable.cs" />
|
<Compile Include="Computers\Commodore64\SerialCable.cs" />
|
||||||
<Compile Include="Computers\Commodore64\Sid.cs" />
|
<Compile Include="Computers\Commodore64\Sid.cs" />
|
||||||
<Compile Include="Computers\Commodore64\SidEnvelopeGenerator.cs" />
|
<Compile Include="Computers\Commodore64\SidEnvelopeGenerator.cs" />
|
||||||
|
|
|
@ -35,10 +35,6 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
public VicIINew vic;
|
public VicIINew vic;
|
||||||
public ChipSignals signal;
|
public ChipSignals signal;
|
||||||
|
|
||||||
// sid stuff
|
|
||||||
//private Emulation.Sound.Utilities.DCFilter sidDCFilter;
|
|
||||||
//private SidSyncSoundProvider syncSid;
|
|
||||||
|
|
||||||
public bool DriveLED
|
public bool DriveLED
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -37,16 +37,6 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
private IList<MemoryDomain> memoryDomains;
|
private IList<MemoryDomain> memoryDomains;
|
||||||
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
|
public IList<MemoryDomain> 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
|
// running state
|
||||||
public bool DeterministicEmulation { get { return true; } set { ; } }
|
public bool DeterministicEmulation { get { return true; } set { ; } }
|
||||||
public int Frame { get { return _frame; } set { _frame = value; } }
|
public int Frame { get { return _frame; } set { _frame = value; } }
|
||||||
|
|
|
@ -138,6 +138,14 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
ClearHooks();
|
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()
|
protected virtual byte ReadData0()
|
||||||
{
|
{
|
||||||
byte result;
|
byte result;
|
||||||
|
|
|
@ -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<string, StateParameters> paramList = new Dictionary<string, StateParameters>();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class StateParameters
|
||||||
|
{
|
||||||
|
private Dictionary<string, int> integerList = new Dictionary<string, int>();
|
||||||
|
private Dictionary<string, string> stringList = new Dictionary<string, string>();
|
||||||
|
|
||||||
|
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<string, int> kv in integerList)
|
||||||
|
{
|
||||||
|
writer.Write(kv.Key);
|
||||||
|
writer.Write(kv.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.Write((Int32)stringList.Count);
|
||||||
|
foreach (KeyValuePair<string, string> kv in stringList)
|
||||||
|
{
|
||||||
|
writer.Write(kv.Key);
|
||||||
|
writer.Write(kv.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.Flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ExportText(Stream target)
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
foreach (KeyValuePair<string, int> kv in integerList)
|
||||||
|
{
|
||||||
|
sb.Append("i" + kv.Key + "=");
|
||||||
|
sb.AppendLine(kv.Value.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (KeyValuePair<string, string> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -201,7 +201,6 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Connect(DataPortConnector connector, int index)
|
public void Connect(DataPortConnector connector, int index)
|
||||||
|
|
|
@ -454,6 +454,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
PipelineCycle,
|
PipelineCycle,
|
||||||
PipelineIRQ0,
|
PipelineIRQ0,
|
||||||
PipelineFetchSprite3P,
|
PipelineFetchSprite3P,
|
||||||
|
PipelineBadlineDelay,
|
||||||
PipelineRender
|
PipelineRender
|
||||||
},
|
},
|
||||||
new Action[]
|
new Action[]
|
||||||
|
@ -461,6 +462,7 @@ namespace BizHawk.Emulation.Computers.Commodore64
|
||||||
PipelineCycle,
|
PipelineCycle,
|
||||||
PipelineIRQ1,
|
PipelineIRQ1,
|
||||||
PipelineFetchSprite3S,
|
PipelineFetchSprite3S,
|
||||||
|
PipelineBadlineDelay,
|
||||||
PipelineRender
|
PipelineRender
|
||||||
},
|
},
|
||||||
new Action[]
|
new Action[]
|
||||||
|
|
Loading…
Reference in New Issue