Intellivision - stubs for savestate logic
This commit is contained in:
parent
da2d15341f
commit
e9d1af2b0c
|
@ -404,7 +404,9 @@
|
||||||
<Compile Include="Consoles\Intellivision\Controllers\IntellivisionControllerDeck.cs" />
|
<Compile Include="Consoles\Intellivision\Controllers\IntellivisionControllerDeck.cs" />
|
||||||
<Compile Include="Consoles\Intellivision\ICart.cs" />
|
<Compile Include="Consoles\Intellivision\ICart.cs" />
|
||||||
<Compile Include="Consoles\Intellivision\Intellicart.cs" />
|
<Compile Include="Consoles\Intellivision\Intellicart.cs" />
|
||||||
<Compile Include="Consoles\Intellivision\Intellivision.ISettable.cs" />
|
<Compile Include="Consoles\Intellivision\Intellivision.ISettable.cs">
|
||||||
|
<DependentUpon>Intellivision.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Consoles\Intellivision\Controllers\IntellivisionControllers.cs" />
|
<Compile Include="Consoles\Intellivision\Controllers\IntellivisionControllers.cs" />
|
||||||
<Compile Include="Consoles\Intellivision\Intellivision.cs" />
|
<Compile Include="Consoles\Intellivision\Intellivision.cs" />
|
||||||
<Compile Include="Consoles\Intellivision\Intellivision.IEmulator.cs">
|
<Compile Include="Consoles\Intellivision\Intellivision.IEmulator.cs">
|
||||||
|
@ -413,6 +415,9 @@
|
||||||
<Compile Include="Consoles\Intellivision\Intellivision.IMemoryDomains.cs">
|
<Compile Include="Consoles\Intellivision\Intellivision.IMemoryDomains.cs">
|
||||||
<DependentUpon>Intellivision.cs</DependentUpon>
|
<DependentUpon>Intellivision.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Consoles\Intellivision\Intellivision.IStatable.cs">
|
||||||
|
<DependentUpon>Intellivision.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Consoles\Intellivision\Intellivision.MemoryMap.cs">
|
<Compile Include="Consoles\Intellivision\Intellivision.MemoryMap.cs">
|
||||||
<DependentUpon>Intellivision.cs</DependentUpon>
|
<DependentUpon>Intellivision.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
using BizHawk.Emulation.Common;
|
using System;
|
||||||
using System;
|
|
||||||
|
using BizHawk.Common;
|
||||||
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Components.CP1610
|
namespace BizHawk.Emulation.Cores.Components.CP1610
|
||||||
{
|
{
|
||||||
|
@ -47,6 +49,15 @@ namespace BizHawk.Emulation.Cores.Components.CP1610
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SyncState(Serializer ser)
|
||||||
|
{
|
||||||
|
ser.BeginSection("CP1610");
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
ser.EndSection();
|
||||||
|
}
|
||||||
|
|
||||||
private void Calc_FlagC(int result)
|
private void Calc_FlagC(int result)
|
||||||
{
|
{
|
||||||
FlagC = ((result & 0x10000) != 0);
|
FlagC = ((result & 0x10000) != 0);
|
||||||
|
|
|
@ -1,9 +1,20 @@
|
||||||
namespace BizHawk.Emulation.Cores.Intellivision
|
using BizHawk.Common;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
{
|
{
|
||||||
public sealed class Cartridge : ICart
|
public sealed class Cartridge : ICart
|
||||||
{
|
{
|
||||||
private ushort[] Data = new ushort[56320];
|
private ushort[] Data = new ushort[56320];
|
||||||
|
|
||||||
|
public void SyncState(Serializer ser)
|
||||||
|
{
|
||||||
|
ser.BeginSection("Cart");
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
ser.EndSection();
|
||||||
|
}
|
||||||
|
|
||||||
public int Parse(byte[] Rom)
|
public int Parse(byte[] Rom)
|
||||||
{
|
{
|
||||||
// TODO: Determine which loading method, if either, is correct.
|
// TODO: Determine which loading method, if either, is correct.
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
namespace BizHawk.Emulation.Cores.Intellivision
|
using BizHawk.Common;
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
{
|
{
|
||||||
public interface ICart
|
public interface ICart
|
||||||
{
|
{
|
||||||
int Parse(byte[] Rom);
|
int Parse(byte[] Rom);
|
||||||
ushort? ReadCart(ushort addr);
|
ushort? ReadCart(ushort addr);
|
||||||
bool WriteCart(ushort addr, ushort value);
|
bool WriteCart(ushort addr, ushort value);
|
||||||
|
|
||||||
|
void SyncState(Serializer ser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
using System;
|
using System;
|
||||||
|
using BizHawk.Common;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Intellivision
|
namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
{
|
{
|
||||||
public sealed class Intellicart : ICart
|
public sealed class Intellicart : ICart
|
||||||
{
|
{
|
||||||
|
public void SyncState(Serializer ser)
|
||||||
|
{
|
||||||
|
ser.BeginSection("Cart");
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
ser.EndSection();
|
||||||
|
}
|
||||||
|
|
||||||
private ushort[] Data = new ushort[65536];
|
private ushort[] Data = new ushort[65536];
|
||||||
private bool[][] MemoryAttributes = new bool[32][];
|
private bool[][] MemoryAttributes = new bool[32][];
|
||||||
private ushort[][] FineAddresses = new ushort[32][];
|
private ushort[][] FineAddresses = new ushort[32][];
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
else
|
else
|
||||||
_cpu.TraceCallback = null;
|
_cpu.TraceCallback = null;
|
||||||
|
|
||||||
Frame++;
|
_frame++;
|
||||||
// read the controller state here for now
|
// read the controller state here for now
|
||||||
get_controller_state();
|
get_controller_state();
|
||||||
//_stic.Mobs();
|
//_stic.Mobs();
|
||||||
|
@ -69,7 +69,8 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Frame { get; private set; }
|
private int _frame;
|
||||||
|
public int Frame { get { return _frame; } }
|
||||||
|
|
||||||
public string SystemId
|
public string SystemId
|
||||||
{
|
{
|
||||||
|
@ -83,7 +84,7 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
|
|
||||||
public void ResetCounters()
|
public void ResetCounters()
|
||||||
{
|
{
|
||||||
Frame = 0;
|
_frame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreComm CoreComm { get; private set; }
|
public CoreComm CoreComm { get; private set; }
|
||||||
|
|
|
@ -6,7 +6,7 @@ using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Intellivision
|
namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
{
|
{
|
||||||
public partial class Intellivision : ISettable<Intellivision.IntvSettings, Intellivision.IntvSyncSettings>
|
public partial class Intellivision : IEmulator, IStatable, ISettable<Intellivision.IntvSettings, Intellivision.IntvSyncSettings>
|
||||||
{
|
{
|
||||||
public IntvSettings GetSettings()
|
public IntvSettings GetSettings()
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
using BizHawk.Common;
|
||||||
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
|
|
||||||
|
namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
|
{
|
||||||
|
public partial class Intellivision : IStatable
|
||||||
|
{
|
||||||
|
public bool BinarySaveStatesPreferred
|
||||||
|
{
|
||||||
|
get { return true; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveStateText(TextWriter writer)
|
||||||
|
{
|
||||||
|
SyncState(Serializer.CreateTextWriter(writer));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadStateText(TextReader reader)
|
||||||
|
{
|
||||||
|
SyncState(Serializer.CreateTextReader(reader));
|
||||||
|
SetupMemoryDomains(); // resync the memory domains
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveStateBinary(BinaryWriter bw)
|
||||||
|
{
|
||||||
|
SyncState(Serializer.CreateBinaryWriter(bw));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadStateBinary(BinaryReader br)
|
||||||
|
{
|
||||||
|
SyncState(Serializer.CreateBinaryReader(br));
|
||||||
|
SetupMemoryDomains(); // resync the memory domains
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] SaveStateBinary()
|
||||||
|
{
|
||||||
|
MemoryStream ms = new MemoryStream();
|
||||||
|
BinaryWriter bw = new BinaryWriter(ms);
|
||||||
|
SaveStateBinary(bw);
|
||||||
|
bw.Flush();
|
||||||
|
return ms.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SyncState(Serializer ser)
|
||||||
|
{
|
||||||
|
int version = 1;
|
||||||
|
ser.BeginSection("Intellivision");
|
||||||
|
ser.Sync("version", ref version);
|
||||||
|
ser.Sync("Frame", ref _frame);
|
||||||
|
|
||||||
|
_cpu.SyncState(ser);
|
||||||
|
_stic.SyncState(ser);
|
||||||
|
_psg.SyncState(ser);
|
||||||
|
_cart.SyncState(ser);
|
||||||
|
ControllerDeck.SyncState(ser);
|
||||||
|
|
||||||
|
ser.EndSection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using BizHawk.Common;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Intellivision
|
namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
{
|
{
|
||||||
|
@ -12,6 +13,15 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
public Func<ushort, ushort> ReadMemory;
|
public Func<ushort, ushort> ReadMemory;
|
||||||
public Func<ushort, ushort, bool> WriteMemory;
|
public Func<ushort, ushort, bool> WriteMemory;
|
||||||
|
|
||||||
|
public void SyncState(Serializer ser)
|
||||||
|
{
|
||||||
|
ser.BeginSection("PSG");
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
ser.EndSection();
|
||||||
|
}
|
||||||
|
|
||||||
public ushort? ReadPSG(ushort addr)
|
public ushort? ReadPSG(ushort addr)
|
||||||
{
|
{
|
||||||
if (addr >= 0x01F0 && addr <= 0x01FF)
|
if (addr >= 0x01F0 && addr <= 0x01FF)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using BizHawk.Emulation.Common;
|
|
||||||
|
using BizHawk.Common;
|
||||||
using BizHawk.Common.NumberExtensions;
|
using BizHawk.Common.NumberExtensions;
|
||||||
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Intellivision
|
namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
{
|
{
|
||||||
|
@ -23,6 +25,15 @@ namespace BizHawk.Emulation.Cores.Intellivision
|
||||||
public int[] FrameBuffer = new int[159 * 192];
|
public int[] FrameBuffer = new int[159 * 192];
|
||||||
public ushort[,] Collision = new ushort[167,210];
|
public ushort[,] Collision = new ushort[167,210];
|
||||||
|
|
||||||
|
public void SyncState(Serializer ser)
|
||||||
|
{
|
||||||
|
ser.BeginSection("STIC");
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
ser.EndSection();
|
||||||
|
}
|
||||||
|
|
||||||
public int[] GetVideoBuffer()
|
public int[] GetVideoBuffer()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue