mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-08 20:53:28 +08:00
PoolOpt 0.9.2
This commit is contained in:
@@ -25,7 +25,7 @@ public class PoolOptPatch : BaseUnityPlugin
|
||||
{
|
||||
if (planet == null) continue;
|
||||
var oldLen = planet.entityPool.Length;
|
||||
if (OptimizePool((in EntityData n) => n.id, 1024,
|
||||
if (OptimizePool((in EntityData n) => n.id, () => { planet.SetEntityCapacity(1024); },
|
||||
ref planet.entityPool, ref planet.entityCursor, ref planet.entityCapacity,
|
||||
ref planet.entityRecycle, ref planet.entityRecycleCursor))
|
||||
{
|
||||
@@ -42,7 +42,7 @@ public class PoolOptPatch : BaseUnityPlugin
|
||||
}
|
||||
|
||||
oldLen = planet.prebuildPool.Length;
|
||||
if (OptimizePool((in PrebuildData n) => n.id, 256,
|
||||
if (OptimizePool((in PrebuildData n) => n.id, () => { planet.SetPrebuildCapacity(256); },
|
||||
ref planet.prebuildPool, ref planet.prebuildCursor, ref planet.prebuildCapacity,
|
||||
ref planet.prebuildRecycle, ref planet.prebuildRecycleCursor))
|
||||
{
|
||||
@@ -57,27 +57,27 @@ public class PoolOptPatch : BaseUnityPlugin
|
||||
var cargoTraffic = planet.cargoTraffic;
|
||||
if (cargoTraffic != null)
|
||||
{
|
||||
if (OptimizePool((in BeltComponent n) => n.id, 16,
|
||||
if (OptimizePool((in BeltComponent n) => n.id, () => { cargoTraffic.SetBeltCapacity(16); },
|
||||
ref cargoTraffic.beltPool, ref cargoTraffic.beltCursor, ref cargoTraffic.beltCapacity,
|
||||
ref cargoTraffic.beltRecycle, ref cargoTraffic.beltRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.beltPool)}` on Planet {planet.planetId}");
|
||||
if (OptimizePool((in CargoPath n) => n?.id ?? 0, 16,
|
||||
if (OptimizePool((in CargoPath n) => n?.id ?? 0, () => { cargoTraffic.SetPathCapacity(16); },
|
||||
ref cargoTraffic.pathPool, ref cargoTraffic.pathCursor, ref cargoTraffic.pathCapacity,
|
||||
ref cargoTraffic.pathRecycle, ref cargoTraffic.pathRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.pathPool)}` on Planet {planet.planetId}");
|
||||
if (OptimizePool((in SplitterComponent n) => n.id, 16,
|
||||
if (OptimizePool((in SplitterComponent n) => n.id, () => { cargoTraffic.SetSplitterCapacity(16); },
|
||||
ref cargoTraffic.splitterPool, ref cargoTraffic.splitterCursor, ref cargoTraffic.splitterCapacity,
|
||||
ref cargoTraffic.splitterRecycle, ref cargoTraffic.splitterRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.splitterPool)}` on Planet {planet.planetId}");
|
||||
if (OptimizePool((in MonitorComponent n) => n.id, 16,
|
||||
if (OptimizePool((in MonitorComponent n) => n.id, () => { cargoTraffic.SetMonitorCapacity(16); },
|
||||
ref cargoTraffic.monitorPool, ref cargoTraffic.monitorCursor, ref cargoTraffic.monitorCapacity,
|
||||
ref cargoTraffic.monitorRecycle, ref cargoTraffic.monitorRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.monitorPool)}` on Planet {planet.planetId}");
|
||||
if (OptimizePool((in SpraycoaterComponent n) => n.id, 16,
|
||||
if (OptimizePool((in SpraycoaterComponent n) => n.id, () => { cargoTraffic.SetSpraycoaterCapacity(16); },
|
||||
ref cargoTraffic.spraycoaterPool, ref cargoTraffic.spraycoaterCursor, ref cargoTraffic.spraycoaterCapacity,
|
||||
ref cargoTraffic.spraycoaterRecycle, ref cargoTraffic.spraycoaterRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.spraycoaterPool)}` on Planet {planet.planetId}");
|
||||
if (OptimizePool((in PilerComponent n) => n.id, 16,
|
||||
if (OptimizePool((in PilerComponent n) => n.id, () => { cargoTraffic.SetPilerCapacity(16); },
|
||||
ref cargoTraffic.pilerPool, ref cargoTraffic.pilerCursor, ref cargoTraffic.pilerCapacity,
|
||||
ref cargoTraffic.pilerRecycle, ref cargoTraffic.pilerRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.pilerPool)}` on Planet {planet.planetId}");
|
||||
@@ -85,11 +85,11 @@ public class PoolOptPatch : BaseUnityPlugin
|
||||
var factoryStorage = planet.factoryStorage;
|
||||
if (factoryStorage != null)
|
||||
{
|
||||
if (OptimizePool((in StorageComponent n) => n?.id ?? 0, 64,
|
||||
if (OptimizePool((in StorageComponent n) => n?.id ?? 0, () => { factoryStorage.SetStorageCapacity(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}");
|
||||
if (OptimizePool((in TankComponent n) => n.id, 256,
|
||||
if (OptimizePool((in TankComponent n) => n.id, () => { factoryStorage.SetTankCapacity(256); },
|
||||
ref factoryStorage.tankPool, ref factoryStorage.tankCursor, ref factoryStorage.tankCapacity,
|
||||
ref factoryStorage.tankRecycle, ref factoryStorage.tankRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(factoryStorage.tankPool)}` on Planet {planet.planetId}");
|
||||
@@ -97,31 +97,31 @@ public class PoolOptPatch : BaseUnityPlugin
|
||||
var factorySystem = planet.factorySystem;
|
||||
if (factorySystem != null)
|
||||
{
|
||||
if (OptimizePool((in MinerComponent n) => n.id, 256,
|
||||
if (OptimizePool((in MinerComponent n) => n.id, () => { factorySystem.SetMinerCapacity(256); },
|
||||
ref factorySystem.minerPool, ref factorySystem.minerCursor, ref factorySystem.minerCapacity,
|
||||
ref factorySystem.minerRecycle, ref factorySystem.minerRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.minerPool)}` on Planet {planet.planetId}");
|
||||
if (OptimizePool((in InserterComponent n) => n.id, 256,
|
||||
if (OptimizePool((in InserterComponent n) => n.id, () => { factorySystem.SetInserterCapacity(256); },
|
||||
ref factorySystem.inserterPool, ref factorySystem.inserterCursor, ref factorySystem.inserterCapacity,
|
||||
ref factorySystem.inserterRecycle, ref factorySystem.inserterRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.inserterPool)}` on Planet {planet.planetId}");
|
||||
if (OptimizePool((in AssemblerComponent n) => n.id, 256,
|
||||
if (OptimizePool((in AssemblerComponent n) => n.id, () => { factorySystem.SetAssemblerCapacity(256); },
|
||||
ref factorySystem.assemblerPool, ref factorySystem.assemblerCursor, ref factorySystem.assemblerCapacity,
|
||||
ref factorySystem.assemblerRecycle, ref factorySystem.assemblerRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.assemblerPool)}` on Planet {planet.planetId}");
|
||||
if (OptimizePool((in FractionatorComponent n) => n.id, 32,
|
||||
if (OptimizePool((in FractionatorComponent n) => n.id, () => { factorySystem.SetFractionatorCapacity(32); },
|
||||
ref factorySystem.fractionatorPool, ref factorySystem.fractionatorCursor, ref factorySystem.fractionatorCapacity,
|
||||
ref factorySystem.fractionatorRecycle, ref factorySystem.fractionatorRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.fractionatorPool)}` on Planet {planet.planetId}");
|
||||
if (OptimizePool((in EjectorComponent n) => n.id, 32,
|
||||
if (OptimizePool((in EjectorComponent n) => n.id, () => { factorySystem.SetEjectorCapacity(32); },
|
||||
ref factorySystem.ejectorPool, ref factorySystem.ejectorCursor, ref factorySystem.ejectorCapacity,
|
||||
ref factorySystem.ejectorRecycle, ref factorySystem.ejectorRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.ejectorPool)}` on Planet {planet.planetId}");
|
||||
if (OptimizePool((in SiloComponent n) => n.id, 32,
|
||||
if (OptimizePool((in SiloComponent n) => n.id, () => { factorySystem.SetSiloCapacity(32); },
|
||||
ref factorySystem.siloPool, ref factorySystem.siloCursor, ref factorySystem.siloCapacity,
|
||||
ref factorySystem.siloRecycle, ref factorySystem.siloRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.siloPool)}` on Planet {planet.planetId}");
|
||||
if (OptimizePool((in LabComponent n) => n.id, 256,
|
||||
if (OptimizePool((in LabComponent n) => n.id, () => { factorySystem.SetLabCapacity(256); },
|
||||
ref factorySystem.labPool, ref factorySystem.labCursor, ref factorySystem.labCapacity,
|
||||
ref factorySystem.labRecycle, ref factorySystem.labRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.labPool)}` on Planet {planet.planetId}");
|
||||
@@ -129,11 +129,11 @@ public class PoolOptPatch : BaseUnityPlugin
|
||||
var transport = planet.transport;
|
||||
if (transport != null)
|
||||
{
|
||||
if (OptimizePool((in StationComponent n) => n?.id ?? 0, 16,
|
||||
if (OptimizePool((in StationComponent n) => n?.id ?? 0, () => { transport.SetStationCapacity(16); },
|
||||
ref transport.stationPool, ref transport.stationCursor, ref transport.stationCapacity,
|
||||
ref transport.stationRecycle, ref transport.stationRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(transport.stationPool)}` on Planet {planet.planetId}");
|
||||
if (OptimizePool((in DispenserComponent n) => n?.id ?? 0, 8,
|
||||
if (OptimizePool((in DispenserComponent n) => n?.id ?? 0, () => { transport.SetDispenserCapacity(8); },
|
||||
ref transport.dispenserPool, ref transport.dispenserCursor, ref transport.dispenserCapacity,
|
||||
ref transport.dispenserRecycle, ref transport.dispenserRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(transport.dispenserPool)}` on Planet {planet.planetId}");
|
||||
@@ -142,27 +142,27 @@ public class PoolOptPatch : BaseUnityPlugin
|
||||
var powerSystem = planet.powerSystem;
|
||||
if (powerSystem != null)
|
||||
{
|
||||
if (OptimizePool((in PowerGeneratorComponent n) => n.id, 8,
|
||||
if (OptimizePool((in PowerGeneratorComponent n) => n.id, () => { powerSystem.SetGeneratorCapacity(8); },
|
||||
ref powerSystem.genPool, ref powerSystem.genCursor, ref powerSystem.genCapacity,
|
||||
ref powerSystem.genRecycle, ref powerSystem.genRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.genPool)}` on Planet {planet.planetId}");
|
||||
if (OptimizePool((in PowerNodeComponent n) => n.id, 8,
|
||||
if (OptimizePool((in PowerNodeComponent n) => n.id, () => { powerSystem.SetNodeCapacity(8); },
|
||||
ref powerSystem.nodePool, ref powerSystem.nodeCursor, ref powerSystem.nodeCapacity,
|
||||
ref powerSystem.nodeRecycle, ref powerSystem.nodeRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.nodePool)}` on Planet {planet.planetId}");
|
||||
if (OptimizePool((in PowerConsumerComponent n) => n.id, 8,
|
||||
if (OptimizePool((in PowerConsumerComponent n) => n.id, () => { powerSystem.SetConsumerCapacity(8); },
|
||||
ref powerSystem.consumerPool, ref powerSystem.consumerCursor, ref powerSystem.consumerCapacity,
|
||||
ref powerSystem.consumerRecycle, ref powerSystem.consumerRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.consumerPool)}` on Planet {planet.planetId}");
|
||||
if (OptimizePool((in PowerAccumulatorComponent n) => n.id, 8,
|
||||
if (OptimizePool((in PowerAccumulatorComponent n) => n.id, () => { powerSystem.SetAccumulatorCapacity(8); },
|
||||
ref powerSystem.accPool, ref powerSystem.accCursor, ref powerSystem.accCapacity,
|
||||
ref powerSystem.accRecycle, ref powerSystem.accRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.accPool)}` on Planet {planet.planetId}");
|
||||
if (OptimizePool((in PowerExchangerComponent n) => n.id, 8,
|
||||
if (OptimizePool((in PowerExchangerComponent n) => n.id, () => { powerSystem.SetExchangerCapacity(8); },
|
||||
ref powerSystem.excPool, ref powerSystem.excCursor, ref powerSystem.excCapacity,
|
||||
ref powerSystem.excRecycle, ref powerSystem.excRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.excPool)}` on Planet {planet.planetId}");
|
||||
if (OptimizePool((in PowerNetwork n) => n?.id ?? 0, 8,
|
||||
if (OptimizePool((in PowerNetwork n) => n?.id ?? 0, () => { powerSystem.SetNetworkCapacity(8); },
|
||||
ref powerSystem.netPool, ref powerSystem.netCursor, ref powerSystem.netCapacity,
|
||||
ref powerSystem.netRecycle, ref powerSystem.netRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.netPool)}` on Planet {planet.planetId}");
|
||||
@@ -171,23 +171,17 @@ public class PoolOptPatch : BaseUnityPlugin
|
||||
var trashContainer = GameMain.data.trashSystem?.container;
|
||||
if (trashContainer != null)
|
||||
{
|
||||
var oldLen = trashContainer.trashObjPool.Length;
|
||||
if (OptimizePool((in TrashObject n) => n.item == 0, 16,
|
||||
if (OptimizePool((in TrashObject n) => n.item == 0, () => { trashContainer.SetTrashCapacity(16); },
|
||||
ref trashContainer.trashObjPool, ref trashContainer.trashCursor, ref trashContainer.trashCapacity,
|
||||
ref trashContainer.trashRecycle, ref trashContainer.trashRecycleCursor))
|
||||
{
|
||||
if (oldLen != trashContainer.trashObjPool.Length)
|
||||
{
|
||||
var newLen = trashContainer.trashObjPool.Length;
|
||||
trashContainer.trashDataPool = new TrashData[newLen];
|
||||
}
|
||||
Logger.LogDebug($"Optimized `{nameof(trashContainer.trashObjPool)}`");
|
||||
}
|
||||
}
|
||||
var warningSystem = GameMain.data.warningSystem;
|
||||
if (warningSystem != null)
|
||||
{
|
||||
if (OptimizePool((in WarningData n) => n.id, 32,
|
||||
if (OptimizePool((in WarningData n) => n.id, () => { warningSystem.SetWarningCapacity(32); },
|
||||
ref warningSystem.warningPool, ref warningSystem.warningCursor, ref warningSystem.warningCapacity,
|
||||
ref warningSystem.warningRecycle, ref warningSystem.warningRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(warningSystem.warningPool)}`");
|
||||
@@ -198,11 +192,11 @@ public class PoolOptPatch : BaseUnityPlugin
|
||||
foreach (var dysonSphere in dysonSpheres)
|
||||
{
|
||||
if (dysonSphere == null) continue;
|
||||
if (OptimizePool((in DysonRocket n) => n.id, 256,
|
||||
if (OptimizePool((in DysonRocket n) => n.id, () => { dysonSphere.SetRocketCapacity(256); },
|
||||
ref dysonSphere.rocketPool, ref dysonSphere.rocketCursor, ref dysonSphere.rocketCapacity,
|
||||
ref dysonSphere.rocketRecycle, ref dysonSphere.rocketRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(dysonSphere.rocketPool)}` on Star {dysonSphere.starData.id}");
|
||||
if (OptimizePool((in DysonNodeRData n) => n.id, 128,
|
||||
if (OptimizePool((in DysonNodeRData n) => n.id, () => { dysonSphere.SetNrdCapacity(128); },
|
||||
ref dysonSphere.nrdPool, ref dysonSphere.nrdCursor, ref dysonSphere.nrdCapacity,
|
||||
ref dysonSphere.nrdRecycle, ref dysonSphere.nrdRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(dysonSphere.nrdPool)}` on Star {dysonSphere.starData.id}");
|
||||
@@ -210,15 +204,15 @@ public class PoolOptPatch : BaseUnityPlugin
|
||||
foreach (var layer in dysonSphere.layersSorted)
|
||||
{
|
||||
if (layer == null) continue;
|
||||
if (OptimizePool((in DysonNode n) => n?.id ?? 0, 64,
|
||||
if (OptimizePool((in DysonNode n) => n?.id ?? 0, () => { layer.SetNodeCapacity(64); },
|
||||
ref layer.nodePool, ref layer.nodeCursor, ref layer.nodeCapacity,
|
||||
ref layer.nodeRecycle, ref layer.nodeRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(layer.nodePool)}` on Star {dysonSphere.starData.id} layer {layer.id}");
|
||||
if (OptimizePool((in DysonFrame n) => n?.id ?? 0, 64,
|
||||
if (OptimizePool((in DysonFrame n) => n?.id ?? 0, () => { layer.SetFrameCapacity(64); },
|
||||
ref layer.framePool, ref layer.frameCursor, ref layer.frameCapacity,
|
||||
ref layer.frameRecycle, ref layer.frameRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(layer.framePool)}` on Star {dysonSphere.starData.id} layer {layer.id}");
|
||||
if (OptimizePool((in DysonShell n) => n?.id ?? 0, 64,
|
||||
if (OptimizePool((in DysonShell n) => n?.id ?? 0, () => { layer.SetShellCapacity(64); },
|
||||
ref layer.shellPool, ref layer.shellCursor, ref layer.shellCapacity,
|
||||
ref layer.shellRecycle, ref layer.shellRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(layer.shellPool)}` on Star {dysonSphere.starData.id} layer {layer.id}");
|
||||
@@ -227,7 +221,7 @@ public class PoolOptPatch : BaseUnityPlugin
|
||||
var swarm = dysonSphere.swarm;
|
||||
if (swarm != null)
|
||||
{
|
||||
if (OptimizePool((in SailBullet n) => n.id, 128,
|
||||
if (OptimizePool((in SailBullet n) => n.id, () => { swarm.SetBulletCapacity(128); },
|
||||
ref swarm.bulletPool, ref swarm.bulletCursor, ref swarm.bulletCapacity,
|
||||
ref swarm.bulletRecycle, ref swarm.bulletRecycleCursor))
|
||||
Logger.LogDebug($"Optimized `{nameof(swarm.bulletPool)}` on Star {dysonSphere.starData.id}");
|
||||
@@ -240,17 +234,17 @@ public class PoolOptPatch : BaseUnityPlugin
|
||||
|
||||
private delegate int GetId<T>(in T s);
|
||||
|
||||
private delegate void SetToInitialCapacity();
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
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)
|
||||
private static bool OptimizePool<T>(GetId<T> getter, SetToInitialCapacity initCapacity, ref T[] pool, ref int cursor, ref int capacity, ref int[] recycle, ref int recycleCursor)
|
||||
{
|
||||
if (cursor <= 1) return false;
|
||||
if (recycleCursor == cursor - 1)
|
||||
{
|
||||
cursor = 1;
|
||||
capacity = initCapacity;
|
||||
pool = new T[initCapacity];
|
||||
recycle = new int[initCapacity];
|
||||
recycleCursor = 0;
|
||||
initCapacity();
|
||||
Logger.LogDebug("Resetted pool to initial status");
|
||||
return true;
|
||||
}
|
||||
@@ -265,10 +259,8 @@ public class PoolOptPatch : BaseUnityPlugin
|
||||
if (pos == 0)
|
||||
{
|
||||
cursor = 1;
|
||||
capacity = initCapacity;
|
||||
pool = new T[initCapacity];
|
||||
recycle = new int[initCapacity];
|
||||
recycleCursor = 0;
|
||||
initCapacity();
|
||||
Logger.LogDebug("Resetted pool to initial status");
|
||||
return true;
|
||||
}
|
||||
@@ -284,31 +276,38 @@ public class PoolOptPatch : BaseUnityPlugin
|
||||
private delegate bool IsEmpty<T>(in T s);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static bool OptimizePool<T>(IsEmpty<T> checker, int initCapacity, ref T[] pool, ref int cursor, ref int capacity, ref int[] recycle, ref int recycleCursor)
|
||||
private static bool OptimizePool<T>(IsEmpty<T> checker, SetToInitialCapacity initCapacity, ref T[] pool, ref int cursor, ref int capacity, ref int[] recycle, ref int recycleCursor)
|
||||
{
|
||||
if (cursor <= 1) return false;
|
||||
var pos = cursor;
|
||||
if (recycleCursor == cursor - 1)
|
||||
{
|
||||
cursor = 1;
|
||||
recycleCursor = 0;
|
||||
initCapacity();
|
||||
Logger.LogDebug("Resetted pool to initial status");
|
||||
return true;
|
||||
}
|
||||
var pos = cursor - 1;
|
||||
while (pos > 0)
|
||||
{
|
||||
if (!checker(pool[pos])) break;
|
||||
pos--;
|
||||
}
|
||||
|
||||
if (pos == cursor) return false;
|
||||
if (pos + 1 == cursor) return false;
|
||||
if (pos == 0)
|
||||
{
|
||||
cursor = 1;
|
||||
capacity = initCapacity;
|
||||
pool = new T[initCapacity];
|
||||
recycle = new int[initCapacity];
|
||||
recycleCursor = 0;
|
||||
initCapacity();
|
||||
return true;
|
||||
}
|
||||
|
||||
cursor = pos;
|
||||
cursor = pos + 1;
|
||||
Array.Sort(recycle, 0, recycleCursor);
|
||||
var idx = Array.BinarySearch(recycle, 0, recycleCursor, pos + 1);
|
||||
recycleCursor = idx < 0 ? ~idx : idx;
|
||||
Logger.LogDebug($"Shrinked pool size to {cursor} and recycle size to {recycleCursor}");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
<AssemblyName>PoolOpt</AssemblyName>
|
||||
<BepInExPluginGuid>org.soardev.poolopt</BepInExPluginGuid>
|
||||
<Description>DSP MOD - PoolOpt</Description>
|
||||
<Version>0.9.1</Version>
|
||||
<Version>0.9.2</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
#### 加载游戏存档时优化内存池的使用
|
||||
|
||||
# Changelog
|
||||
* 0.9.2
|
||||
+ Fix a issue that may delete used slots in trash pool
|
||||
+ Fix compatibility issue with other mods (expecially [DSPOptimizations](https://dsp.thunderstore.io/package/Selsion/DSPOptimizations/)) by calling `SetXXXCapacity()` on shrinking capacity of pools
|
||||
* 0.9.1
|
||||
+ Fix a bug that may cause game crash on shrinking storage memory pools.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "PoolOpt",
|
||||
"version_number": "0.9.1",
|
||||
"version_number": "0.9.2",
|
||||
"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