1
0
mirror of https://github.com/soarqin/DSP_Mods_TO.git synced 2025-12-17 03:53:27 +08:00
This commit is contained in:
2024-03-19 21:09:22 +08:00
parent 195260a3c9
commit 165fd704bb
6 changed files with 444 additions and 374 deletions

View File

@@ -14,16 +14,24 @@ internal class Patch_UISailPanel
public static IEnumerable<CodeInstruction> OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions)
{
var codeMatcher = new CodeMatcher(instructions);
codeMatcher.MatchForward(true, new CodeMatch(OpCodes.Ldarg_0));
codeMatcher.InsertAndAdvance(
codeMatcher.MatchForward(true,
new CodeMatch(OpCodes.Ldarg_0)
).InsertAndAdvance(
Transpilers.EmitDelegate<Action>(delegate
{
CruiseAssistPlugin.ReticuleTargetPlanet = null;
CruiseAssistPlugin.ReticuleTargetStar = null;
})
);
codeMatcher.MatchForward(true, new CodeMatch(OpCodes.Bge_Un), new CodeMatch(OpCodes.Ldloc_S), new CodeMatch(OpCodes.Stloc_S), new CodeMatch(OpCodes.Ldc_I4_1), new CodeMatch(OpCodes.Stloc_S), new CodeMatch(OpCodes.Ldloc_S), new CodeMatch(OpCodes.Stloc_S));
codeMatcher.Advance(1).InsertAndAdvance(
codeMatcher.MatchForward(true,
new CodeMatch(OpCodes.Bge_Un),
new CodeMatch(OpCodes.Ldloc_S),
new CodeMatch(OpCodes.Stloc_S),
new CodeMatch(OpCodes.Ldc_I4_1),
new CodeMatch(OpCodes.Stloc_S),
new CodeMatch(OpCodes.Ldloc_S),
new CodeMatch(OpCodes.Stloc_S)
).Advance(1).InsertAndAdvance(
new CodeInstruction(OpCodes.Ldloc_0),
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(StarData), "planets")),
new CodeInstruction(OpCodes.Ldloc_S, 21),
@@ -39,8 +47,8 @@ internal class Patch_UISailPanel
new CodeMatch(OpCodes.Ldc_I4_1),
new CodeMatch(OpCodes.Stloc_S),
new CodeMatch(OpCodes.Ldloc_S),
new CodeMatch(OpCodes.Stloc_S));
codeMatcher.Advance(1).InsertAndAdvance(
new CodeMatch(OpCodes.Stloc_S)
).Advance(1).InsertAndAdvance(
new CodeInstruction(OpCodes.Ldloc_S, 20),
new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(GalaxyData), "stars")),
new CodeInstruction(OpCodes.Ldloc_S, 24),