From 33696eb5dfa78f53cad3d6af9d323134ebf6addd Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 31 May 2020 10:12:44 -0500 Subject: [PATCH] BinaryStateSaver - detangle version lump handling --- src/BizHawk.Client.Common/BinarySaveStates.cs | 12 ++++++------ src/BizHawk.Client.Common/SavestateManager.cs | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/BizHawk.Client.Common/BinarySaveStates.cs b/src/BizHawk.Client.Common/BinarySaveStates.cs index bf596b1e66..b0ab79a9f6 100644 --- a/src/BizHawk.Client.Common/BinarySaveStates.cs +++ b/src/BizHawk.Client.Common/BinarySaveStates.cs @@ -328,15 +328,15 @@ namespace BizHawk.Client.Common sw.Flush(); } - public BinaryStateSaver(string path, bool notamovie = true) // notamovie is hack, really should have separate something + public BinaryStateSaver(string path, bool notamovie) // notamovie is hack, really should have separate something { _zip = new FrameworkZipWriter(path, notamovie ? Global.Config.SaveStateCompressionLevelNormal : Global.Config.MovieCompressionLevel); + } - if (notamovie) - { - PutLump(BinaryStateLump.Versiontag, WriteVersion); - PutLump(BinaryStateLump.BizVersion, WriteEmuVersion); - } + public void PutVersionLumps() + { + PutLump(BinaryStateLump.Versiontag, WriteVersion); + PutLump(BinaryStateLump.BizVersion, WriteEmuVersion); } public void PutLump(BinaryStateLump lump, Action callback) diff --git a/src/BizHawk.Client.Common/SavestateManager.cs b/src/BizHawk.Client.Common/SavestateManager.cs index a0beb7b35e..d4d3068592 100644 --- a/src/BizHawk.Client.Common/SavestateManager.cs +++ b/src/BizHawk.Client.Common/SavestateManager.cs @@ -15,7 +15,8 @@ namespace BizHawk.Client.Common // 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 bs = new BinaryStateSaver(filename); + using var bs = new BinaryStateSaver(filename, true); + bs.PutVersionLumps(); if (Global.Config.SaveStateType == SaveStateTypeE.Text) { // text savestate format