add a new field to IEmulator: bool BinarySaveStatesPreferred { get; }. a core should set it to true to indicate that it would prefer to save and load binary savestates (but both types must be supported). set to true on 7800, gb, dgb, gba, n64, snes, saturn cores, as they all create text savestates that are simply dumps of the binary savestate. for the moment, frontend does nothing with this new information.

This commit is contained in:
goyuken 2013-05-06 20:51:28 +00:00
parent beb0452275
commit 7b7b95e95d
19 changed files with 40 additions and 0 deletions

View File

@ -140,6 +140,8 @@ namespace BizHawk.Emulation.Computers.Commodore64
return ms.ToArray(); return ms.ToArray();
} }
public bool BinarySaveStatesPreferred { get { return false; } }
private void SetupMemoryDomains() private void SetupMemoryDomains()
{ {
// chips must be initialized before this code runs! // chips must be initialized before this code runs!

View File

@ -99,6 +99,8 @@ namespace BizHawk
return ms.ToArray(); return ms.ToArray();
} }
public bool BinarySaveStatesPreferred { get { return false; } }
private readonly IList<MemoryDomain> memoryDomains; private readonly IList<MemoryDomain> memoryDomains;
public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } } public IList<MemoryDomain> MemoryDomains { get { return memoryDomains; } }
public MemoryDomain MainMemory { get { return memoryDomains[0]; } } public MemoryDomain MainMemory { get { return memoryDomains[0]; } }

View File

@ -117,6 +117,9 @@ namespace BizHawk.Emulation
bw.Flush(); bw.Flush();
return ms.ToArray(); return ms.ToArray();
} }
public bool BinarySaveStatesPreferred { get { return true; } }
void SyncState(Serializer ser) void SyncState(Serializer ser)
{ {
byte[] core = null; byte[] core = null;

View File

@ -588,6 +588,8 @@ namespace BizHawk.Emulation.Consoles.Calculator
return new byte[0]; return new byte[0];
} }
public bool BinarySaveStatesPreferred { get { return false; } }
public string SystemId { get { return "TI83"; } } public string SystemId { get { return "TI83"; } }
private IList<MemoryDomain> memoryDomains; private IList<MemoryDomain> memoryDomains;

View File

@ -204,6 +204,8 @@ namespace BizHawk.Emulation.Consoles.Coleco
return buf; return buf;
} }
public bool BinarySaveStatesPreferred { get { return false; } }
public void SaveStateBinary(BinaryWriter writer) public void SaveStateBinary(BinaryWriter writer)
{ {
Cpu.SaveStateBinary(writer); Cpu.SaveStateBinary(writer);

View File

@ -179,6 +179,8 @@ namespace BizHawk.Emulation.Consoles.Intellivision
return new byte[0]; return new byte[0];
} }
public bool BinarySaveStatesPreferred { get { return false; } }
public CoreComm CoreComm { get; private set; } public CoreComm CoreComm { get; private set; }
public IList<MemoryDomain> MemoryDomains public IList<MemoryDomain> MemoryDomains

View File

@ -176,6 +176,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo.GBA
return ms.ToArray(); return ms.ToArray();
} }
public bool BinarySaveStatesPreferred { get { return true; } }
#endregion #endregion
public CoreComm CoreComm { get; private set; } public CoreComm CoreComm { get; private set; }

View File

@ -405,6 +405,8 @@ namespace BizHawk.Emulation.Consoles.GB
return ms.ToArray(); return ms.ToArray();
} }
public bool BinarySaveStatesPreferred { get { return true; } }
#endregion #endregion
#region memorycallback #region memorycallback

View File

@ -284,6 +284,8 @@ namespace BizHawk.Emulation.Consoles.GB
return ms.ToArray(); return ms.ToArray();
} }
public bool BinarySaveStatesPreferred { get { return true; } }
#endregion #endregion
public CoreComm CoreComm { get; private set; } public CoreComm CoreComm { get; private set; }

View File

@ -176,6 +176,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo.N64
return ms.ToArray(); return ms.ToArray();
} }
public bool BinarySaveStatesPreferred { get { return true; } }
public IList<MemoryDomain> MemoryDomains { get; private set; } public IList<MemoryDomain> MemoryDomains { get; private set; }
public MemoryDomain MainMemory { get; private set; } public MemoryDomain MainMemory { get; private set; }

View File

@ -849,6 +849,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo
bw.Flush(); bw.Flush();
return ms.ToArray(); return ms.ToArray();
} }
public bool BinarySaveStatesPreferred { get { return false; } }
} }
} }

View File

@ -787,6 +787,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
return ms.ToArray(); return ms.ToArray();
} }
public bool BinarySaveStatesPreferred { get { return true; } }
/// <summary> /// <summary>
/// handle the unmanaged part of loadstating /// handle the unmanaged part of loadstating
/// </summary> /// </summary>

View File

@ -535,6 +535,8 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
return buf; return buf;
} }
public bool BinarySaveStatesPreferred { get { return false; } }
void SetupMemoryDomains() void SetupMemoryDomains()
{ {
var domains = new List<MemoryDomain>(10); var domains = new List<MemoryDomain>(10);

View File

@ -252,6 +252,7 @@ namespace BizHawk.Emulation.Consoles.PSX
public void SaveStateBinary(BinaryWriter writer) { } public void SaveStateBinary(BinaryWriter writer) { }
public void LoadStateBinary(BinaryReader reader) { } public void LoadStateBinary(BinaryReader reader) { }
public byte[] SaveStateBinary() { return new byte[1]; } public byte[] SaveStateBinary() { return new byte[1]; }
public bool BinarySaveStatesPreferred { get { return false; } }
public int[] GetVideoBuffer() { return frameBuffer; } public int[] GetVideoBuffer() { return frameBuffer; }
public int VirtualWidth { get; private set; } public int VirtualWidth { get; private set; }
public int BufferWidth { get; private set; } public int BufferWidth { get; private set; }

View File

@ -408,6 +408,8 @@ namespace BizHawk.Emulation.Consoles.Sega
return buf; return buf;
} }
public bool BinarySaveStatesPreferred { get { return false; } }
IList<MemoryDomain> memoryDomains; IList<MemoryDomain> memoryDomains;
void SetupMemoryDomains() void SetupMemoryDomains()

View File

@ -315,6 +315,8 @@ namespace BizHawk.Emulation.Consoles.Sega
return buf; return buf;
} }
public bool BinarySaveStatesPreferred { get { return false; } }
public void SaveStateBinary(BinaryWriter writer) public void SaveStateBinary(BinaryWriter writer)
{ {
Cpu.SaveStateBinary(writer); Cpu.SaveStateBinary(writer);

View File

@ -310,6 +310,8 @@ namespace BizHawk.Emulation.Consoles.Sega.Saturn
Frame = reader.ReadInt32(); Frame = reader.ReadInt32();
} }
public bool BinarySaveStatesPreferred { get { return true; } }
public byte[] SaveStateBinary() public byte[] SaveStateBinary()
{ {
MemoryStream ms = new MemoryStream(); MemoryStream ms = new MemoryStream();

View File

@ -54,6 +54,7 @@ namespace BizHawk
public void SaveStateBinary(BinaryWriter writer) { } public void SaveStateBinary(BinaryWriter writer) { }
public void LoadStateBinary(BinaryReader reader) { } public void LoadStateBinary(BinaryReader reader) { }
public byte[] SaveStateBinary() { return new byte[1]; } public byte[] SaveStateBinary() { return new byte[1]; }
public bool BinarySaveStatesPreferred { get { return false; } }
public int[] GetVideoBuffer() { return frameBuffer; } public int[] GetVideoBuffer() { return frameBuffer; }
public int VirtualWidth { get { return 256; } } public int VirtualWidth { get { return 256; } }
public int BufferWidth { get { return 256; } } public int BufferWidth { get { return 256; } }

View File

@ -62,6 +62,11 @@ namespace BizHawk
void LoadStateBinary(BinaryReader reader); void LoadStateBinary(BinaryReader reader);
byte[] SaveStateBinary(); byte[] SaveStateBinary();
/// <summary>
/// true if the core would rather give a binary savestate than a text one. both must function regardless
/// </summary>
bool BinarySaveStatesPreferred { get; }
/// <summary> /// <summary>
/// the corecomm module in use by this core. /// the corecomm module in use by this core.
/// </summary> /// </summary>