mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2025-12-09 04:13:32 +08:00
minor fixes
This commit is contained in:
@@ -156,7 +156,7 @@ public static class FactoryPatch
|
||||
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||
{
|
||||
var matcher = new CodeMatcher(instructions, generator);
|
||||
matcher.MatchForward(false,
|
||||
matcher.End().MatchBack(false,
|
||||
new CodeMatch(OpCodes.Ret)
|
||||
);
|
||||
if (matcher.IsInvalid)
|
||||
@@ -167,7 +167,11 @@ public static class FactoryPatch
|
||||
|
||||
matcher.Advance(-1);
|
||||
if (matcher.Opcode != OpCodes.Nop && (matcher.Opcode != OpCodes.Call || !matcher.Instruction.OperandIs(AccessTools.Method(typeof(GC), nameof(GC.Collect)))))
|
||||
{
|
||||
CheatEnabler.Logger.LogWarning($"Failed to patch CreatePrebuilds: last instruction is not `Nop` or `Call GC.Collect()`: {matcher.Instruction}");
|
||||
return matcher.InstructionEnumeration();
|
||||
}
|
||||
|
||||
var labels = matcher.Labels;
|
||||
matcher.Labels = new List<Label>();
|
||||
matcher.Insert(
|
||||
|
||||
@@ -33,8 +33,8 @@ public static class GamePatch
|
||||
_gamePatch = null;
|
||||
}
|
||||
|
||||
[HarmonyPrefix, HarmonyPatch(typeof(Application), nameof(Application.Quit), new Type[]{})]
|
||||
private static void Application_Quit_Prefix()
|
||||
[HarmonyPrefix, HarmonyPatch(typeof(GameMain), nameof(GameMain.HandleApplicationQuit))]
|
||||
private static void GameMain_HandleApplicationQuit_Prefix()
|
||||
{
|
||||
var wnd = WinApi.FindWindow(GameWindowClass, GameWindowTitle);
|
||||
if (wnd == IntPtr.Zero) return;
|
||||
|
||||
Reference in New Issue
Block a user