Skip to content

Commit

Permalink
[KK] Fixed GameAPI H scene events not working in VR module
Browse files Browse the repository at this point in the history
  • Loading branch information
ManlyMarco committed Aug 12, 2021
1 parent fb6b452 commit 9e53580
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/KKAPI/MainGame/GameAPI.Hooks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ private class Hooks
public static void SetupHooks(Harmony hi)
{
hi.PatchAll(typeof(Hooks));
//Patch the VR version of these methods via reflection since they don't exist in normal assembly
var vrHSceneType = Type.GetType("VRHScene, Assembly-CSharp");
if (vrHSceneType != null)
{
hi.Patch(AccessTools.Method("Start"), new HarmonyMethod(AccessTools.Method(typeof(Hooks), nameof(Hooks.StartProcPost))));
hi.Patch(AccessTools.Method("EndProc"), new HarmonyMethod(AccessTools.Method(typeof(Hooks), nameof(Hooks.EndProcPost))));
hi.Patch(AccessTools.Method("OnBack"), new HarmonyMethod(AccessTools.Method(typeof(Hooks), nameof(Hooks.EndProcPost))));
}
}

[HarmonyPostfix]
Expand Down

0 comments on commit 9e53580

Please sign in to comment.