BinaryStateSaver - pass in compression level instead of hitting Global.Config, now we just use Global.Config more in other places, but it's a step in the right direction

This commit is contained in:
adelikat 2020-05-31 10:16:27 -05:00
parent 33696eb5df
commit 16ab9dc0b0
4 changed files with 5 additions and 5 deletions

View File

@ -328,9 +328,9 @@ namespace BizHawk.Client.Common
sw.Flush();
}
public BinaryStateSaver(string path, bool notamovie) // notamovie is hack, really should have separate something
public BinaryStateSaver(string path, int compressionLevel)
{
_zip = new FrameworkZipWriter(path, notamovie ? Global.Config.SaveStateCompressionLevelNormal : Global.Config.MovieCompressionLevel);
_zip = new FrameworkZipWriter(path, compressionLevel);
}
public void PutVersionLumps()

View File

@ -15,7 +15,7 @@ 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, true);
using var bs = new BinaryStateSaver(filename, Global.Config.SaveStateCompressionLevelNormal);
bs.PutVersionLumps();
if (Global.Config.SaveStateType == SaveStateTypeE.Text)
{

View File

@ -184,7 +184,7 @@ namespace BizHawk.Client.Common
Directory.CreateDirectory(file.Directory.ToString());
}
using var bs = new BinaryStateSaver(fn, false);
using var bs = new BinaryStateSaver(fn, Global.Config.MovieCompressionLevel);
bs.PutLump(BinaryStateLump.Movieheader, tw => tw.WriteLine(Header.ToString()));
bs.PutLump(BinaryStateLump.Comments, tw => tw.WriteLine(CommentsString()));
bs.PutLump(BinaryStateLump.Subtitles, tw => tw.WriteLine(Subtitles.ToString()));

View File

@ -18,7 +18,7 @@ namespace BizHawk.Client.Common
Directory.CreateDirectory(file.Directory.ToString());
}
using var bs = new BinaryStateSaver(fn, false);
using var bs = new BinaryStateSaver(fn, Global.Config.MovieCompressionLevel);
bs.PutLump(BinaryStateLump.Movieheader, tw => tw.WriteLine(Header.ToString()));
bs.PutLump(BinaryStateLump.Comments, tw => tw.WriteLine(CommentsString()));
bs.PutLump(BinaryStateLump.Subtitles, tw => tw.WriteLine(Subtitles.ToString()));