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();
}
public bool BinarySaveStatesPreferred { get { return false; } }
private void SetupMemoryDomains()
{
// chips must be initialized before this code runs!

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -62,6 +62,11 @@ namespace BizHawk
void LoadStateBinary(BinaryReader reader);
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>
/// the corecomm module in use by this core.
/// </summary>