From 65442023aabd0281b0af6593de6e2d2b6d1d5ef0 Mon Sep 17 00:00:00 2001 From: originalnicodr Date: Sun, 10 Mar 2024 16:56:44 -0300 Subject: [PATCH] Stopped patching the mouse position since it caused problems with moving panels around on the screen in some games (Aragami 2, Road 96). --- src/Cinematic/IInputManager.cs | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/src/Cinematic/IInputManager.cs b/src/Cinematic/IInputManager.cs index e16fb8e..b5d2030 100644 --- a/src/Cinematic/IInputManager.cs +++ b/src/Cinematic/IInputManager.cs @@ -88,7 +88,10 @@ namespace UniverseLib.Input } } - public static Vector3 MousePosition => currentInputType == InputType.Legacy ? (Vector3)ILegacyInput.MousePosition : (Vector3)InputManager.MousePosition; + // We won't mock this as it made it impossible to drag the mod panels across the screen in some games for some reason. + // It might affect some games that use custom classes to control the camera, but those would still probably need to be + // manually disabled because of the camera position control override. Should try it out with more games. + public static Vector3 MousePosition => (Vector3)InputManager.MousePosition; } public static class ILegacyInput { @@ -98,8 +101,6 @@ namespace UniverseLib.Input public static Dictionary getMouseButton = new Dictionary(); public static Dictionary getMouseButtonDown = new Dictionary(); - - public static Vector3 MousePosition; // Wrapped methods @@ -243,19 +244,6 @@ namespace UniverseLib.Input postfix: new(AccessTools.Method(typeof(ILegacyInput), nameof(OverrideMouseButtonDown)))); } catch { } - - try - { - MethodInfo getMousePositionMethod = t_Input.GetProperty("mousePosition").GetGetMethod(); - //ExplorerCore.LogWarning(getMousePositionMethod); -#if CPP - if (IL2CPPUtils.GetIl2CppMethodInfoPointerFieldForGeneratedMethod(getMousePositionMethod) == null) - throw new Exception(); -#endif - ExplorerCore.Harmony.Patch(getMousePositionMethod, - postfix: new(AccessTools.Method(typeof(ILegacyInput), nameof(OverrideMousePosition)))); - } - catch { } } // Postfix functions @@ -336,14 +324,5 @@ namespace UniverseLib.Input __result = false; } } - - public static void OverrideMousePosition(ref Vector3 __result) - { - MousePosition = __result; - - if (FreeCamPanel.ShouldOverrideInput() && !UIManager.ShowMenu){ - __result = Vector3.zero; - } - } } }