Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transpile immediate return patches #241

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Fika.Core/Coop/Patches/PlayerPatches/Player_SetDogtagInfo_Patch.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using EFT;
using HarmonyLib;
using SPT.Reflection.Patching;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;

namespace Fika.Core.Coop.Patches
{
Expand All @@ -14,10 +17,16 @@ protected override MethodBase GetTargetMethod()
return typeof(Player).GetMethod(nameof(Player.SetDogtagInfo));
}

[PatchPrefix]
public static bool Prefix()
[PatchTranspiler]
public static IEnumerable<CodeInstruction> Transpile(IEnumerable<CodeInstruction> instructions)
{
return false;
// Create a new set of instructions
List<CodeInstruction> instructionsList =
[
new CodeInstruction(OpCodes.Ret) // Return immediately
];

return instructionsList;
}
}
}
15 changes: 12 additions & 3 deletions Fika.Core/Coop/Patches/PlayerPatches/Player_method_144_Patch.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using EFT;
using HarmonyLib;
using SPT.Reflection.Patching;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;

namespace Fika.Core.Coop.Patches
{
Expand All @@ -15,10 +18,16 @@ protected override MethodBase GetTargetMethod()
return typeof(LocalPlayer).GetMethod(nameof(LocalPlayer.method_144));
}

[PatchPrefix]
public static bool Prefix()
[PatchTranspiler]
public static IEnumerable<CodeInstruction> Transpile(IEnumerable<CodeInstruction> instructions)
{
return false;
// Create a new set of instructions
List<CodeInstruction> instructionsList =
[
new CodeInstruction(OpCodes.Ret) // Return immediately
];

return instructionsList;
}
}
}
Loading