mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-02-04 21:42:19 +08:00
CompressSave: release 1.3.1
This commit is contained in:
@@ -62,6 +62,9 @@ public class CompressSave : BaseUnityPlugin
|
|||||||
PatchSave.CompressionLevelForAutoSaves = Config.Bind("Compression", "LevelForAuto", PatchSave.CompressionLevelForAutoSaves,
|
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.")
|
"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;
|
.Value;
|
||||||
|
PatchSave.EnableForAutoSaves = Config.Bind("Compression", "EnableForAutoSaves", PatchSave.EnableForAutoSaves,
|
||||||
|
"Enable the feature for auto saves and last-exit save.")
|
||||||
|
.Value;
|
||||||
PatchSave.CreateCompressBuffer();
|
PatchSave.CreateCompressBuffer();
|
||||||
if (GameConfig.gameVersion != SaveUtil.VerifiedVersion)
|
if (GameConfig.gameVersion != SaveUtil.VerifiedVersion)
|
||||||
{
|
{
|
||||||
@@ -107,6 +110,7 @@ class PatchSave
|
|||||||
public static CompressionType CompressionTypeForAutoSaves = CompressionType.Zstd;
|
public static CompressionType CompressionTypeForAutoSaves = CompressionType.Zstd;
|
||||||
public static int CompressionLevelForSaves;
|
public static int CompressionLevelForSaves;
|
||||||
public static int CompressionLevelForAutoSaves;
|
public static int CompressionLevelForAutoSaves;
|
||||||
|
public static bool EnableForAutoSaves = true;
|
||||||
private static Stream _compressionStream;
|
private static Stream _compressionStream;
|
||||||
public static bool EnableCompress;
|
public static bool EnableCompress;
|
||||||
|
|
||||||
@@ -117,6 +121,8 @@ class PatchSave
|
|||||||
outBufSize = Math.Max(outBufSize, ZstdWrapper.CompressBufferBound(bufSize));
|
outBufSize = Math.Max(outBufSize, ZstdWrapper.CompressBufferBound(bufSize));
|
||||||
outBufSize = Math.Max(outBufSize, NoneWrapper.CompressBufferBound(bufSize));
|
outBufSize = Math.Max(outBufSize, NoneWrapper.CompressBufferBound(bufSize));
|
||||||
_compressBuffer = CompressionStream.CreateBuffer((int)outBufSize, bufSize);
|
_compressBuffer = CompressionStream.CreateBuffer((int)outBufSize, bufSize);
|
||||||
|
_compressionTypeForSaving = CompressionTypeForSaves;
|
||||||
|
_compressionLevelForSaving = CompressionLevelForSaves;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void WriteHeader(FileStream fileStream)
|
private static void WriteHeader(FileStream fileStream)
|
||||||
@@ -144,7 +150,7 @@ class PatchSave
|
|||||||
[HarmonyPatch(typeof(GameSave), "SaveAsLastExit")]
|
[HarmonyPatch(typeof(GameSave), "SaveAsLastExit")]
|
||||||
static void BeforeAutoSave()
|
static void BeforeAutoSave()
|
||||||
{
|
{
|
||||||
UseCompressSave = EnableCompress;
|
UseCompressSave = EnableForAutoSaves && EnableCompress;
|
||||||
if (UseCompressSave)
|
if (UseCompressSave)
|
||||||
{
|
{
|
||||||
_compressionTypeForSaving = CompressionTypeForAutoSaves;
|
_compressionTypeForSaving = CompressionTypeForAutoSaves;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<AssemblyName>CompressSave</AssemblyName>
|
<AssemblyName>CompressSave</AssemblyName>
|
||||||
<BepInExPluginGuid>org.soardev.compresssave</BepInExPluginGuid>
|
<BepInExPluginGuid>org.soardev.compresssave</BepInExPluginGuid>
|
||||||
<Description>DSP MOD - CompressSave</Description>
|
<Description>DSP MOD - CompressSave</Description>
|
||||||
<Version>1.3.0</Version>
|
<Version>1.3.1</Version>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<TargetFramework>net472</TargetFramework>
|
<TargetFramework>net472</TargetFramework>
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
|
|
||||||
## Updates
|
## 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
|
### 1.3.0
|
||||||
* Separate config entries for manual save and auto save.
|
* 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.
|
* 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.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "CompressSave",
|
"name": "CompressSave",
|
||||||
"version_number": "1.3.0",
|
"version_number": "1.3.1",
|
||||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CompressSave",
|
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CompressSave",
|
||||||
"description": "Compress game saves to reduce space use and boost save speed / 压缩游戏存档以降低空间使用并提升保存速度",
|
"description": "Compress game saves to reduce space use and boost save speed / 压缩游戏存档以降低空间使用并提升保存速度",
|
||||||
"dependencies": ["xiaoye97-BepInEx-5.4.17"]
|
"dependencies": ["xiaoye97-BepInEx-5.4.17"]
|
||||||
|
|||||||
Reference in New Issue
Block a user