change IEmulator.DeterministicEmulation to get-only; the old interface implies that a core should be able to take a change to the property at any time, which isn't feasable. most existing cores changed to return true all the time. SNES now takes determinism parameter in Load()
This commit is contained in:
parent
0e292d19ca
commit
98d9f13600
|
@ -475,7 +475,7 @@ namespace BizHawk.Emulation.Consoles.Calculator
|
||||||
public int LagCount { get { return _lagcount; } set { _lagcount = value; } }
|
public int LagCount { get { return _lagcount; } set { _lagcount = value; } }
|
||||||
public bool IsLagFrame { get { return islag; } }
|
public bool IsLagFrame { get { return islag; } }
|
||||||
|
|
||||||
public bool DeterministicEmulation { get { return true; } set { } }
|
public bool DeterministicEmulation { get { return true; } }
|
||||||
|
|
||||||
public byte[] ReadSaveRam() { return null; }
|
public byte[] ReadSaveRam() { return null; }
|
||||||
public void StoreSaveRam(byte[] data) { }
|
public void StoreSaveRam(byte[] data) { }
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace BizHawk.Emulation.Consoles.Coleco
|
||||||
public void ClearSaveRam() { }
|
public void ClearSaveRam() { }
|
||||||
public bool SaveRamModified { get; set; }
|
public bool SaveRamModified { get; set; }
|
||||||
|
|
||||||
public bool DeterministicEmulation { get; set; }
|
public bool DeterministicEmulation { get { return true; } }
|
||||||
public void SaveStateText(TextWriter writer) { SyncState(Serializer.CreateTextWriter(writer)); }
|
public void SaveStateText(TextWriter writer) { SyncState(Serializer.CreateTextWriter(writer)); }
|
||||||
public void LoadStateText(TextReader reader) { SyncState(Serializer.CreateTextReader(reader)); }
|
public void LoadStateText(TextReader reader) { SyncState(Serializer.CreateTextReader(reader)); }
|
||||||
public void SaveStateBinary(BinaryWriter bw) { SyncState(Serializer.CreateBinaryWriter(bw)); }
|
public void SaveStateBinary(BinaryWriter bw) { SyncState(Serializer.CreateBinaryWriter(bw)); }
|
||||||
|
|
|
@ -115,7 +115,7 @@ namespace BizHawk.Emulation.Consoles.Intellivision
|
||||||
get { return "INTV"; }
|
get { return "INTV"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DeterministicEmulation { get; set; }
|
public bool DeterministicEmulation { get { return true; } }
|
||||||
|
|
||||||
|
|
||||||
public byte[] ReadSaveRam() { return null; }
|
public byte[] ReadSaveRam() { return null; }
|
||||||
|
|
|
@ -219,7 +219,7 @@ namespace BizHawk.Emulation.Consoles.GB
|
||||||
get { return "GB"; }
|
get { return "GB"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DeterministicEmulation { get; set; }
|
public bool DeterministicEmulation { get { return true; } }
|
||||||
|
|
||||||
public byte[] ReadSaveRam()
|
public byte[] ReadSaveRam()
|
||||||
{
|
{
|
||||||
|
|
|
@ -307,7 +307,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo
|
||||||
public int LagCount { get { return _lagcount; } set { _lagcount = value; } }
|
public int LagCount { get { return _lagcount; } set { _lagcount = value; } }
|
||||||
public bool IsLagFrame { get { return islag; } }
|
public bool IsLagFrame { get { return islag; } }
|
||||||
|
|
||||||
public bool DeterministicEmulation { get { return true; } set { } }
|
public bool DeterministicEmulation { get { return true; } }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -360,7 +360,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Load(GameInfo game, byte[] romData, byte[] sgbRomData)
|
public void Load(GameInfo game, byte[] romData, byte[] sgbRomData, bool DeterministicEmulation)
|
||||||
{
|
{
|
||||||
//attach this core as the current
|
//attach this core as the current
|
||||||
if (CurrLibsnesCore != null)
|
if (CurrLibsnesCore != null)
|
||||||
|
@ -434,9 +434,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
|
||||||
|
|
||||||
SetupMemoryDomains(romData);
|
SetupMemoryDomains(romData);
|
||||||
|
|
||||||
// disallow any future modifications to the DeterministicEmulation parameter, and set initial deterministic savestate
|
this.DeterministicEmulation = DeterministicEmulation;
|
||||||
_DeterministicEmulationProtected = true;
|
if (DeterministicEmulation) // save frame-0 savestate now
|
||||||
if (DeterministicEmulation)
|
|
||||||
CoreSaveStateInternal(true);
|
CoreSaveStateInternal(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,18 +633,10 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
|
||||||
public bool IsLagFrame { get; private set; }
|
public bool IsLagFrame { get; private set; }
|
||||||
public string SystemId { get; private set; }
|
public string SystemId { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
bool _DeterministicEmulation = false;
|
|
||||||
bool _DeterministicEmulationProtected = false;
|
|
||||||
public bool DeterministicEmulation
|
public bool DeterministicEmulation
|
||||||
{
|
{
|
||||||
get { return _DeterministicEmulation; }
|
get;
|
||||||
set
|
private set;
|
||||||
{
|
|
||||||
if (_DeterministicEmulationProtected && value != _DeterministicEmulation)
|
|
||||||
throw new Exception("snes: DeterministicEmulation must be set before load!");
|
|
||||||
_DeterministicEmulation = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -277,7 +277,7 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
|
||||||
|
|
||||||
public string SystemId { get { return systemid; } }
|
public string SystemId { get { return systemid; } }
|
||||||
public string Region { get; set; }
|
public string Region { get; set; }
|
||||||
public bool DeterministicEmulation { get; set; }
|
public bool DeterministicEmulation { get { return true; } }
|
||||||
|
|
||||||
public byte[] ReadSaveRam()
|
public byte[] ReadSaveRam()
|
||||||
{
|
{
|
||||||
|
|
|
@ -264,7 +264,7 @@ namespace BizHawk.Emulation.Consoles.Sega
|
||||||
public int Frame { get; set; }
|
public int Frame { get; set; }
|
||||||
public int LagCount { get { return _lagcount; } set { _lagcount = value; } }
|
public int LagCount { get { return _lagcount; } set { _lagcount = value; } }
|
||||||
public bool IsLagFrame { get { return islag; } }
|
public bool IsLagFrame { get { return islag; } }
|
||||||
public bool DeterministicEmulation { get; set; }
|
public bool DeterministicEmulation { get { return true; } }
|
||||||
public string SystemId { get { return "GEN"; } }
|
public string SystemId { get { return "GEN"; } }
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace BizHawk.Emulation.Consoles.Sega
|
||||||
byte Port3F = 0xFF;
|
byte Port3F = 0xFF;
|
||||||
|
|
||||||
public DisplayType DisplayType { get; set; }
|
public DisplayType DisplayType { get; set; }
|
||||||
public bool DeterministicEmulation { get; set; }
|
public bool DeterministicEmulation { get { return true; } }
|
||||||
|
|
||||||
public SMS(GameInfo game, byte[] rom)
|
public SMS(GameInfo game, byte[] rom)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace BizHawk
|
||||||
public byte[] ReadSaveRam() { return null; }
|
public byte[] ReadSaveRam() { return null; }
|
||||||
public void StoreSaveRam(byte[] data) { }
|
public void StoreSaveRam(byte[] data) { }
|
||||||
public void ClearSaveRam() { }
|
public void ClearSaveRam() { }
|
||||||
public bool DeterministicEmulation { get; set; }
|
public bool DeterministicEmulation { get { return true; } }
|
||||||
public bool SaveRamModified { get; set; }
|
public bool SaveRamModified { get; set; }
|
||||||
public void SaveStateText(TextWriter writer) { }
|
public void SaveStateText(TextWriter writer) { }
|
||||||
public void LoadStateText(TextReader reader) { }
|
public void LoadStateText(TextReader reader) { }
|
||||||
|
|
|
@ -20,7 +20,8 @@ namespace BizHawk
|
||||||
int LagCount { get; set; }
|
int LagCount { get; set; }
|
||||||
bool IsLagFrame { get; }
|
bool IsLagFrame { get; }
|
||||||
string SystemId { get; }
|
string SystemId { get; }
|
||||||
bool DeterministicEmulation { get; set; }
|
/// <summary>if you want to set this, look in the emulator's constructor or Load() method</summary>
|
||||||
|
bool DeterministicEmulation { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// return a copy of the saveram. editing it won't do you any good unless you later call StoreSaveRam()
|
/// return a copy of the saveram. editing it won't do you any good unless you later call StoreSaveRam()
|
||||||
|
|
|
@ -1401,10 +1401,9 @@ namespace BizHawk.MultiClient
|
||||||
{
|
{
|
||||||
game.System = "SNES";
|
game.System = "SNES";
|
||||||
var snes = new LibsnesCore();
|
var snes = new LibsnesCore();
|
||||||
if (deterministicemulation) snes.DeterministicEmulation = true;
|
|
||||||
nextEmulator = snes;
|
nextEmulator = snes;
|
||||||
nextEmulator.CoreInputComm = Global.CoreInputComm;
|
nextEmulator.CoreInputComm = Global.CoreInputComm;
|
||||||
snes.Load(game, rom.FileData, null);
|
snes.Load(game, rom.FileData, null, deterministicemulation);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "SMS":
|
case "SMS":
|
||||||
|
@ -1492,9 +1491,8 @@ namespace BizHawk.MultiClient
|
||||||
game.AddOption("SGB");
|
game.AddOption("SGB");
|
||||||
game.System = "SGB";
|
game.System = "SGB";
|
||||||
var snes = new LibsnesCore();
|
var snes = new LibsnesCore();
|
||||||
if (deterministicemulation) snes.DeterministicEmulation = true;
|
|
||||||
nextEmulator = snes;
|
nextEmulator = snes;
|
||||||
snes.Load(game, rom.FileData, sgbrom);
|
snes.Load(game, rom.FileData, sgbrom, deterministicemulation);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "COLV":
|
case "COLV":
|
||||||
|
@ -1530,8 +1528,6 @@ namespace BizHawk.MultiClient
|
||||||
|
|
||||||
if (nextEmulator == null) throw new Exception();
|
if (nextEmulator == null) throw new Exception();
|
||||||
|
|
||||||
if (deterministicemulation) nextEmulator.DeterministicEmulation = true;
|
|
||||||
|
|
||||||
CloseGame();
|
CloseGame();
|
||||||
Global.Emulator.Dispose();
|
Global.Emulator.Dispose();
|
||||||
Global.Emulator = nextEmulator;
|
Global.Emulator = nextEmulator;
|
||||||
|
|
Loading…
Reference in New Issue