mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-08 20:53:28 +08:00
Support for DSP 0.10
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<AssemblyName>CompressSave</AssemblyName>
|
||||
<BepInExPluginGuid>org.soardev.compresssave</BepInExPluginGuid>
|
||||
<Description>DSP MOD - CompressSave</Description>
|
||||
<Version>1.3.3</Version>
|
||||
<Version>1.3.4</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
@@ -15,7 +15,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BepInEx.Core" Version="5.*" />
|
||||
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
|
||||
<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" />
|
||||
<!--<PackageReference Include="DysonSphereProgram.GameLibs" Version="*-r.*" />-->
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.*" />
|
||||
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
|
||||
</ItemGroup>
|
||||
@@ -24,6 +24,27 @@
|
||||
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>..\GameAssembly\Assembly-CSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Unity.TextMeshPro">
|
||||
<HintPath>..\GameAssembly\Unity.TextMeshPro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.Networking">
|
||||
<HintPath>..\GameAssembly\UnityEngine.Networking.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.SpatialTracking">
|
||||
<HintPath>..\GameAssembly\UnityEngine.SpatialTracking.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.Timeline">
|
||||
<HintPath>..\GameAssembly\UnityEngine.Timeline.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UI">
|
||||
<HintPath>..\GameAssembly\UnityEngine.UI.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="del /F /Q package\$(ProjectName)-$(Version).zip
zip -9 -j package/$(ProjectName)-$(Version).zip package/icon.png package/manifest.json README.md
copy /y "$(TargetPath)" package\plugins\
copy /y "$(TargetDir)\System.Runtime.CompilerServices.Unsafe.dll" package\plugins\
cd package
zip -9 -r $(ProjectName)-$(Version).zip plugins" />
|
||||
</Target>
|
||||
|
||||
@@ -17,17 +17,21 @@ public static class I18N
|
||||
}
|
||||
|
||||
public static bool Initialized() => _initialized;
|
||||
private static int _nextID = 1;
|
||||
private static readonly List<StringProto> StringsToAdd = [];
|
||||
public static void Add(string key, string enus, string zhcn = null, string frfr = null)
|
||||
private struct Translation
|
||||
{
|
||||
var strProto = new StringProto
|
||||
public string Key;
|
||||
public string English;
|
||||
public string Chinese;
|
||||
}
|
||||
private static readonly List<Translation> StringsToAdd = [];
|
||||
public static void Add(string key, string enus, string zhcn = null)
|
||||
{
|
||||
if (zhcn == null && key == enus) return;
|
||||
var strProto = new Translation
|
||||
{
|
||||
Name = key,
|
||||
SID = "",
|
||||
ENUS = enus,
|
||||
ZHCN = string.IsNullOrEmpty(zhcn) ? enus : zhcn,
|
||||
FRFR = string.IsNullOrEmpty(frfr) ? enus : frfr
|
||||
Key = key,
|
||||
English = enus,
|
||||
Chinese = string.IsNullOrEmpty(zhcn) ? enus : zhcn
|
||||
};
|
||||
StringsToAdd.Add(strProto);
|
||||
}
|
||||
@@ -35,18 +39,52 @@ public static class I18N
|
||||
public static void Apply()
|
||||
{
|
||||
if (!_initialized) return;
|
||||
var strings = LDB._strings;
|
||||
var index = strings.dataArray.Length;
|
||||
strings.dataArray = strings.dataArray.Concat(StringsToAdd).ToArray();
|
||||
StringsToAdd.Clear();
|
||||
var newIndex = strings.dataArray.Length;
|
||||
for (; index < newIndex; index++)
|
||||
var indexer = Localization.namesIndexer;
|
||||
var enIdx = -1;
|
||||
var zhIdx = -1;
|
||||
var llen = 0;
|
||||
for (var i = 0; i < Localization.strings.Length; i++)
|
||||
{
|
||||
var strProto = strings.dataArray[index];
|
||||
strProto.ID = GetNextID();
|
||||
strings.dataIndices[strProto.ID] = index;
|
||||
strings.nameIndices[strings.dataArray[index].Name] = index;
|
||||
switch (Localization.Languages[i].lcId)
|
||||
{
|
||||
case Localization.LCID_ENUS:
|
||||
if (!Localization.LanguageLoaded(i) && Localization.Loaded)
|
||||
{
|
||||
Localization.LoadLanguage(i);
|
||||
}
|
||||
enIdx = i;
|
||||
break;
|
||||
case Localization.LCID_ZHCN:
|
||||
if (!Localization.LanguageLoaded(i) && Localization.Loaded)
|
||||
{
|
||||
Localization.LoadLanguage(i);
|
||||
}
|
||||
zhIdx = i;
|
||||
llen = Localization.strings[i].Length;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var enus = new string[StringsToAdd.Count];
|
||||
var zhcn = new string[StringsToAdd.Count];
|
||||
for (var i = 0; i < StringsToAdd.Count; i++)
|
||||
{
|
||||
var str = StringsToAdd[i];
|
||||
enus[i] = str.English;
|
||||
zhcn[i] = str.Chinese;
|
||||
indexer[str.Key] = llen + i;
|
||||
}
|
||||
|
||||
Localization.strings[enIdx] = Localization.strings[enIdx].Concat(enus).ToArray();
|
||||
if (enIdx == Localization.currentLanguageIndex)
|
||||
{
|
||||
Localization.currentStrings = Localization.strings[enIdx];
|
||||
}
|
||||
Localization.strings[zhIdx] = Localization.strings[zhIdx].Concat(zhcn).ToArray();
|
||||
if (zhIdx == Localization.currentLanguageIndex)
|
||||
{
|
||||
Localization.currentStrings = Localization.strings[zhIdx];
|
||||
}
|
||||
StringsToAdd.Clear();
|
||||
}
|
||||
|
||||
[HarmonyPostfix, HarmonyPriority(Priority.Last), HarmonyPatch(typeof(VFPreload), "InvokeOnLoadWorkEnded")]
|
||||
@@ -63,22 +101,4 @@ public static class I18N
|
||||
Apply();
|
||||
OnInitialized?.Invoke();
|
||||
}
|
||||
|
||||
private static int GetNextID()
|
||||
{
|
||||
var strings = LDB._strings;
|
||||
while (_nextID <= 12000)
|
||||
{
|
||||
if (!strings.dataIndices.ContainsKey(_nextID))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
_nextID++;
|
||||
}
|
||||
|
||||
var result = _nextID;
|
||||
_nextID++;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,9 @@
|
||||
|
||||
## Changelog
|
||||
|
||||
### 1.3.4
|
||||
* Support for game version 0.10.28.20759.
|
||||
|
||||
### 1.3.3
|
||||
* Fix a display issue on combobox of compression type.
|
||||
|
||||
@@ -137,6 +140,9 @@
|
||||
|
||||
## 更新日志
|
||||
|
||||
### 1.3.4
|
||||
* 支持游戏版本 0.10.28.20759。
|
||||
|
||||
### 1.3.3
|
||||
* 修复压缩类型下拉框显示问题。
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ public static class SaveUtil
|
||||
public static readonly Version VerifiedVersion = new()
|
||||
{
|
||||
Major = 0,
|
||||
Minor = 9,
|
||||
Release = 27,
|
||||
Minor = 10,
|
||||
Release = 28,
|
||||
};
|
||||
|
||||
private static string UnzipToFile(DecompressionStream lzStream, string fullPath)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "CompressSave",
|
||||
"version_number": "1.3.3",
|
||||
"version_number": "1.3.4",
|
||||
"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"]
|
||||
|
||||
Reference in New Issue
Block a user