fix: resolve AccessViolationException by removing problematic interface patch and using native game state management

This commit is contained in:
Marvin
2026-04-20 06:21:56 +02:00
parent 8d309f2162
commit 524eaacbd5
3 changed files with 14 additions and 4 deletions
Binary file not shown.
-4
View File
@@ -23,10 +23,6 @@ internal static class HookIntegration
// [GREG_SYNC_INSERT_PATCHES]
SafePatch(harmony, typeof(Il2Cpp.Player), nameof(Il2Cpp.Player.UpdateCoin), typeof(gregCore.GameLayer.Patches.Economy.PlayerPatch), nameof(gregCore.GameLayer.Patches.Economy.PlayerPatch.OnCoinUpdated));
// Block Pause-Menu when Console is open
// NOTE: Interface patching via IUIActions might cause native crashes in Unity 6.
// SafePatch(harmony, typeof(global::Il2Cpp.InputController.IUIActions), nameof(global::Il2Cpp.InputController.IUIActions.OnPause), typeof(gregCore.GameLayer.Patches.UI.InputPausePatch), nameof(gregCore.GameLayer.Patches.UI.InputPausePatch.Prefix), isPrefix: true);
}
internal static void Emit(HookName hook, EventPayload payload)
+14
View File
@@ -37,9 +37,23 @@ internal sealed class GregDevConsole
public void Toggle()
{
IsOpen = !IsOpen;
var mgm = global::Il2Cpp.MainGameManager.instance;
if (IsOpen)
{
_input = "";
if (mgm != null) mgm.isPauseMenuDisallowed = true;
global::UnityEngine.Cursor.visible = true;
global::UnityEngine.Cursor.lockState = global::UnityEngine.CursorLockMode.None;
}
else
{
if (mgm != null) mgm.isPauseMenuDisallowed = false;
global::UnityEngine.Cursor.visible = false;
global::UnityEngine.Cursor.lockState = global::UnityEngine.CursorLockMode.Locked;
}
}