Refactor hooking API
This completely changes how method patching works under the hood. Unlike
the previous API (`Hook.HookMethod`), the new API (`Hook.Patch`)
generates a Harmony patch method at runtime, using IL generation.
This fixes methods with ByRef (out/ref) parameters getting silently corrupted
due to the ByRef semantics being lost when passed through the `object[] __args`
parameter.
This new API also makes it possible to:
- modify parameters (including ByRef params)
- change the return value to `null` (old API would use `return nil`
for Harmony control flow)
- prevent execution of the original method (and other harmony
patches), independently of modifying the return value
This commit is contained in:
@@ -141,6 +141,7 @@
|
||||
<PackageReference Include="MonoMod.Common" Version="22.5.1.1" />
|
||||
<PackageReference Include="NVorbis" Version="0.8.6" />
|
||||
<PackageReference Include="RestSharp" Version="106.13.0" />
|
||||
<PackageReference Include="Sigil" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user