mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-08 21:33:28 +08:00
PoolOpt 0.9.1
This commit is contained in:
@@ -85,7 +85,7 @@ public class PoolOptPatch : BaseUnityPlugin
|
||||
var factoryStorage = planet.factoryStorage;
|
||||
if (factoryStorage != null)
|
||||
{
|
||||
if (OptimizePool((in StorageComponent n) => n?.id ?? n.id, 64,
|
||||
if (OptimizePool((in StorageComponent n) => n?.id ?? 0, 64,
|
||||
ref factoryStorage.storagePool, ref factoryStorage.storageCursor, ref factoryStorage.storageCapacity,
|
||||
ref factoryStorage.storageRecycle, ref factoryStorage.storageRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(factoryStorage.storagePool)}` on Planet {planet.planetId}");
|
||||
@@ -244,7 +244,7 @@ public class PoolOptPatch : BaseUnityPlugin
|
||||
private static bool OptimizePool<T>(GetId<T> getter, int initCapacity, ref T[] pool, ref int cursor, ref int capacity, ref int[] recycle, ref int recycleCursor)
|
||||
{
|
||||
if (cursor <= 1) return false;
|
||||
if (recycleCursor == pool.Length)
|
||||
if (recycleCursor == cursor - 1)
|
||||
{
|
||||
cursor = 1;
|
||||
capacity = initCapacity;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<AssemblyName>PoolOpt</AssemblyName>
|
||||
<BepInExPluginGuid>org.soardev.poolopt</BepInExPluginGuid>
|
||||
<Description>DSP MOD - PoolOpt</Description>
|
||||
<Version>0.9.0</Version>
|
||||
<Version>0.9.1</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
#### Optimize memory pools on loading gamesaves
|
||||
#### 加载游戏存档时优化内存池的使用
|
||||
|
||||
# Changelog
|
||||
* 0.9.1
|
||||
+ Fix a bug that may cause game crash on shrinking storage memory pools.
|
||||
|
||||
# Notes
|
||||
* Does not optimize some rarely uses pools, mostly UI related.
|
||||
* Does not optimize solar sails' pool, please use button on dyson sphere panel from original game to clean it up.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "PoolOpt",
|
||||
"version_number": "0.9.0",
|
||||
"version_number": "0.9.1",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/PoolOpt",
|
||||
"description": "Optimize memory pools on loading gamesaves / 加载游戏存档时优化内存池的使用",
|
||||
"dependencies": [
|
||||
|
||||
Reference in New Issue
Block a user