gpgx support text savestates

This commit is contained in:
goyuken 2013-12-16 03:39:47 +00:00
parent 4eaeb06986
commit 6e91ffe45f
1 changed files with 16 additions and 0 deletions

View File

@ -256,10 +256,26 @@ namespace BizHawk.Emulation.Cores.Consoles.Sega.gpgx
public void SaveStateText(System.IO.TextWriter writer)
{
var temp = SaveStateBinary();
temp.SaveAsHexFast(writer);
// write extra copy of stuff we don't use
writer.WriteLine("Frame {0}", Frame);
}
public void LoadStateText(System.IO.TextReader reader)
{
string hex = reader.ReadLine();
if (hex.StartsWith("emuVersion")) // movie save
{
do // theoretically, our portion should start right after StartsFromSavestate, maybe...
{
hex = reader.ReadLine();
} while (!hex.StartsWith("StartsFromSavestate"));
hex = reader.ReadLine();
}
byte[] state = new byte[hex.Length / 2];
state.ReadFromHexFast(hex);
LoadStateBinary(new System.IO.BinaryReader(new System.IO.MemoryStream(state)));
}
public void SaveStateBinary(System.IO.BinaryWriter writer)