Compare commits

7 Commits
34 changed files with 783 additions and 1148 deletions
Binary file not shown.
Binary file not shown.
+6
View File
@@ -3,6 +3,9 @@
## Changlog
* 2.4.0
* Support game version 0.10.33
* `Generate illegal dyson shell`: This function is open to all users now, enabling certain config entry is not needed any more.
* 2.3.32
* `Complete Dyson Sphere Shells instantly`: Fix a crash.
* 2.3.31
@@ -162,6 +165,9 @@
## 更新日志
* 2.4.0
* 支持游戏版本 0.10.33
* `生成仙术戴森壳`:此功能现在对所有用户开放,不再需要启用特定的配置项。
* 2.3.32
* `立即完成戴森壳建造`:修复了一个崩溃问题
* 2.3.31
+4 -6
View File
@@ -5,7 +5,7 @@
<TargetFramework>net472</TargetFramework>
<BepInExPluginGuid>org.soardev.cheatenabler</BepInExPluginGuid>
<Description>DSP MOD - CheatEnabler</Description>
<Version>2.3.32</Version>
<Version>2.4.0</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<PackageId>CheatEnabler</PackageId>
@@ -16,15 +16,14 @@
<ItemGroup>
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" />
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
</ItemGroup>
<!--
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>..\AssemblyFromGame\Assembly-CSharp.dll</HintPath>
@@ -33,13 +32,12 @@
<HintPath>..\AssemblyFromGame\UnityEngine.UI.dll</HintPath>
</Reference>
</ItemGroup>
-->
<ItemGroup>
<ProjectReference Include="..\UXAssist\UXAssist.csproj" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="del /F /Q package\$(ProjectName)-$(Version).zip&#xA;powershell Compress-Archive -Force -DestinationPath 'package/$(ProjectName)-$(Version).zip' -Path '$(TargetPath)', package/icon.png, package/manifest.json, README.md, CHANGELOG.md" />
</Target>
</Project>
@@ -5,7 +5,6 @@ using System.Threading;
using System.Threading.Tasks;
using BepInEx.Configuration;
using HarmonyLib;
using Unity.Jobs;
using UnityEngine;
using UXAssist.Common;
+4 -4
View File
@@ -4,7 +4,7 @@ using System.Reflection.Emit;
using BepInEx.Configuration;
using HarmonyLib;
using UXAssist.Common;
using GameLogic = UXAssist.Common.GameLogic;
using GameLogicProc = UXAssist.Common.GameLogic;
namespace CheatEnabler.Patches;
@@ -134,12 +134,12 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
{
UpdateSailLifeTime();
UpdateSailsCacheForThisGame();
GameLogic.OnGameBegin += GameMain_Begin_Postfix;
GameLogicProc.OnGameBegin += GameMain_Begin_Postfix;
}
protected override void OnDisable()
{
GameLogic.OnGameBegin -= GameMain_Begin_Postfix;
GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix;
}
private static void UpdateSailLifeTime()
@@ -296,7 +296,7 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
}
[HarmonyPrefix]
[HarmonyPatch(typeof(DysonSwarm), "GameTick")]
[HarmonyPatch(typeof(DysonSwarm), nameof(DysonSwarm.GameTick))]
public static void DysonSwarm_GameTick_Prefix(DysonSwarm __instance, long time)
{
var index = __instance.starData.index;
+14 -21
View File
@@ -8,7 +8,7 @@ using HarmonyLib;
using UnityEngine;
using UnityEngine.UI;
using UXAssist.Common;
using GameLogic = UXAssist.Common.GameLogic;
using GameLogicProc = UXAssist.Common.GameLogic;
namespace CheatEnabler.Patches;
@@ -94,14 +94,14 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
ControlPanelRemoteLogistics.Enable(ControlPanelRemoteLogisticsEnabled.Value);
Enable(true);
CargoTrafficPatch.Enable(true);
GameLogic.OnGameBegin += GameMain_Begin_Postfix_For_ImmBuild;
GameLogic.OnDataLoaded += OnDataLoaded;
GameLogicProc.OnGameBegin += GameMain_Begin_Postfix_For_ImmBuild;
GameLogicProc.OnDataLoaded += OnDataLoaded;
}
public static void Uninit()
{
GameLogic.OnDataLoaded -= OnDataLoaded;
GameLogic.OnGameBegin -= GameMain_Begin_Postfix_For_ImmBuild;
GameLogicProc.OnDataLoaded -= OnDataLoaded;
GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix_For_ImmBuild;
CargoTrafficPatch.Enable(false);
Enable(false);
ImmediateBuild.Enable(false);
@@ -496,7 +496,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
}
[HarmonyPostfix]
[HarmonyPatch(typeof(StorageComponent), "GetItemCount", typeof(int))]
[HarmonyPatch(typeof(StorageComponent), nameof(StorageComponent.GetItemCount), typeof(int))]
public static void GetItemCountPatch(StorageComponent __instance, int itemId, ref int __result)
{
if (__result > 99) return;
@@ -629,12 +629,12 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
protected override void OnEnable()
{
InitSignalBelts();
GameLogic.OnGameBegin += GameMain_Begin_Postfix;
GameLogicProc.OnGameBegin += GameMain_Begin_Postfix;
}
protected override void OnDisable()
{
GameLogic.OnGameBegin -= GameMain_Begin_Postfix;
GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix;
_initialized = false;
_signalBelts = null;
_signalBeltsCapacity = 0;
@@ -995,7 +995,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
var data = GameMain.data;
var factories = data?.factories;
if (factories == null) return;
PerformanceMonitor.BeginSample(ECpuWorkEntry.Belt);
DeepProfiler.BeginSample(DPEntry.Belt);
for (var index = data.factoryCount - 1; index >= 0; index--)
{
var factory = factories[index];
@@ -1123,23 +1123,16 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
}
}
PerformanceMonitor.EndSample(ECpuWorkEntry.Belt);
DeepProfiler.EndSample(DPEntry.Belt);
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(GameData), "GameTick")]
public static IEnumerable<CodeInstruction> GameData_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions)
[HarmonyPostfix]
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic.OnFactoryFrameBegin))]
public static void GameLogic_OnFactoryFrameBegin_Postfix()
{
var matcher = new CodeMatcher(instructions);
matcher.MatchForward(false,
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(PerformanceMonitor), nameof(PerformanceMonitor.EndSample)))
).Advance(1).Insert(
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(BeltSignalGenerator), nameof(ProcessBeltSignals)))
);
return matcher.InstructionEnumeration();
ProcessBeltSignals();
}
/* BEGIN: Item sources calculation */
private static readonly Dictionary<int, ItemSource> ItemSources = [];
private static bool _itemSourcesInitialized;
+8 -8
View File
@@ -64,19 +64,19 @@ public static class GamePatch
}
[HarmonyPrefix]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyBeforeGameSave")]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnAssemblerRecipePick")]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnGameBegin")]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnMechaForgeTaskComplete")]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnUnlockTech")]
[HarmonyPatch(typeof(AbnormalityLogic), "NotifyOnUseConsole")]
[HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyBeforeGameSave))]
[HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnAssemblerRecipePick))]
[HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnGameBegin))]
[HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnMechaForgeTaskComplete))]
[HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnUnlockTech))]
[HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.NotifyOnUseConsole))]
private static bool DisableAbnormalLogic()
{
return false;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(AbnormalityLogic), "InitDeterminators")]
[HarmonyPatch(typeof(AbnormalityLogic), nameof(AbnormalityLogic.InitDeterminators))]
private static void DisableAbnormalDeterminators(AbnormalityLogic __instance)
{
_savedDeterminators = __instance.determinators;
@@ -282,7 +282,7 @@ public static class GamePatch
}
}
history.VarifyTechQueue();
history.VerifyTechQueue();
if (history.currentTech != history.techQueue[0])
{
history.currentTech = history.techQueue[0];
+58 -25
View File
@@ -31,10 +31,10 @@ public static class ResourcePatch
private class InfiniteResource : PatchImpl<InfiniteResource>
{
static private readonly float InfiniteResourceRate = 0f;
[HarmonyTranspiler]
[HarmonyPatch(typeof(FactorySystem), nameof(FactorySystem.GameTick), typeof(long), typeof(bool))]
[HarmonyPatch(typeof(FactorySystem), nameof(FactorySystem.GameTick), typeof(long), typeof(bool), typeof(int), typeof(int), typeof(int))]
[HarmonyPatch(typeof(ItemProto), nameof(ItemProto.GetPropValue))]
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic._miner_parallel))]
[HarmonyPatch(typeof(PlanetTransport), nameof(PlanetTransport.GameTick))]
[HarmonyPatch(typeof(UIChartAstroResource), nameof(UIChartAstroResource.CalculateMaxAmount))]
[HarmonyPatch(typeof(UIChartVeinGroup), nameof(UIChartVeinGroup.CalculateMaxAmount))]
@@ -42,18 +42,29 @@ public static class ResourcePatch
[HarmonyPatch(typeof(UIControlPanelVeinCollectorPanel), nameof(UIControlPanelVeinCollectorPanel._OnUpdate))]
[HarmonyPatch(typeof(UIMinerWindow), nameof(UIMinerWindow._OnUpdate))]
[HarmonyPatch(typeof(UIMiningUpgradeLabel), nameof(UIMiningUpgradeLabel.Update))]
[HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.RefreshValues))]
[HarmonyPatch(typeof(UIVeinCollectorPanel), nameof(UIVeinCollectorPanel._OnUpdate))]
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
matcher.MatchForward(false,
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(GameHistoryData), nameof(GameHistoryData.miningCostRate)))
new CodeMatch(ci => (ci.opcode == OpCodes.Ldfld || ci.opcode == OpCodes.Ldflda) && ci.OperandIs(AccessTools.Field(typeof(GameHistoryData), nameof(GameHistoryData.miningCostRate))))
).Repeat(codeMatcher =>
codeMatcher.RemoveInstruction().InsertAndAdvance(
new CodeInstruction(OpCodes.Pop),
new CodeInstruction(OpCodes.Ldc_R4, 0f)
)
{
if (codeMatcher.Instruction.opcode == OpCodes.Ldfld)
{
codeMatcher.RemoveInstruction().InsertAndAdvance(
new CodeInstruction(OpCodes.Pop),
new CodeInstruction(OpCodes.Ldc_R4, InfiniteResourceRate)
);
}
else
{
codeMatcher.RemoveInstruction().InsertAndAdvance(
new CodeInstruction(OpCodes.Pop),
new CodeInstruction(OpCodes.Ldsflda, AccessTools.Field(typeof(InfiniteResource), nameof(InfiniteResourceRate)))
);
}
}
);
return matcher.InstructionEnumeration();
}
@@ -61,29 +72,51 @@ public static class ResourcePatch
private class FastMining : PatchImpl<FastMining>
{
static private readonly float FastMiningSpeed = 2400f;
[HarmonyTranspiler]
[HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool))]
[HarmonyPatch(typeof(FactorySystem), "GameTick", typeof(long), typeof(bool), typeof(int), typeof(int), typeof(int))]
[HarmonyPatch(typeof(ItemProto), "GetPropValue")]
[HarmonyPatch(typeof(PlanetTransport), "GameTick")]
[HarmonyPatch(typeof(UIMinerWindow), "_OnUpdate")]
[HarmonyPatch(typeof(UIMiningUpgradeLabel), "Update")]
[HarmonyPatch(typeof(UIPlanetDetail), "OnPlanetDataSet")]
[HarmonyPatch(typeof(UIPlanetDetail), "RefreshDynamicProperties")]
[HarmonyPatch(typeof(UIStarDetail), "OnStarDataSet")]
[HarmonyPatch(typeof(UIStarDetail), "RefreshDynamicProperties")]
[HarmonyPatch(typeof(UIStationStorage), "RefreshValues")]
[HarmonyPatch(typeof(UIVeinCollectorPanel), "_OnUpdate")]
[HarmonyPatch(typeof(AstroResourceStatPlan), nameof(AstroResourceStatPlan.AddPlanetResources))]
[HarmonyPatch(typeof(BuildingGizmo), nameof(BuildingGizmo.Update))]
[HarmonyPatch(typeof(FactorySystem), nameof(FactorySystem.GameTick), typeof(long), typeof(bool))]
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic._miner_parallel))]
[HarmonyPatch(typeof(ItemProto), nameof(ItemProto.GetPropValue))]
[HarmonyPatch(typeof(PlanetTransport), nameof(PlanetTransport.GameTick))]
[HarmonyPatch(typeof(ProductionExtraInfoCalculator), nameof(ProductionExtraInfoCalculator.CalculateFactory))]
[HarmonyPatch(typeof(UIChartAstroResource), nameof(UIChartAstroResource.CalculateMaxAmount))]
[HarmonyPatch(typeof(UIChartVeinGroup), nameof(UIChartVeinGroup.CalculateMaxAmount))]
[HarmonyPatch(typeof(UIControlPanelStationStorage), nameof(UIControlPanelStationStorage.RefreshValues))]
[HarmonyPatch(typeof(UIControlPanelVeinCollectorPanel), nameof(UIControlPanelVeinCollectorPanel._OnUpdate))]
[HarmonyPatch(typeof(UIMinerWindow), nameof(UIMinerWindow._OnUpdate))]
[HarmonyPatch(typeof(UIMiningUpgradeLabel), nameof(UIMiningUpgradeLabel.Update))]
[HarmonyPatch(typeof(UIPlanetDetail), nameof(UIPlanetDetail.OnPlanetDataSet))]
[HarmonyPatch(typeof(UIPlanetDetail), nameof(UIPlanetDetail.RefreshDynamicProperties))]
[HarmonyPatch(typeof(UIReferenceSpeedTip), nameof(UIReferenceSpeedTip.AddEntryDataWithFactory))]
[HarmonyPatch(typeof(UIStarDetail), nameof(UIStarDetail.OnStarDataSet))]
[HarmonyPatch(typeof(UIStarDetail), nameof(UIStarDetail.RefreshDynamicProperties))]
[HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.RefreshValues))]
[HarmonyPatch(typeof(UIVeinCollectorPanel), nameof(UIVeinCollectorPanel._OnUpdate))]
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
matcher.MatchForward(false,
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(GameHistoryData), nameof(GameHistoryData.miningSpeedScale)))
new CodeMatch(ci => (ci.opcode == OpCodes.Ldfld || ci.opcode == OpCodes.Ldflda) && ci.OperandIs(AccessTools.Field(typeof(GameHistoryData), nameof(GameHistoryData.miningSpeedScale))))
).Repeat(codeMatcher =>
codeMatcher.RemoveInstruction().InsertAndAdvance(
new CodeInstruction(OpCodes.Pop),
new CodeInstruction(OpCodes.Ldc_R4, 2400f)
)
{
if (codeMatcher.Instruction.opcode == OpCodes.Ldfld)
{
codeMatcher.RemoveInstruction().InsertAndAdvance(
new CodeInstruction(OpCodes.Pop),
new CodeInstruction(OpCodes.Ldc_R4, FastMiningSpeed)
);
}
else
{
codeMatcher.RemoveInstruction().InsertAndAdvance(
new CodeInstruction(OpCodes.Pop),
new CodeInstruction(OpCodes.Ldsflda, AccessTools.Field(typeof(FastMining), nameof(FastMiningSpeed)))
);
}
}
);
return matcher.InstructionEnumeration();
}
+2 -2
View File
@@ -49,7 +49,7 @@
* Eject anyway
* Unlock Dyson Sphere max orbit radius
* Complete Dyson Sphere Shells instantly
* Buttons for creating illegal Dyson Sphere Shells, you must enable `IllegalDysonShellFunctionsEnabled` of `DysonSphere` section in config to see them.
* Buttons for creating illegal Dyson Sphere Shells, you must enable `IllegalDysonShellFunctionsEnabled` of `DysonSphere` section in config to see the last 2 buttons.
* Generate an illegal dyson shell
* Keep max production shells and remove others
* Duplicate shells from that with highest production
@@ -123,7 +123,7 @@
* 全球弹射
* 解锁戴森球最大轨道半径
* 立即完成戴森壳建造
* 用于制作仙术戴森壳的按钮,你必须在设置文件里开启`DysonSphere`分类的`IllegalDysonShellFunctionsEnabled`才能看到它们
* 用于制作仙术戴森壳的按钮,你必须在设置文件里开启`DysonSphere`分类的`IllegalDysonShellFunctionsEnabled`才能看到后面两个按钮
* 生成单层仙术戴森壳
* 保留发电量最高的戴森壳并移除其他戴森壳
* 从发电量最高的壳复制戴森壳
+2 -2
View File
@@ -1,10 +1,10 @@
{
"name": "CheatEnabler",
"version_number": "2.3.32",
"version_number": "2.4.0",
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler",
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
"dependencies": [
"xiaoye97-BepInEx-5.4.17",
"soarqin-UXAssist-1.2.0"
"soarqin-UXAssist-1.4.0"
]
}
+8 -8
View File
@@ -152,7 +152,7 @@ public class HideTips : BaseUnityPlugin
class HideMenuDemo
{
[HarmonyPriority(Priority.First), HarmonyPrefix]
[HarmonyPatch(typeof(DSPGame), "StartDemoGame", typeof(int))]
[HarmonyPatch(typeof(DSPGame), nameof(DSPGame.StartDemoGame), typeof(int))]
private static bool DSPGame_StartDemoGame_Prefix()
{
if (DSPGame.Game != null)
@@ -188,7 +188,7 @@ class HideMenuDemo
}
[HarmonyPriority(Priority.First), HarmonyPrefix]
[HarmonyPatch(typeof(VFPreload), "IsMenuDemoLoaded")]
[HarmonyPatch(typeof(VFPreload), nameof(VFPreload.IsMenuDemoLoaded))]
private static bool VFPreload_IsMenuDemoLoaded_Prefix(ref bool __result)
{
__result = true;
@@ -196,18 +196,18 @@ class HideMenuDemo
}
[HarmonyPriority(Priority.First), HarmonyPrefix]
[HarmonyPatch(typeof(DSPGame), "LateUpdate")]
[HarmonyPatch(typeof(GameMain), "LateUpdate")]
[HarmonyPatch(typeof(GameMain), "FixedUpdate")]
[HarmonyPatch(typeof(GameMain), "Update")]
[HarmonyPatch(typeof(GameCamera), "LateUpdate")]
[HarmonyPatch(typeof(DSPGame), nameof(DSPGame.LateUpdate))]
[HarmonyPatch(typeof(GameMain), nameof(GameMain.LateUpdate))]
[HarmonyPatch(typeof(GameMain), nameof(GameMain.FixedUpdate))]
[HarmonyPatch(typeof(GameMain), nameof(GameMain.Update))]
[HarmonyPatch(typeof(GameCamera), nameof(GameCamera.LateUpdate))]
private static bool DSPGame_LateUpdate_Prefix()
{
return !DSPGame.IsMenuDemo;
}
[HarmonyPriority(Priority.First), HarmonyPrefix]
[HarmonyPatch(typeof(GameMain), "Begin")]
[HarmonyPatch(typeof(GameMain), nameof(GameMain.Begin))]
private static bool GameMain_Begin_Prefix()
{
if (!DSPGame.IsMenuDemo) return true;
+524 -500
View File
File diff suppressed because it is too large Load Diff
-128
View File
@@ -131,9 +131,6 @@ public static class WinApi
[DllImport("user32", ExactSpelling = true)]
public static extern IntPtr MonitorFromRect([In] ref Rect lpRect, uint dwFlags);
[DllImport("kernel32", ExactSpelling = true, SetLastError = true)]
public static extern bool GetProcessAffinityMask(IntPtr hProcess, out ulong lpProcessAffinityMask, out ulong lpSystemAffinityMask);
[DllImport("kernel32", ExactSpelling = true, SetLastError = true)]
public static extern IntPtr GetCurrentProcess();
@@ -143,9 +140,6 @@ public static class WinApi
[DllImport("kernel32", ExactSpelling = true)]
public static extern IntPtr GetConsoleWindow();
[DllImport("kernel32", ExactSpelling = true, SetLastError = true)]
public static extern bool SetProcessAffinityMask(IntPtr hProcess, ulong dwProcessAffinityMask);
// GetPriorityClass and SetPriorityClass
[DllImport("kernel32", ExactSpelling = true, SetLastError = true)]
public static extern int GetPriorityClass(IntPtr hProcess);
@@ -160,126 +154,4 @@ public static class WinApi
public static extern IntPtr CallWindowProc(IntPtr lpPrevWndFunc, IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam);
#endregion
#region GetLogicalProcessorInformationEx
[Flags]
private enum LOGICAL_PROCESSOR_RELATIONSHIP
{
RelationProcessorCore,
RelationNumaNode,
RelationCache,
RelationProcessorPackage,
RelationGroup,
RelationAll = 0xffff
}
[StructLayout(LayoutKind.Sequential, Pack = 4)]
private struct GROUP_AFFINITY
{
public nuint Mask;
public ushort Group;
public ushort Reserved0;
public ushort Reserved1;
public ushort Reserved3;
}
[StructLayout(LayoutKind.Sequential, Pack = 4)]
private struct PROCESSOR_RELATIONSHIP
{
public byte Flags;
public byte EfficiencyClass;
public ushort Reserved0;
public uint Reserved1;
public uint Reserved2;
public uint Reserved3;
public uint Reserved4;
public ushort Reserved5;
public ushort GroupCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public GROUP_AFFINITY[] GroupMask;
}
[StructLayout(LayoutKind.Sequential)]
private struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
{
public LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
public uint Size;
public PROCESSOR_RELATIONSHIP Processor;
}
[DllImport("kernel32", SetLastError = true)]
private static extern bool GetLogicalProcessorInformationEx(
LOGICAL_PROCESSOR_RELATIONSHIP relationshipType,
IntPtr buffer,
ref uint returnLength
);
public struct LogicalProcessorDetails
{
public int CoreCount;
public int ThreadCount;
public int PerformanceCoreCount;
public int EfficiencyCoreCount;
public ulong PerformanceCoreMask;
public ulong EfficiencyCoreMask;
public bool HybridArchitecture => PerformanceCoreCount > 0 && EfficiencyCoreCount > 0;
}
public static LogicalProcessorDetails GetLogicalProcessorDetails()
{
uint returnLength = 0;
GetLogicalProcessorInformationEx(LOGICAL_PROCESSOR_RELATIONSHIP.RelationProcessorCore, IntPtr.Zero, ref returnLength);
var result = new LogicalProcessorDetails();
if (Marshal.GetLastWin32Error() != ERROR_INSUFFICIENT_BUFFER) return result;
var ptr = Marshal.AllocHGlobal((int)returnLength);
try
{
if (!GetLogicalProcessorInformationEx(LOGICAL_PROCESSOR_RELATIONSHIP.RelationProcessorCore, ptr, ref returnLength))
return result;
uint offset = 0;
var item = ptr;
while (offset < returnLength)
{
var buffer = (SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX)Marshal.PtrToStructure(item, typeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX));
offset += buffer.Size;
item += (int)buffer.Size;
if (buffer.Relationship != LOGICAL_PROCESSOR_RELATIONSHIP.RelationProcessorCore) continue;
result.CoreCount++;
var mask = buffer.Processor.GroupMask[0].Mask;
var tcount = CountBitsSet(mask);
result.ThreadCount += tcount;
if (buffer.Processor.EfficiencyClass > 0)
{
result.PerformanceCoreCount++;
result.PerformanceCoreMask |= mask;
}
else
{
result.EfficiencyCoreCount++;
result.EfficiencyCoreMask |= mask;
}
}
}
finally
{
Marshal.FreeHGlobal(ptr);
}
return result;
int CountBitsSet(ulong mask)
{
var count = 0;
while (mask != 0)
{
mask &= mask - 1;
count++;
}
return count;
}
}
#endregion
}
+1 -1
View File
@@ -124,7 +124,7 @@ public static class PlanetFunctions
var combatStatId = enemyData.combatStatId;
planet.factory.skillSystem.OnRemovingSkillTarget(combatStatId, planet.factory.skillSystem.combatStats.buffer[combatStatId].originAstroId, ETargetType.CombatStat);
planet.factory.skillSystem.combatStats.Remove(combatStatId);
planet.factory.KillEnemyFinally(player, i, ref CombatStat.empty);
planet.factory.KillEnemyFinally(i, ref CombatStat.empty);
}
planet.factory.enemySystem.Free();
UIRoot.instance.uiGame.dfAssaultTip.ClearAllSpots();
+1 -1
View File
@@ -288,7 +288,7 @@ public static class TechFunctions
{
UnlockTechImmediately(techProto, toLevel, withPrerequisites);
}
history.VarifyTechQueue();
history.VerifyTechQueue();
if (history.currentTech != history.techQueue[0])
{
history.currentTech = history.techQueue[0];
+4 -4
View File
@@ -6,7 +6,7 @@ using System.Linq;
using System.Collections.Generic;
using UXAssist.UI;
using UXAssist.Common;
using GameLogic = UXAssist.Common.GameLogic;
using GameLogicProc = UXAssist.Common.GameLogic;
namespace UXAssist.Functions;
@@ -322,7 +322,7 @@ public static class UIFunctions
}
I18N.OnInitialized += UpdateI18N;
GameLogic.OnDataLoaded += () =>
GameLogicProc.OnDataLoaded += () =>
{
VeinProto veinProto;
ItemProto itemProto;
@@ -348,7 +348,7 @@ public static class UIFunctions
UpdateI18N();
};
GameLogic.OnGameBegin += () =>
GameLogicProc.OnGameBegin += () =>
{
if (DSPGame.IsMenuDemo) return;
@@ -429,7 +429,7 @@ public static class UIFunctions
OnPlanetScanEnded();
}
};
GameLogic.OnGameEnd += () =>
GameLogicProc.OnGameEnd += () =>
{
_starOrderNames = null;
ShowStarName = null;
-84
View File
@@ -16,10 +16,7 @@ public static class WindowFunctions
private static IntPtr _oldWndProc = IntPtr.Zero;
private static IntPtr _gameWindowHandle = IntPtr.Zero;
public static WinApi.LogicalProcessorDetails ProcessorDetails { get; private set; }
public static ConfigEntry<int> ProcessPriority;
public static ConfigEntry<int> ProcessAffinity;
private static readonly int[] ProrityFlags =
[
@@ -34,12 +31,6 @@ public static class WindowFunctions
{
if (_initialized) return;
_initialized = true;
I18N.Add("Cores: {0}\nThreads: {1}", "Cores: {0}\nThreads: {1}", "核心数: {0}\n线程数: {1}");
I18N.Add("\nP-Cores: {0}\nE-Cores: {1}", "\nP-Cores: {0}\nE-Cores: {1}", "\n性能核心: {0}\n能效核心: {1}");
I18N.Add("\nPriority: {0}", "\nProcess priority: {0}", "\n进程优先级: {0}");
I18N.Add("\nEnabled CPUs: ", "\nEnabled CPUs: ", "\n使用的CPU: ");
I18N.Add("Unknown", "Unknown", "未知");
ProcessorDetails = WinApi.GetLogicalProcessorDetails();
SetWindowTitle();
}
@@ -54,37 +45,6 @@ public static class WindowFunctions
ProcessPriority.SettingChanged += (_, _) => WinApi.SetPriorityClass(WinApi.GetCurrentProcess(), ProrityFlags[ProcessPriority.Value]);
WinApi.SetPriorityClass(WinApi.GetCurrentProcess(), ProrityFlags[ProcessPriority.Value]);
ProcessAffinity.SettingChanged += (_, _) => UpdateAffinity();
UpdateAffinity();
return;
static void UpdateAffinity()
{
var process = WinApi.GetCurrentProcess();
if (!WinApi.GetProcessAffinityMask(process, out _, out var systemMask))
{
systemMask = ulong.MaxValue;
}
switch (ProcessAffinity.Value)
{
case 0:
WinApi.SetProcessAffinityMask(process, systemMask);
break;
case 1:
WinApi.SetProcessAffinityMask(process, systemMask & ((1UL << (ProcessorDetails.ThreadCount / 2)) - 1UL));
break;
case 2:
WinApi.SetProcessAffinityMask(process, systemMask & (ProcessorDetails.ThreadCount > 16 ? 0xFFUL : 1UL));
break;
case 3:
WinApi.SetProcessAffinityMask(process, systemMask & ProcessorDetails.PerformanceCoreMask);
break;
case 4:
WinApi.SetProcessAffinityMask(process, systemMask & ProcessorDetails.EfficiencyCoreMask);
break;
}
}
}
private static IntPtr GameWndProc(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam)
@@ -118,50 +78,6 @@ public static class WindowFunctions
};
}
public static void ShowCPUInfo()
{
var details = ProcessorDetails;
var msg = string.Format("Cores: {0}\nThreads: {1}".Translate(), details.CoreCount, details.ThreadCount);
var hybrid = details.HybridArchitecture;
if (hybrid)
{
msg += string.Format("\nP-Cores: {0}\nE-Cores: {1}".Translate(), details.PerformanceCoreCount, details.EfficiencyCoreCount);
}
var handle = WinApi.GetCurrentProcess();
var prio = GetPriorityName(WinApi.GetPriorityClass(handle));
msg += string.Format("\nPriority: {0}".Translate(), prio);
var aff = 0UL;
if (WinApi.GetProcessAffinityMask(handle, out var processMask, out var systemMask))
aff = processMask & systemMask;
msg += "\nEnabled CPUs: ".Translate();
var first = true;
for (var i = 0; aff != 0UL; i++)
{
if ((aff & 1UL) != 0)
{
if (first)
first = false;
else
msg += ",";
msg += i;
if (hybrid)
{
if ((details.PerformanceCoreMask & (1UL << i)) != 0)
msg += "(P)";
else if ((details.EfficiencyCoreMask & (1UL << i)) != 0)
msg += "(E)";
}
}
aff >>= 1;
}
UIMessageBox.Show("CPU Info".Translate(), msg, "确定".Translate(), -1);
}
public static void SetWindowTitle()
{
// Get profile name from command line arguments, and set window title accordingly
@@ -1,4 +1,3 @@
using BepInEx.Bootstrap;
using HarmonyLib;
namespace UXAssist.ModsCompat;
+5 -5
View File
@@ -5,7 +5,7 @@ using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine.UI;
using UXAssist.Common;
using GameLogic = UXAssist.Common.GameLogic;
using GameLogicProc = UXAssist.Common.GameLogic;
namespace UXAssist.Patches;
@@ -269,14 +269,14 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
protected override void OnEnable()
{
InitNodeForAbsorb();
GameLogic.OnGameBegin += GameMain_Begin_Postfix;
GameLogic.OnGameEnd += GameMain_End_Postfix;
GameLogicProc.OnGameBegin += GameMain_Begin_Postfix;
GameLogicProc.OnGameEnd += GameMain_End_Postfix;
}
protected override void OnDisable()
{
GameLogic.OnGameEnd -= GameMain_End_Postfix;
GameLogic.OnGameBegin -= GameMain_Begin_Postfix;
GameLogicProc.OnGameEnd -= GameMain_End_Postfix;
GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix;
_initialized = false;
_nodeForAbsorb = null;
}
+82 -91
View File
@@ -10,7 +10,7 @@ using HarmonyLib;
using UnityEngine;
using UnityEngine.UI;
using UXAssist.Common;
using GameLogic = UXAssist.Common.GameLogic;
using GameLogicProc = UXAssist.Common.GameLogic;
namespace UXAssist.Patches;
@@ -276,12 +276,12 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
protected override void OnEnable()
{
GameLogic.OnGameEnd += GameMain_End_Postfix;
GameLogicProc.OnGameEnd += GameMain_End_Postfix;
}
protected override void OnDisable()
{
GameLogic.OnGameEnd -= GameMain_End_Postfix;
GameLogicProc.OnGameEnd -= GameMain_End_Postfix;
if (_sunlight)
{
_sunlight.transform.localEulerAngles = new Vector3(0f, 180f);
@@ -359,7 +359,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(StarSimulator), "LateUpdate")]
[HarmonyPatch(typeof(StarSimulator), nameof(StarSimulator.LateUpdate))]
private static IEnumerable<CodeInstruction> StarSimulator_LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
@@ -385,7 +385,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(PlanetSimulator), "LateUpdate")]
[HarmonyPatch(typeof(PlanetSimulator), nameof(PlanetSimulator.LateUpdate))]
private static IEnumerable<CodeInstruction> PlanetSimulator_LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
// var vec = (NightlightEnabled ? GameMain.mainPlayer.transform.up : (Quaternion.Inverse(localPlanet.runtimeRotation) * (__instance.planetData.star.uPosition - __instance.planetData.uPosition).normalized));
@@ -1405,16 +1405,16 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
protected override void OnEnable()
{
GameLogic.OnGameBegin += GameMain_Begin_Postfix;
GameLogic.OnGameEnd += GameMain_End_Postfix;
GameLogicProc.OnGameBegin += GameMain_Begin_Postfix;
GameLogicProc.OnGameEnd += GameMain_End_Postfix;
FixProto();
}
protected override void OnDisable()
{
UnfixProto();
GameLogic.OnGameEnd -= GameMain_End_Postfix;
GameLogic.OnGameBegin -= GameMain_Begin_Postfix;
GameLogicProc.OnGameEnd -= GameMain_End_Postfix;
GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix;
}
public static void AlternatelyChanged()
@@ -1770,14 +1770,14 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
protected override void OnEnable()
{
AddBeltSignalProtos();
GameLogic.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix;
GameLogic.OnGameBegin += GameMain_Begin_Postfix;
GameLogicProc.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix;
GameLogicProc.OnGameBegin += GameMain_Begin_Postfix;
}
protected override void OnDisable()
{
GameLogic.OnGameBegin -= GameMain_Begin_Postfix;
GameLogic.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix;
GameLogicProc.OnGameBegin -= GameMain_Begin_Postfix;
GameLogicProc.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix;
}
private static void VFPreload_InvokeOnLoadWorkEnded_Postfix()
@@ -1833,91 +1833,82 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(GameData), "GameTick")]
public static IEnumerable<CodeInstruction> GameData_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
[HarmonyPostfix]
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic.OnFactoryFrameBegin))]
public static void GameLogic_OnFactoryFrameBegin_Postfix()
{
var matcher = new CodeMatcher(instructions, generator);
matcher.MatchForward(false,
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(PerformanceMonitor), nameof(PerformanceMonitor.EndSample)))
).Advance(1).Insert(
Transpilers.EmitDelegate(() =>
var factories = GameMain.data?.factories;
if (factories == null) return;
var factoriesCount = factories.Length;
var propertySystem = DSPGame.propertySystem;
List<int> factoriesToRemove = null;
foreach (var factoryIndex in SignalBeltFactoryIndices)
{
if (factoryIndex >= factoriesCount)
{
var factories = GameMain.data?.factories;
if (factories == null) return;
var factoriesCount = factories.Length;
var propertySystem = DSPGame.propertySystem;
List<int> factoriesToRemove = null;
foreach (var factoryIndex in SignalBeltFactoryIndices)
if (factoriesToRemove == null)
factoriesToRemove = [factoryIndex];
else
factoriesToRemove.Add(factoryIndex);
continue;
}
var signalBelts = GetSignalBelts(factoryIndex);
if (signalBelts == null) continue;
var factory = factories[factoryIndex];
if (factory == null) continue;
var cargoTraffic = factory.cargoTraffic;
var beltCount = cargoTraffic.beltCursor;
List<int> beltsToRemove = null;
foreach (var kvp in signalBelts)
{
if (kvp.Key >= beltCount)
{
if (factoryIndex >= factoriesCount)
{
if (factoriesToRemove == null)
factoriesToRemove = [factoryIndex];
else
factoriesToRemove.Add(factoryIndex);
continue;
}
var signalBelts = GetSignalBelts(factoryIndex);
if (signalBelts == null) continue;
var factory = factories[factoryIndex];
if (factory == null) continue;
var cargoTraffic = factory.cargoTraffic;
var beltCount = cargoTraffic.beltCursor;
List<int> beltsToRemove = null;
foreach (var kvp in signalBelts)
{
if (kvp.Key >= beltCount)
{
if (beltsToRemove == null)
beltsToRemove = [kvp.Key];
else
beltsToRemove.Add(kvp.Key);
continue;
}
ref var belt = ref cargoTraffic.beltPool[kvp.Key];
var cargoPath = cargoTraffic.GetCargoPath(belt.segPathId);
var itemIdx = kvp.Value;
if (cargoPath == null) continue;
var itemId = DarkFogItemIds[itemIdx];
var consume = (byte)Math.Min(DarkFogItemsInVoid[itemIdx], 4);
if (consume < 4)
{
var metaverse = propertySystem.GetItemAvaliableProperty(_clusterSeedKey, 6006);
if (metaverse > 0)
{
if (metaverse > 10)
metaverse = 10;
propertySystem.AddItemConsumption(_clusterSeedKey, 6006, metaverse);
var mainPlayer = GameMain.mainPlayer;
GameMain.history.AddPropertyItemConsumption(6006, metaverse, true);
var count = DarkFogItemExchangeRate[itemIdx] * metaverse;
DarkFogItemsInVoid[itemIdx] += count;
consume = (byte)Math.Min(DarkFogItemsInVoid[itemIdx], 4);
mainPlayer.mecha.AddProductionStat(itemId, count, mainPlayer.nearestFactory);
}
}
if (consume > 0 && cargoPath.TryInsertItem(belt.segIndex + belt.segPivotOffset, itemId, consume, 0))
DarkFogItemsInVoid[itemIdx] -= consume;
}
if (beltsToRemove == null) continue;
foreach (var beltId in beltsToRemove)
signalBelts.Remove(beltId);
if (signalBelts.Count > 0) continue;
if (factoriesToRemove == null)
factoriesToRemove = [factoryIndex];
if (beltsToRemove == null)
beltsToRemove = [kvp.Key];
else
factoriesToRemove.Add(factoryIndex);
beltsToRemove.Add(kvp.Key);
continue;
}
if (factoriesToRemove == null) return;
foreach (var factoryIndex in factoriesToRemove)
ref var belt = ref cargoTraffic.beltPool[kvp.Key];
var cargoPath = cargoTraffic.GetCargoPath(belt.segPathId);
var itemIdx = kvp.Value;
if (cargoPath == null) continue;
var itemId = DarkFogItemIds[itemIdx];
var consume = (byte)Math.Min(DarkFogItemsInVoid[itemIdx], 4);
if (consume < 4)
{
RemovePlanetSignalBelts(factoryIndex);
var metaverse = propertySystem.GetItemAvaliableProperty(_clusterSeedKey, 6006);
if (metaverse > 0)
{
if (metaverse > 10)
metaverse = 10;
propertySystem.AddItemConsumption(_clusterSeedKey, 6006, metaverse);
var mainPlayer = GameMain.mainPlayer;
GameMain.history.AddPropertyItemConsumption(6006, metaverse, true);
var count = DarkFogItemExchangeRate[itemIdx] * metaverse;
DarkFogItemsInVoid[itemIdx] += count;
consume = (byte)Math.Min(DarkFogItemsInVoid[itemIdx], 4);
mainPlayer.mecha.AddProductionStat(itemId, count, mainPlayer.nearestFactory);
}
}
})
);
return matcher.InstructionEnumeration();
if (consume > 0 && cargoPath.TryInsertItem(belt.segIndex + belt.segPivotOffset, itemId, consume, 0))
DarkFogItemsInVoid[itemIdx] -= consume;
}
if (beltsToRemove == null) continue;
foreach (var beltId in beltsToRemove)
signalBelts.Remove(beltId);
if (signalBelts.Count > 0) continue;
if (factoriesToRemove == null)
factoriesToRemove = [factoryIndex];
else
factoriesToRemove.Add(factoryIndex);
}
if (factoriesToRemove == null) return;
foreach (var factoryIndex in factoriesToRemove)
{
RemovePlanetSignalBelts(factoryIndex);
}
}
}
+4 -142
View File
@@ -19,8 +19,6 @@ public class GamePatch : PatchImpl<GamePatch>
public static ConfigEntry<bool> EnableWindowResizeEnabled;
public static ConfigEntry<bool> LoadLastWindowRectEnabled;
public static ConfigEntry<int> MouseCursorScaleUpMultiplier;
// public static ConfigEntry<bool> AutoSaveOptEnabled;
public static ConfigEntry<bool> ConvertSavesFromPeaceEnabled;
public static ConfigEntry<Vector4> LastWindowRect;
@@ -87,11 +85,6 @@ public class GamePatch : PatchImpl<GamePatch>
FixLastWindowRect();
}
};
MouseCursorScaleUpMultiplier.SettingChanged += (_, _) =>
{
MouseCursorScaleUp.NeedReloadCursors = true;
MouseCursorScaleUp.Enable(MouseCursorScaleUpMultiplier.Value > 1);
};
// AutoSaveOptEnabled.SettingChanged += (_, _) => AutoSaveOpt.Enable(AutoSaveOptEnabled.Value);
ConvertSavesFromPeaceEnabled.SettingChanged += (_, _) => ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value);
ProfileBasedSaveFolderEnabled.SettingChanged += (_, _) => RefreshSavePath();
@@ -123,8 +116,6 @@ public class GamePatch : PatchImpl<GamePatch>
}
}
EnableWindowResize.Enable(EnableWindowResizeEnabled.Value);
MouseCursorScaleUp.NeedReloadCursors = false;
MouseCursorScaleUp.Enable(MouseCursorScaleUpMultiplier.Value > 1);
// AutoSaveOpt.Enable(AutoSaveOptEnabled.Value);
ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value);
Enable(true);
@@ -136,8 +127,6 @@ public class GamePatch : PatchImpl<GamePatch>
{
Enable(false);
EnableWindowResize.Enable(false);
MouseCursorScaleUp.NeedReloadCursors = false;
MouseCursorScaleUp.Enable(false);
// AutoSaveOpt.Enable(false);
ConvertSavesFromPeace.Enable(false);
}
@@ -160,7 +149,7 @@ public class GamePatch : PatchImpl<GamePatch>
[HarmonyPostfix]
[HarmonyPriority(Priority.First)]
[HarmonyPatch(typeof(GameConfig), "gameSaveFolder", MethodType.Getter)]
[HarmonyPatch(typeof(GameConfig), nameof(GameConfig.gameSaveFolder), MethodType.Getter)]
public static void GameConfig_gameSaveFolder_Postfix(ref string __result)
{
if (!ProfileBasedSaveFolderEnabled.Value || string.IsNullOrEmpty(WindowFunctions.ProfileName)) return;
@@ -298,14 +287,14 @@ public class GamePatch : PatchImpl<GamePatch>
var matcher = new CodeMatcher(instructions, generator);
var label1 = generator.DefineLabel();
matcher.MatchForward(false,
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(Screen), nameof(Screen.SetResolution), [typeof(int), typeof(int), typeof(bool), typeof(int)]))
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(Screen), nameof(Screen.SetResolution), [typeof(int), typeof(int), typeof(FullScreenMode), typeof(RefreshRate)]))
).Advance(1).Labels.Add(label1);
matcher.Start().Insert(
Transpilers.EmitDelegate(() =>
_gameOption.fullscreen == DSPGame.globalOption.fullscreen &&
_gameOption.displayMode != EOptionDisplayMode.Windowed &&
_gameOption.resolution.width == DSPGame.globalOption.resolution.width &&
_gameOption.resolution.height == DSPGame.globalOption.resolution.height &&
_gameOption.resolution.refreshRate == DSPGame.globalOption.resolution.refreshRate
_gameOption.resolution.refreshRateRatio.Equals(DSPGame.globalOption.resolution.refreshRateRatio)
),
new CodeInstruction(OpCodes.Brtrue, label1)
);
@@ -601,131 +590,4 @@ public class GamePatch : PatchImpl<GamePatch>
return false;
}
}
[PatchSetCallbackFlag(PatchCallbackFlag.CallOnDisableAfterUnpatch)]
private class MouseCursorScaleUp : PatchImpl<MouseCursorScaleUp>
{
public static bool NeedReloadCursors;
protected override void OnEnable()
{
if (!NeedReloadCursors) return;
if (!UICursor.loaded) return;
UICursor.loaded = false;
UICursor.LoadCursors();
}
protected override void OnDisable()
{
if (!NeedReloadCursors) return;
if (!UICursor.loaded) return;
UICursor.loaded = false;
UICursor.LoadCursors();
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(UICursor), nameof(UICursor.LoadCursors))]
private static IEnumerable<CodeInstruction> UICursor_LoadCursors_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
/*
matcher.MatchForward(false,
new CodeMatch(OpCodes.Ldc_I4_S),
new CodeMatch(OpCodes.Newarr)
);
var startPos = matcher.Pos;
matcher.Advance(2).MatchForward(false,
new CodeMatch(OpCodes.Stsfld, AccessTools.Field(typeof(UICursor), nameof(UICursor.cursorTexs)))
);
var endPos = matcher.Pos + 1;
matcher.Start().Advance(startPos).RemoveInstructions(endPos - startPos);
matcher.InsertAndAdvance(
Transpilers.EmitDelegate(() =>
{
var pluginfolder = Util.PluginFolder;
UICursor.cursorTexs =
[
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor.png"),
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-transfer.png"),
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-target-in.png"),
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-target-out.png"),
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-target-a.png"),
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-target-b.png"),
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-ban.png"),
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-delete.png"),
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-reform.png"),
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-dyson-node-create.png"),
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-painter.png"),
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-eyedropper.png"),
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-eraser.png"),
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-upgrade.png"),
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-downgrade.png"),
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-blank.png"),
Util.LoadTexture($"{pluginfolder}/assets/cursor/cursor-remove.png")
];
})
);
*/
matcher.MatchForward(false,
new CodeMatch(OpCodes.Stsfld, AccessTools.Field(typeof(UICursor), nameof(UICursor.cursorHots))),
new CodeMatch(OpCodes.Ldc_I4_1),
new CodeMatch(OpCodes.Stsfld, AccessTools.Field(typeof(UICursor), nameof(UICursor.loaded)))
).Advance(1).InsertAndAdvance(
Transpilers.EmitDelegate(() =>
{
var multiplier = MouseCursorScaleUpMultiplier.Value;
for (var i = 0; i < UICursor.cursorTexs.Length; i++)
{
var cursor = UICursor.cursorTexs[i];
if (cursor == null) continue;
var newWidth = 32 * multiplier;
var newHeight = 32 * multiplier;
if (cursor.width == newWidth && cursor.height == newHeight) continue;
UICursor.cursorTexs[i] = ResizeTexture2D(cursor, newWidth, newHeight);
}
if (multiplier <= 1) return;
for (var i = UICursor.cursorHots.Length - 1; i >= 0; i--)
{
UICursor.cursorHots[i] = new Vector2(UICursor.cursorHots[i].x * multiplier, UICursor.cursorHots[i].y * multiplier);
}
})
).MatchForward(false,
new CodeMatch(OpCodes.Ldc_I4_0),
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(Cursor), nameof(Cursor.SetCursor), [typeof(Texture2D), typeof(Vector2), typeof(CursorMode)]))
).SetInstruction(new CodeInstruction(OpCodes.Ldc_I4_1));
return matcher.InstructionEnumeration();
Texture2D ResizeTexture2D(Texture2D texture2D, int targetWidth, int targetHeight)
{
var oldActive = RenderTexture.active;
var rt = new RenderTexture(targetWidth, targetHeight, 32)
{
antiAliasing = 8
};
RenderTexture.active = rt;
Graphics.Blit(texture2D, rt);
rt.ResolveAntiAliasedSurface();
var result = new Texture2D(targetWidth, targetHeight, texture2D.format, false);
result.ReadPixels(new Rect(0, 0, targetWidth, targetHeight), 0, 0);
result.filterMode = FilterMode.Trilinear;
result.Apply();
RenderTexture.active = oldActive;
rt.Release();
return result;
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(UICursor), nameof(UICursor.cursorIndexApply), MethodType.Setter)]
private static IEnumerable<CodeInstruction> UICursor_set_cursorIndexApply_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
matcher.Start().MatchForward(false,
new CodeMatch(OpCodes.Ldc_I4_0),
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(Cursor), nameof(Cursor.SetCursor), [typeof(Texture2D), typeof(Vector2), typeof(CursorMode)]))
).SetInstruction(new CodeInstruction(OpCodes.Ldc_I4_1));
return matcher.InstructionEnumeration();
}
}
}
+6 -6
View File
@@ -9,8 +9,8 @@ using UnityEngine.EventSystems;
using UnityEngine.Serialization;
using UnityEngine.UI;
using UXAssist.Common;
using GameLogic = UXAssist.Common.GameLogic;
using Object = UnityEngine.Object;
using GameLogicProc = UXAssist.Common.GameLogic;
namespace UXAssist.Patches;
@@ -74,14 +74,14 @@ public static class LogisticsPatch
RealtimeLogisticsInfoPanel.Enable(RealtimeLogisticsInfoPanelEnabled.Value);
RealtimeLogisticsInfoPanel.EnableBars(RealtimeLogisticsInfoPanelBarsEnabled.Value);
GameLogic.OnGameBegin += RealtimeLogisticsInfoPanel.OnGameBegin;
GameLogic.OnDataLoaded += RealtimeLogisticsInfoPanel.OnDataLoaded;
GameLogicProc.OnGameBegin += RealtimeLogisticsInfoPanel.OnGameBegin;
GameLogicProc.OnDataLoaded += RealtimeLogisticsInfoPanel.OnDataLoaded;
}
public static void Uninit()
{
GameLogic.OnDataLoaded -= RealtimeLogisticsInfoPanel.OnDataLoaded;
GameLogic.OnGameBegin -= RealtimeLogisticsInfoPanel.OnGameBegin;
GameLogicProc.OnDataLoaded -= RealtimeLogisticsInfoPanel.OnDataLoaded;
GameLogicProc.OnGameBegin -= RealtimeLogisticsInfoPanel.OnGameBegin;
AutoConfigLogistics.Enable(false);
AutoConfigLogisticsSetDefaultRemoteLogicToStorage.Enable(false);
@@ -851,7 +851,7 @@ public static class LogisticsPatch
var sliderBgPrefab = GameObject.Find("UI Root/Overlay Canvas/In Game/Windows/Station Window/storage-box-0/slider-bg");
_tipPrefab = Object.Instantiate(GameObject.Find("UI Root/Overlay Canvas/In Game/Scene UIs/Vein Marks/vein-tip-prefab"), _stationTipsRoot.transform);
_tipPrefab = Object.Instantiate(GameObject.Find("UI Root/Overlay Canvas/In Game/Scene UIs/Vein Marks/vein-tips/vein-tip-prefab"), _stationTipsRoot.transform);
_tipPrefab.name = "tipPrefab";
Object.Destroy(_tipPrefab.GetComponent<UIVeinDetailNode>());
var image = _tipPrefab.GetComponent<Image>();
+1 -27
View File
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Collections.Generic;
using System.Reflection.Emit;
using HarmonyLib;
using UnityEngine;
@@ -41,29 +38,6 @@ public class PersistPatch : PatchImpl<PersistPatch>
return matcher.InstructionEnumeration();
}
// Patch to fix the issue that warning popup on VeinUtil upgraded to level 8000+
[HarmonyTranspiler]
[HarmonyPatch(typeof(ABN_VeinsUtil), nameof(ABN_VeinsUtil.CheckValue))]
private static IEnumerable<CodeInstruction> ABN_VeinsUtil_CheckValue_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
matcher.MatchForward(false,
new CodeMatch(OpCodes.Ldelem_R8),
new CodeMatch(OpCodes.Conv_R4),
new CodeMatch(OpCodes.Add),
new CodeMatch(OpCodes.Stloc_1)
);
// loc1 = Mathf.Round(n * 1000f) / 1000f;
matcher.Advance(3).Insert(
new CodeInstruction(OpCodes.Ldc_R4, 1000f),
new CodeInstruction(OpCodes.Mul),
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(Mathf), nameof(Mathf.Round))),
new CodeInstruction(OpCodes.Ldc_R4, 1000f),
new CodeInstruction(OpCodes.Div)
);
return matcher.InstructionEnumeration();
}
// Bring popup tip window to top layer
[HarmonyTranspiler]
[HarmonyPatch(typeof(UIButton), nameof(UIButton.LateUpdate))]
+5 -5
View File
@@ -5,7 +5,7 @@ using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine.UI;
using UXAssist.Common;
using GameLogic = UXAssist.Common.GameLogic;
using GameLogicProc = UXAssist.Common.GameLogic;
namespace UXAssist.Patches;
@@ -46,11 +46,11 @@ public static class TechPatch
if (enable)
{
TryPatchProto(true);
GameLogic.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix;
GameLogicProc.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix;
}
else
{
GameLogic.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix;
GameLogicProc.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix;
TryPatchProto(false);
}
}
@@ -189,11 +189,11 @@ public static class TechPatch
{
if (DSPGame.GameDesc != null)
TryPatchProto(DSPGame.GameDesc.isPeaceMode);
GameLogic.OnGameBegin += OnGameBegin;
GameLogicProc.OnGameBegin += OnGameBegin;
}
else
{
GameLogic.OnGameBegin -= OnGameBegin;
GameLogicProc.OnGameBegin -= OnGameBegin;
TryPatchProto(false);
}
}
+18 -18
View File
@@ -22,8 +22,6 @@
* Enable game window resize
* Remember window position and size on last exit
* Convert Peace-Mode saves to Combat-Mode on loading
* Scale up mouse cursor
* Note: This will enable software cursor mode, which may cause mouse movement lag on heavy load.
* Mod manager profile based save folder
* Save files are stored in `Save\<ProfileName>` folder.
* Will use original save location if matching default profile name.
@@ -38,12 +36,8 @@
* When set game speed in mod `Auxilaryfunction`, this feature will be disabled.
* When mod `BulletTime` is installed, this feature will be hidden, but patch `BulletTime`'s speed control, to make its maximum speed 10x.
* Set process priority
* Set enabled CPU threads
* Increase maximum count of Metadata Instantiations to 20000 (from 2000)
* Increase capacity of player order queue to 128 (from 16)
* Starmap view:
* Add a star name filter, you can filter displayed star names by ores or planet types now.
* Add a dropdown box to show all stars' distance and/or planet count.
* Factory
* Sunlight at night
* Remove some build conditions
@@ -112,9 +106,6 @@
* Enable player actions in globe view
* Hide tips for soil piles changes
* Enhanced count control for hand-make
* Shortcut keys for showing stars' name
* Add a shortcut key to always show all star names in starmap when holding, default is `Alt`
* Add a shortcut key to toggle between three star name display states in starmap: `Original state`, `Show all names`, `Hide all names`, default is `Tab`, will restore to original state when closing starmap
* Auto navigation on sailings
* It keeps Icarus on course to the target planet
* It will try to bypass any obstacles(planets, stars or dark-fog hives) on the way
@@ -136,6 +127,14 @@
* This enables batch buying out techs with their prerequisites. Buy-out button is shown for all locked techs/upgrads.
* Combat
* Open Dark Fog Communicator anywhere
* UI
* Embedded [Planet Vein Untilization](https://thunderstore.io/c/dyson-sphere-program/p/testpushpleaseignore/Planet_Vein_Utilization/) due to its lack of maintainance, with minor bug fixes.
* Shortcut keys for showing stars' name
* Add a shortcut key to always show all star names in starmap when holding, default is `Alt`
* Add a shortcut key to toggle between three star name display states in starmap: `Original state`, `Show all names`, `Hide all names`, default is `Tab`, will restore to original state when closing starmap
* Starmap view:
* Add a star name filter, you can filter displayed star names by ores or planet types now.
* Add a dropdown box to show all stars' distance and/or planet count.
## Notes
@@ -150,6 +149,7 @@
* [LSTM](https://github.com/hetima/DSP_LSTM) & [PlanetFinder](https://github.com/hetima/DSP_PlanetFinder): UI implementations
* [OffGridConstruction](https://github.com/Velociraptor115-DSPModding/OffGridConstruction): Off-grid building & stepped rotation implementations
* [CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/) and its extension [AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/): `Auto navigation on sailings` and `Auto-cruise` implementations
* [Planet Vein Untilization](https://thunderstore.io/c/dyson-sphere-program/p/testpushpleaseignore/Planet_Vein_Utilization/)
</details>
@@ -179,8 +179,6 @@
* 可调整游戏窗口大小(可最大化和拖动边框)
* 记住上次退出时的窗口位置和大小
* 在加载和平模式存档时将其转换为战斗模式
* 放大鼠标指针
* 注意:这将启用软件指针模式,可能会在CPU负载较重时导致鼠标移动延迟
* 基于mod管理器配置档案名的存档文件夹
* 存档文件会存储在`Save\<ProfileName>`文件夹中
* 如果匹配默认配置档案名则使用原始存档位置
@@ -195,12 +193,8 @@
* 当在`Auxilaryfunction`mod中设置游戏速度时,此功能将被禁用
* 当安装了`BulletTime`mod时,此功能将被隐藏,但会对`BulletTime`的速度控制打补丁,使其最大速度变为10倍
* 设置进程优先级
* 设置使用的CPU线程
* 将元数据提取的最大数量增加到20000(原来为2000)
* 将玩家指令队列的容量增加到128(原来为16)
* 星图:
* 添加星系名过滤器,现在可以按矿物或行星类型过滤显示的星系名
* 添加了一个下拉框用以切换显示所有星系的距离和/或行星数量
* 工厂
* 夜间日光灯
* 移除部分不影响游戏逻辑的建造条件
@@ -270,9 +264,6 @@
* 在行星视图中允许玩家操作
* 隐藏沙土数量变动的提示
* 手动制造物品的数量控制改进
* 启用显示所有星系名称的快捷键
* 新增一个快捷键,按住后始终在星图显示所有星系名称,默认为`Alt`
* 新增一个快捷键,在星图视图切换三种星系名称显示状态:`原始显示状态``显示所有名称``隐藏所有名称`,默认为`Tab`,关闭星图时会恢复到原始状态
* 航行时自动导航
* 它会保持伊卡洛斯飞向目标星球
* 它会尝试绕过途中的任何障碍物(行星、恒星或黑雾巢穴)
@@ -294,6 +285,14 @@
* 这使得可以批量买断科技及其所有前置科技。所有未解锁的科技/升级都会显示买断按钮。
* 战斗
* 在任意位置打开黑雾通讯器
* UI
* 启用显示所有星系名称的快捷键
* 新增一个快捷键,按住后始终在星图显示所有星系名称,默认为`Alt`
* 新增一个快捷键,在星图视图切换三种星系名称显示状态:`原始显示状态``显示所有名称``隐藏所有名称`,默认为`Tab`,关闭星图时会恢复到原始状态
* 星图:
* 添加星系名过滤器,现在可以按矿物或行星类型过滤显示的星系名
* 添加了一个下拉框用以切换显示所有星系的距离和/或行星数量
* 由于缺乏维护,整合内置了[Planet Vein Untilization](https://thunderstore.io/c/dyson-sphere-program/p/testpushpleaseignore/Planet_Vein_Utilization/),并修复了一些小错误。
## 注意事项
@@ -308,5 +307,6 @@
* [LSTM](https://github.com/hetima/DSP_LSTM) & [PlanetFinder](https://github.com/hetima/DSP_PlanetFinder): UI实现
* [OffGridConstruction](https://github.com/Velociraptor115-DSPModding/OffGridConstruction): 脱离网格建造以及小角度旋转的实现
* [CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/)及其扩展[AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/): `航行时自动导航``自动巡航`的实现
* [Planet Vein Untilization](https://thunderstore.io/c/dyson-sphere-program/p/testpushpleaseignore/Planet_Vein_Utilization/)
</details>
+2 -2
View File
@@ -613,7 +613,7 @@ public abstract class MyWindowManager
/*
//_Create -> _Init
[HarmonyPostfix, HarmonyPatch(typeof(UIGame), "_OnCreate")]
[HarmonyPostfix, HarmonyPatch(typeof(UIGame), nameof(UIGame._OnCreate))]
public static void UIGame__OnCreate_Postfix()
{
}
@@ -638,7 +638,7 @@ public abstract class MyWindowManager
}
/*
[HarmonyPostfix, HarmonyPatch(typeof(UIGame), "_OnFree")]
[HarmonyPostfix, HarmonyPatch(typeof(UIGame), nameof(UIGame._OnFree))]
public static void UIGame__OnFree_Postfix()
{
foreach (var win in Windows)
+1 -31
View File
@@ -27,7 +27,6 @@ public static class UIConfigWindow
I18N.Add("Tech/Combat/UI", "Tech/Combat/UI", "科研/战斗/UI");
I18N.Add("Enable game window resize", "Enable game window resize (maximum box and thick frame)", "可调整游戏窗口大小(可最大化和拖动边框)");
I18N.Add("Remeber window position and size on last exit", "Remeber window position and size on last exit", "记住上次退出时的窗口位置和大小");
I18N.Add("Scale up mouse cursor", "Scale up mouse cursor", "放大鼠标指针");
/*
I18N.Add("Better auto-save mechanism", "Better auto-save mechanism", "更好的自动存档机制");
I18N.Add("Better auto-save mechanism tips", "Auto saves are stored in 'Save\\AutoSaves' folder, filenames are combined with cluster address and date-time", "自动存档会以星区地址和日期时间组合为文件名存储在'Save\\AutoSaves'文件夹中");
@@ -48,14 +47,6 @@ public static class UIConfigWindow
I18N.Add("Normal", "Normal", "正常");
I18N.Add("Below Normal", "Below Normal", "低于正常");
I18N.Add("Idle", "Idle", "空闲");
I18N.Add("Enabled CPUs", "Enabled CPU Threads", "使用CPU线程");
I18N.Add("All CPUs", "All CPUs", "所有CPU");
I18N.Add("First {0} CPUs", "First {0} CPUs", "前{0}个CPU");
I18N.Add("First 8 CPUs", "First 8 CPUs", "前8个CPU");
I18N.Add("First CPU only", "First CPU only", "仅第一个CPU");
I18N.Add("All P-Cores", "All P-Cores", "所有性能(P)核心");
I18N.Add("All E-Cores", "All E-Cores", "所有能效(E)核心");
I18N.Add("CPU Info", "CPU Info", "CPU信息");
I18N.Add("Unlimited interactive range", "Unlimited interactive range", "无限交互距离");
I18N.Add("Night Light", "Sunlight at night", "夜间日光灯");
I18N.Add("Angle X:", "Angle X:", "入射角度X:");
@@ -294,6 +285,7 @@ public static class UIConfigWindow
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
{
UnityEngine.UI.Text txt;
_windowTrans = trans;
wnd.AddTabGroup(trans, "UXAssist", "tab-group-uxassist");
var tab1 = wnd.AddTab(trans, "General");
@@ -302,9 +294,6 @@ public static class UIConfigWindow
wnd.AddCheckBox(x, y, tab1, GamePatch.EnableWindowResizeEnabled, "Enable game window resize");
y += 36f;
wnd.AddCheckBox(x, y, tab1, GamePatch.LoadLastWindowRectEnabled, "Remeber window position and size on last exit");
y += 36f;
var txt = wnd.AddText2(x + 2f, y, tab1, "Scale up mouse cursor", 15, "text-scale-up-mouse-cursor");
wnd.AddSlider(x + txt.preferredWidth + 7f, y + 6f, tab1, GamePatch.MouseCursorScaleUpMultiplier, [1, 2, 3, 4], "0x", 100f);
/*
y += 30f;
wnd.AddCheckBox(x, y, tab1, GamePatch.AutoSaveOptEnabled, "Better auto-save mechanism");
@@ -342,25 +331,6 @@ public static class UIConfigWindow
}
y += 36f;
wnd.AddComboBox(x + 2f, y, tab1, "Process priority").WithItems("High", "Above Normal", "Normal", "Below Normal", "Idle").WithSize(100f, 0f).WithConfigEntry(WindowFunctions.ProcessPriority);
var details = WindowFunctions.ProcessorDetails;
string[] affinities;
if (details.HybridArchitecture)
{
affinities = new string[5];
affinities[3] = "All P-Cores";
affinities[4] = "All E-Cores";
}
else
{
affinities = new string[3];
}
affinities[0] = "All CPUs";
affinities[1] = string.Format("First {0} CPUs".Translate(), details.ThreadCount / 2);
affinities[2] = details.ThreadCount > 16 ? "First 8 CPUs" : "First CPU only";
y += 36f;
wnd.AddComboBox(x + 2f, y, tab1, "Enabled CPUs").WithItems(affinities).WithSize(200f, 0f).WithConfigEntry(WindowFunctions.ProcessAffinity);
y += 36f;
((RectTransform)wnd.AddButton(x, y, tab1, "CPU Info", 16, "button-show-cpu-info", WindowFunctions.ShowCPUInfo).transform).sizeDelta = new Vector2(100f, 25f);
var tab2 = wnd.AddTab(trans, "Factory");
x = 0f;
+3 -11
View File
@@ -14,7 +14,7 @@ using UXAssist.Functions;
using UXAssist.Patches;
using UXAssist.UI;
using Util = UXAssist.Common.Util;
using GameLogic = UXAssist.Common.GameLogic;
using GameLogicProc = UXAssist.Common.GameLogic;
namespace UXAssist;
@@ -70,8 +70,6 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
"Load last window position and size when game starts");
GamePatch.LastWindowRect = Config.Bind("Game", "LastWindowRect", new Vector4(0f, 0f, 0f, 0f),
"Last window position and size");
GamePatch.MouseCursorScaleUpMultiplier = Config.Bind("Game", "MouseCursorScaleUpMultiplier", 1,
"Mouse cursor scale up multiplier");
GamePatch.ProfileBasedSaveFolderEnabled = Config.Bind("Game", "ProfileBasedSaveFolder", false,
"Profile-based save folder");
GamePatch.ProfileBasedOptionEnabled = Config.Bind("Game", "ProfileBasedOption", false,
@@ -88,12 +86,6 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
"Game UPS factor (1.0 for normal speed)");
WindowFunctions.ProcessPriority = Config.Bind("Game", "ProcessPriority", 2,
new ConfigDescription("Game process priority\n 0: High 1: Above Normal 2: Normal 3: Below Normal 4: Idle", new AcceptableValueRange<int>(0, 4)));
WindowFunctions.ProcessAffinity = Config.Bind("Game", "CPUAffinity", -1,
new ConfigDescription("""
Game process CPU affinity
0: All 1: First-half CPUs 2. First 8 CPUs (if total CPUs are greater than 16)
3. All Performance Cores(If Intel 13th or greater) 4. All Efficiency Cores(If Intel 13th or greater)
""", new AcceptableValueRange<int>(0, 4)));
FactoryPatch.UnlimitInteractiveEnabled = Config.Bind("Factory", "UnlimitInteractive", false,
"Unlimit interactive range");
@@ -217,7 +209,7 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
I18N.Add("UXAssist Config", "UXAssist Config", "UX助手设置");
// UI Patches
GameLogic.Enable(true);
GameLogicProc.Enable(true);
UIConfigWindow.Init();
@@ -246,7 +238,7 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
_patches?.Do(type => type.GetMethod("Uninit")?.Invoke(null, null));
MyWindowManager.Enable(false);
GameLogic.Enable(false);
GameLogicProc.Enable(false);
}
private void Update()
+4 -6
View File
@@ -4,7 +4,7 @@
<TargetFramework>net472</TargetFramework>
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
<Description>DSP MOD - UXAssist</Description>
<Version>1.3.6</Version>
<Version>1.4.0</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<PackageId>UXAssist</PackageId>
@@ -15,13 +15,12 @@
<ItemGroup>
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
<PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
<PackageReference Include="DysonSphereProgram.Modding.CommonAPI" Version="1.6.5" />
<PackageReference Include="DysonSphereProgram.Modding.DSPModSave" Version="1.*" />
</ItemGroup>
<!--
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>..\AssemblyFromGame\Assembly-CSharp.dll</HintPath>
@@ -30,7 +29,6 @@
<HintPath>..\AssemblyFromGame\UnityEngine.UI.dll</HintPath>
</Reference>
</ItemGroup>
-->
<ItemGroup>
<EmbeddedResource Include="assets/signal/energy-fragment.png" />
@@ -63,7 +61,7 @@
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Release'">
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="del /F /Q package\$(ProjectName)-$(Version).zip&#xA;powershell Compress-Archive -Force -DestinationPath 'package/$(ProjectName)-$(Version).zip' -Path &quot;$(TargetPath)&quot;, package/icon.png, package/manifest.json, README.md, CHANGELOG.md" />
</Target>
</Project>
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "UXAssist",
"version_number": "1.3.6",
"version_number": "1.4.0",
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
"dependencies": [
+3 -4
View File
@@ -1,8 +1,7 @@
using System.Collections.Generic;
using BepInEx.Configuration;
using HarmonyLib;
using UXAssist.Common;
using GameLogic = UXAssist.Common.GameLogic;
using GameLogicProc = UXAssist.Common.GameLogic;
namespace UniverseGenTweaks;
public static class BirthPlanetPatch
@@ -75,12 +74,12 @@ public static class BirthPlanetPatch
HighLuminosityBirthStar.SettingChanged += (_, _) => PatchBirthThemeData();
PatchBirthThemeData();
_patch ??= Harmony.CreateAndPatchAll(typeof(BirthPlanetPatch));
GameLogic.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix;
GameLogicProc.OnDataLoaded += VFPreload_InvokeOnLoadWorkEnded_Postfix;
}
public static void Uninit()
{
GameLogic.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix;
GameLogicProc.OnDataLoaded -= VFPreload_InvokeOnLoadWorkEnded_Postfix;
_patch?.UnpatchSelf();
_patch = null;
}
+1 -1
View File
@@ -153,7 +153,7 @@ public static class EpicDifficulty
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(GameDesc), "get_oilAmountMultiplier")]
[HarmonyPatch(typeof(GameDesc), nameof(GameDesc.oilAmountMultiplier), MethodType.Getter)]
private static IEnumerable<CodeInstruction> GameDesc_get_oilAmountMultiplier_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
+11 -2
View File
@@ -15,8 +15,8 @@
<ItemGroup>
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="1.*" />
<PackageReference Include="UnityEngine.Modules" Version="2018.4.12" IncludeAssets="compile" />
<PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" />
<PackageReference Include="UnityEngine.Modules" Version="2022.3.53" IncludeAssets="compile" />
<!-- <PackageReference Include="DysonSphereProgram.GameLibs" Version="0.10.32.*-r.*" /> -->
<PackageReference Include="DysonSphereProgram.Modding.DSPModSave" Version="1.*" />
</ItemGroup>
@@ -24,6 +24,15 @@
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp">
<HintPath>..\AssemblyFromGame\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>..\AssemblyFromGame\UnityEngine.UI.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\UXAssist\UXAssist.csproj" />
</ItemGroup>