SMS: increase size of buffer for public byte[] SaveStateBinary() by 1 byte. also throw an exception if the savestate is smaller than expected.

This commit is contained in:
goyuken 2012-12-14 16:59:23 +00:00
parent 4e0796814d
commit 5986d779e7
1 changed files with 3 additions and 1 deletions

View File

@ -305,10 +305,12 @@ namespace BizHawk.Emulation.Consoles.Sega
public byte[] SaveStateBinary()
{
var buf = new byte[24802 + 16384 + 16384];
var buf = new byte[24802 + 1 + 16384 + 16384];
var stream = new MemoryStream(buf);
var writer = new BinaryWriter(stream);
SaveStateBinary(writer);
if (stream.Length != buf.Length)
throw new Exception(string.Format("savestate buffer underrun: {0} < {1}", stream.Length, buf.Length));
writer.Close();
return buf;
}