text savestates are now in the archive format, just like binary ones. loading of old savestates is preserved. this hasn't been fully audited wrt movie code
This commit is contained in:
parent
37d6e0b8de
commit
e39b2af5e7
|
@ -9,39 +9,23 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
public static void SaveStateFile(string filename, string name)
|
||||
{
|
||||
if (Global.Config.SaveStateType == Config.SaveStateTypeE.Text ||
|
||||
(Global.Config.SaveStateType == Config.SaveStateTypeE.Default && !Global.Emulator.BinarySaveStatesPreferred))
|
||||
{
|
||||
// text mode savestates
|
||||
var writer = new StreamWriter(filename);
|
||||
Global.Emulator.SaveStateText(writer);
|
||||
Global.MovieSession.HandleMovieSaveState(writer);
|
||||
if (Global.Config.SaveScreenshotWithStates)
|
||||
{
|
||||
var buff = Global.Emulator.VideoProvider.GetVideoBuffer();
|
||||
|
||||
// If user wants large screenshots, or screenshot is small enough
|
||||
if (Global.Config.SaveLargeScreenshotWithStates || buff.Length < Global.Config.BigScreenshotSize)
|
||||
{
|
||||
writer.Write("Framebuffer ");
|
||||
buff.SaveAsHex(writer);
|
||||
}
|
||||
}
|
||||
|
||||
writer.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
// binary savestates
|
||||
// the old method of text savestate save is now gone.
|
||||
// a text savestate is just like a binary savestate, but with a different core lump
|
||||
using (var fs = new FileStream(filename, FileMode.Create, FileAccess.Write))
|
||||
using (var bs = new BinaryStateSaver(fs))
|
||||
{
|
||||
#if true
|
||||
bs.PutLump(BinaryStateLump.Corestate, bw => Global.Emulator.SaveStateBinary(bw));
|
||||
#else
|
||||
// this would put text states inside the zipfile
|
||||
if (Global.Config.SaveStateType == Config.SaveStateTypeE.Text ||
|
||||
(Global.Config.SaveStateType == Config.SaveStateTypeE.Default && !Global.Emulator.BinarySaveStatesPreferred))
|
||||
{
|
||||
// text savestate format
|
||||
bs.PutLump(BinaryStateLump.CorestateText, (tw) => Global.Emulator.SaveStateText(tw));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// binary core lump format
|
||||
bs.PutLump(BinaryStateLump.Corestate, bw => Global.Emulator.SaveStateBinary(bw));
|
||||
}
|
||||
|
||||
if (Global.Config.SaveScreenshotWithStates)
|
||||
{
|
||||
var buff = Global.Emulator.VideoProvider.GetVideoBuffer();
|
||||
|
@ -65,7 +49,6 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool LoadStateFile(string path, string name)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue