disabling EventSystem.current patch for bepinex il2cpp as its causing a crash in some games

This commit is contained in:
sinaioutlander 2020-11-19 00:55:17 +11:00
parent 2a3df5de9d
commit dcf0bdce48

View File

@ -77,11 +77,6 @@ namespace UnityExplorer.UI
catch { } catch { }
// Setup Harmony Patches // Setup Harmony Patches
TryPatch(typeof(EventSystem),
"current",
new HarmonyMethod(typeof(ForceUnlockCursor).GetMethod(nameof(Prefix_EventSystem_set_current))),
true);
TryPatch(typeof(Cursor), TryPatch(typeof(Cursor),
"lockState", "lockState",
new HarmonyMethod(typeof(ForceUnlockCursor).GetMethod(nameof(Prefix_set_lockState))), new HarmonyMethod(typeof(ForceUnlockCursor).GetMethod(nameof(Prefix_set_lockState))),
@ -91,6 +86,17 @@ namespace UnityExplorer.UI
"visible", "visible",
new HarmonyMethod(typeof(ForceUnlockCursor).GetMethod(nameof(Prefix_set_visible))), new HarmonyMethod(typeof(ForceUnlockCursor).GetMethod(nameof(Prefix_set_visible))),
true); true);
#if BIE
#if CPP
// temporarily disabling this patch in BepInEx il2cpp as it's causing a crash in some games.
return;
#endif
#endif
TryPatch(typeof(EventSystem),
"current",
new HarmonyMethod(typeof(ForceUnlockCursor).GetMethod(nameof(Prefix_EventSystem_set_current))),
true);
} }
catch (Exception e) catch (Exception e)
{ {
@ -120,10 +126,10 @@ namespace UnityExplorer.UI
harmony.Patch(prop.GetGetMethod(), postfix: patch); harmony.Patch(prop.GetGetMethod(), postfix: patch);
} }
} }
catch // (Exception e) catch (Exception e)
{ {
//string suf = setter ? "set_" : "get_"; string suf = setter ? "set_" : "get_";
//ExplorerCore.Log($"Unable to patch {type.Name}.{suf}{property}: {e.Message}"); ExplorerCore.Log($"Unable to patch {type.Name}.{suf}{property}: {e.Message}");
} }
} }