1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 04:13:32 +08:00

CompressSave: release 1.3.1

This commit is contained in:
2023-07-12 02:34:02 +08:00
parent f7e1882fa3
commit bdd10ce0f0
4 changed files with 13 additions and 3 deletions

View File

@@ -62,6 +62,9 @@ public class CompressSave : BaseUnityPlugin
PatchSave.CompressionLevelForAutoSaves = Config.Bind("Compression", "LevelForAuto", PatchSave.CompressionLevelForAutoSaves,
"Set default compression level for auto saves and last-exit save.\n0 for default level.\n3 ~ 12 for lz4, -5 ~ 22 for zstd.\nSmaller level leads to faster speed and less compression ratio.")
.Value;
PatchSave.EnableForAutoSaves = Config.Bind("Compression", "EnableForAutoSaves", PatchSave.EnableForAutoSaves,
"Enable the feature for auto saves and last-exit save.")
.Value;
PatchSave.CreateCompressBuffer();
if (GameConfig.gameVersion != SaveUtil.VerifiedVersion)
{
@@ -107,6 +110,7 @@ class PatchSave
public static CompressionType CompressionTypeForAutoSaves = CompressionType.Zstd;
public static int CompressionLevelForSaves;
public static int CompressionLevelForAutoSaves;
public static bool EnableForAutoSaves = true;
private static Stream _compressionStream;
public static bool EnableCompress;
@@ -117,6 +121,8 @@ class PatchSave
outBufSize = Math.Max(outBufSize, ZstdWrapper.CompressBufferBound(bufSize));
outBufSize = Math.Max(outBufSize, NoneWrapper.CompressBufferBound(bufSize));
_compressBuffer = CompressionStream.CreateBuffer((int)outBufSize, bufSize);
_compressionTypeForSaving = CompressionTypeForSaves;
_compressionLevelForSaving = CompressionLevelForSaves;
}
private static void WriteHeader(FileStream fileStream)
@@ -144,7 +150,7 @@ class PatchSave
[HarmonyPatch(typeof(GameSave), "SaveAsLastExit")]
static void BeforeAutoSave()
{
UseCompressSave = EnableCompress;
UseCompressSave = EnableForAutoSaves && EnableCompress;
if (UseCompressSave)
{
_compressionTypeForSaving = CompressionTypeForAutoSaves;

View File

@@ -4,7 +4,7 @@
<AssemblyName>CompressSave</AssemblyName>
<BepInExPluginGuid>org.soardev.compresssave</BepInExPluginGuid>
<Description>DSP MOD - CompressSave</Description>
<Version>1.3.0</Version>
<Version>1.3.1</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<TargetFramework>net472</TargetFramework>

View File

@@ -7,6 +7,10 @@
## Updates
### 1.3.1
* Add config to disable feature for auto saves.
* Fix bug that first save after game start is always compressed in Zstd.
### 1.3.0
* Separate config entries for manual save and auto save.
* Now you can still get speed benefit while setting compression type to `None` for auto saves, and for manual saves if using the new `Save` button.

View File

@@ -1,6 +1,6 @@
{
"name": "CompressSave",
"version_number": "1.3.0",
"version_number": "1.3.1",
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CompressSave",
"description": "Compress game saves to reduce space use and boost save speed / 压缩游戏存档以降低空间使用并提升保存速度",
"dependencies": ["xiaoye97-BepInEx-5.4.17"]