libsnescore: make deterministic mode savestates all the same size (previously, frame 0 savestates were slightly smaller)
rewind: throw a slightly more intelligible exception message when savestates differ in size
This commit is contained in:
parent
039987cbd3
commit
c24abbcbad
|
@ -447,6 +447,8 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
|
||||||
BinaryWriter bw = new BinaryWriter(ms);
|
BinaryWriter bw = new BinaryWriter(ms);
|
||||||
bw.Write(CoreSaveState());
|
bw.Write(CoreSaveState());
|
||||||
bw.Write(true); // framezero, so no controller follows and don't frameadvance on load
|
bw.Write(true); // framezero, so no controller follows and don't frameadvance on load
|
||||||
|
// hack: write fake dummy controller info
|
||||||
|
bw.Write(new byte[536]);
|
||||||
bw.Close();
|
bw.Close();
|
||||||
savestatebuff = ms.ToArray();
|
savestatebuff = ms.ToArray();
|
||||||
}
|
}
|
||||||
|
@ -868,6 +870,10 @@ namespace BizHawk.Emulation.Consoles.Nintendo.SNES
|
||||||
this.Controller = tmp;
|
this.Controller = tmp;
|
||||||
ssc.Serialize(bw);
|
ssc.Serialize(bw);
|
||||||
}
|
}
|
||||||
|
else // hack: dummy controller info
|
||||||
|
{
|
||||||
|
bw.Write(reader.ReadBytes(536));
|
||||||
|
}
|
||||||
bw.Close();
|
bw.Close();
|
||||||
savestatebuff = ms.ToArray();
|
savestatebuff = ms.ToArray();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,8 @@ namespace BizHawk.MultiClient
|
||||||
void CaptureRewindState64K()
|
void CaptureRewindState64K()
|
||||||
{
|
{
|
||||||
byte[] CurrentState = Global.Emulator.SaveStateBinary();
|
byte[] CurrentState = Global.Emulator.SaveStateBinary();
|
||||||
|
if (CurrentState.Length != LastState.Length)
|
||||||
|
throw new System.Exception(string.Format("Rewind error: Savestate size mismatch:{0} old {1} new", LastState.Length, CurrentState.Length));
|
||||||
int beginChangeSequence = -1;
|
int beginChangeSequence = -1;
|
||||||
bool inChangeSequence = false;
|
bool inChangeSequence = false;
|
||||||
var ms = new MemoryStream();
|
var ms = new MemoryStream();
|
||||||
|
@ -83,6 +85,8 @@ namespace BizHawk.MultiClient
|
||||||
void CaptureRewindStateLarge()
|
void CaptureRewindStateLarge()
|
||||||
{
|
{
|
||||||
byte[] CurrentState = Global.Emulator.SaveStateBinary();
|
byte[] CurrentState = Global.Emulator.SaveStateBinary();
|
||||||
|
if (CurrentState.Length != LastState.Length)
|
||||||
|
throw new System.Exception(string.Format("Rewind error: Savestate size mismatch:{0} old {1} new", LastState.Length, CurrentState.Length));
|
||||||
int beginChangeSequence = -1;
|
int beginChangeSequence = -1;
|
||||||
bool inChangeSequence = false;
|
bool inChangeSequence = false;
|
||||||
var ms = new MemoryStream();
|
var ms = new MemoryStream();
|
||||||
|
|
Loading…
Reference in New Issue