1
0
mirror of https://github.com/soarqin/DSP_Mods_TO.git synced 2026-02-04 14:12:18 +08:00

CompressSave 1.3.7

This commit is contained in:
2024-12-01 15:32:20 +08:00
parent f832fbf0d6
commit 3cc1dfa750
10 changed files with 249 additions and 315 deletions

View File

@@ -1,41 +1,17 @@
using System;
using System.Collections.Generic;
using System.IO;
using MonoMod.Utils;
namespace CompressSave.Wrapper;
public class NoneAPI: WrapperDefines
{
public static readonly bool Avaliable;
public static readonly NoneAPI Instance = new();
static NoneAPI()
{
Avaliable = true;
string assemblyPath = System.Reflection.Assembly.GetAssembly(typeof(NoneAPI)).Location;
string root = string.Empty;
try
{
if (!string.IsNullOrEmpty(assemblyPath))
{
root = Path.GetDirectoryName(assemblyPath) ?? string.Empty;
}
var map = new Dictionary<string, List<DynDllMapping>>
{
{
"nonewrap.dll", [
"nonewrap.dll",
"x64/nonewrap.dll",
"plugins/x64/nonewrap.dll",
"BepInEx/scripts/x64/nonewrap.dll",
Path.Combine(root, "nonewrap.dll"),
Path.Combine(root, "x64/nonewrap.dll"),
Path.Combine(root, "plugins/x64/nonewrap.dll")
]
},
};
typeof(NoneAPI).ResolveDynDllImports(map);
Avaliable = Instance.ResolveDllImports("nonewrap.dll");
}
catch (Exception e)
{
@@ -43,27 +19,4 @@ public class NoneAPI: WrapperDefines
Console.WriteLine($"Error: {e}");
}
}
public NoneAPI()
{
CompressBufferBound = CompressBufferBound_;
CompressBegin = CompressBegin_;
CompressEnd = CompressEnd_;
CompressUpdate = CompressUpdate_;
CompressContextFree = CompressContextFree_;
DecompressBegin = DecompressBegin_;
DecompressEnd = DecompressEnd_;
DecompressUpdate = DecompressUpdate_;
DecompressContextReset = DecompressContextReset_;
}
[DynDllImport(libraryName: "nonewrap.dll", "CompressBufferBound")] protected static CompressBufferBoundFunc CompressBufferBound_;
[DynDllImport(libraryName: "nonewrap.dll", "CompressBegin")] protected static CompressBeginFunc CompressBegin_;
[DynDllImport(libraryName: "nonewrap.dll", "CompressEnd")] protected static CompressEndFunc CompressEnd_;
[DynDllImport(libraryName: "nonewrap.dll", "CompressUpdate")] protected static CompressUpdateFunc CompressUpdate_;
[DynDllImport(libraryName: "nonewrap.dll", "CompressContextFree")] protected static CompressContextFreeFunc CompressContextFree_;
[DynDllImport(libraryName: "nonewrap.dll", "DecompressBegin")] protected static DecompressBeginFunc DecompressBegin_;
[DynDllImport(libraryName: "nonewrap.dll", "DecompressEnd")] protected static DecompressEndFunc DecompressEnd_;
[DynDllImport(libraryName: "nonewrap.dll", "DecompressUpdate")] protected static DecompressUpdateFunc DecompressUpdate_;
[DynDllImport(libraryName: "nonewrap.dll", "DecompressContextReset")] protected static DecompressContextResetFunc DecompressContextReset_;
}