Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit dcf0bdc

Browse files
committed
disabling EventSystem.current patch for bepinex il2cpp as its causing a crash in some games
1 parent 2a3df5d commit dcf0bdc

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/UI/ForceUnlockCursor.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ private static void SetupPatches()
7777
catch { }
7878

7979
// Setup Harmony Patches
80-
TryPatch(typeof(EventSystem),
81-
"current",
82-
new HarmonyMethod(typeof(ForceUnlockCursor).GetMethod(nameof(Prefix_EventSystem_set_current))),
83-
true);
84-
8580
TryPatch(typeof(Cursor),
8681
"lockState",
8782
new HarmonyMethod(typeof(ForceUnlockCursor).GetMethod(nameof(Prefix_set_lockState))),
@@ -91,6 +86,17 @@ private static void SetupPatches()
9186
"visible",
9287
new HarmonyMethod(typeof(ForceUnlockCursor).GetMethod(nameof(Prefix_set_visible))),
9388
true);
89+
90+
#if BIE
91+
#if CPP
92+
// temporarily disabling this patch in BepInEx il2cpp as it's causing a crash in some games.
93+
return;
94+
#endif
95+
#endif
96+
TryPatch(typeof(EventSystem),
97+
"current",
98+
new HarmonyMethod(typeof(ForceUnlockCursor).GetMethod(nameof(Prefix_EventSystem_set_current))),
99+
true);
94100
}
95101
catch (Exception e)
96102
{
@@ -120,10 +126,10 @@ private static void TryPatch(Type type, string property, HarmonyMethod patch, bo
120126
harmony.Patch(prop.GetGetMethod(), postfix: patch);
121127
}
122128
}
123-
catch // (Exception e)
129+
catch (Exception e)
124130
{
125-
//string suf = setter ? "set_" : "get_";
126-
//ExplorerCore.Log($"Unable to patch {type.Name}.{suf}{property}: {e.Message}");
131+
string suf = setter ? "set_" : "get_";
132+
ExplorerCore.Log($"Unable to patch {type.Name}.{suf}{property}: {e.Message}");
127133
}
128134
}
129135

0 commit comments

Comments
 (0)