diff --git a/MenuScalePatch/HarmonyPatches.cs b/MenuScalePatch/HarmonyPatches.cs index 97e38aa..8f601d8 100644 --- a/MenuScalePatch/HarmonyPatches.cs +++ b/MenuScalePatch/HarmonyPatches.cs @@ -1,12 +1,9 @@ using ABI_RC.Core.InteractionSystem; using ABI_RC.Core.Player; using ABI_RC.Core.Savior; -using ABI_RC.Core; -using cohtml; using HarmonyLib; using NAK.Melons.MenuScalePatch.Helpers; using UnityEngine; -using MenuScalePatch.Helpers; namespace NAK.Melons.MenuScalePatch.HarmonyPatches; @@ -25,7 +22,7 @@ internal class HarmonyPatches { [HarmonyPrefix] [HarmonyPatch(typeof(CVR_MenuManager), "SetScale")] - private static void SetQMScale(float avatarHeight, ref float ____scaleFactor, out bool __runOriginal) + private static void Prefix_CVR_MenuManager_SetScale(float avatarHeight, ref float ____scaleFactor, out bool __runOriginal) { ____scaleFactor = avatarHeight / 1.8f; if (MetaPort.Instance.isUsingVr) ____scaleFactor *= 0.5f; @@ -35,7 +32,7 @@ internal class HarmonyPatches [HarmonyPrefix] [HarmonyPatch(typeof(ViewManager), "SetScale")] - private static void CheckMMScale(out bool __runOriginal) + private static void Prefix_ViewManager_SetScale(out bool __runOriginal) { //bitch __runOriginal = false; @@ -47,8 +44,10 @@ internal class HarmonyPatches [HarmonyPatch(typeof(CVR_MenuManager), "UpdateMenuPosition")] private static void Prefix_CVR_MenuManager_UpdateMenuPosition(out bool __runOriginal) { + //fuck u __runOriginal = false; } + [HarmonyPrefix] [HarmonyPatch(typeof(ViewManager), "UpdateMenuPosition")] private static void Prefix_ViewManager_UpdateMenuPosition(ref float ___cachedScreenAspectRatio, out bool __runOriginal) @@ -63,7 +62,7 @@ internal class HarmonyPatches //Set QM stuff [HarmonyPostfix] [HarmonyPatch(typeof(CVR_MenuManager), "Start")] - private static void SetupQMHelper(ref CVR_MenuManager __instance, ref GameObject ____leftVrAnchor) + private static void Postfix_CVR_MenuManager_Start(ref CVR_MenuManager __instance, ref GameObject ____leftVrAnchor) { QuickMenuHelper helper = __instance.quickMenu.gameObject.AddComponent(); helper.handAnchor = ____leftVrAnchor.transform; @@ -72,7 +71,7 @@ internal class HarmonyPatches //Set MM stuff [HarmonyPostfix] [HarmonyPatch(typeof(ViewManager), "Start")] - private static void SetupMMHelper(ref ViewManager __instance) + private static void Postfix_ViewManager_Start(ref ViewManager __instance) { __instance.gameObject.AddComponent(); } @@ -80,7 +79,7 @@ internal class HarmonyPatches //hook quickmenu open/close [HarmonyPrefix] [HarmonyPatch(typeof(CVR_MenuManager), "ToggleQuickMenu", new Type[] { typeof(bool) })] - private static void Postfix_CVR_MenuManager_ToggleQuickMenu(bool show, ref bool ____quickMenuOpen) + private static void Prefix_CVR_MenuManager_ToggleQuickMenu(bool show, ref bool ____quickMenuOpen) { if (QuickMenuHelper.Instance == null) return; if (show != ____quickMenuOpen) @@ -91,14 +90,6 @@ internal class HarmonyPatches QuickMenuHelper.Instance.enabled = show; } - //add independent head movement to important input - [HarmonyPostfix] - [HarmonyPatch(typeof(InputModuleMouseKeyboard), "UpdateImportantInput")] - private static void Postfix_InputModuleMouseKeyboard_UpdateImportantInput(ref CVRInputManager ____inputManager) - { - ____inputManager.independentHeadTurn |= Input.GetKey(KeyCode.LeftAlt); - } - //hook menu open/close [HarmonyPrefix] [HarmonyPatch(typeof(ViewManager), "UiStateToggle", new Type[] { typeof(bool) })] @@ -113,10 +104,18 @@ internal class HarmonyPatches MainMenuHelper.Instance.enabled = show; } + //add independent head movement to important input + [HarmonyPostfix] + [HarmonyPatch(typeof(InputModuleMouseKeyboard), "UpdateImportantInput")] + private static void Postfix_InputModuleMouseKeyboard_UpdateImportantInput(ref CVRInputManager ____inputManager) + { + ____inputManager.independentHeadTurn |= Input.GetKey(KeyCode.LeftAlt); + } + //Support for changing VRMode during runtime. [HarmonyPostfix] [HarmonyPatch(typeof(PlayerSetup), "CalibrateAvatar")] - private static void CheckVRModeOnSwitch() + private static void Postfix_PlayerSetup_CalibrateAvatar() { MSP_MenuInfo.CameraTransform = PlayerSetup.Instance.GetActiveCamera().transform; } diff --git a/MenuScalePatch/Helpers/MainMenuHelper.cs b/MenuScalePatch/Helpers/MainMenuHelper.cs index 5959276..2df6d1b 100644 --- a/MenuScalePatch/Helpers/MainMenuHelper.cs +++ b/MenuScalePatch/Helpers/MainMenuHelper.cs @@ -1,16 +1,8 @@ -using ABI_RC.Core.InteractionSystem; -using ABI_RC.Core.Player; +using ABI_RC.Core.Player; using ABI_RC.Core.Savior; -using ABI_RC.Core; -using ABI_RC.Systems.MovementSystem; -using cohtml; -using HarmonyLib; -using MelonLoader; using UnityEngine; -using System.Reflection; -using NAK.Melons.MenuScalePatch.Helpers; -namespace MenuScalePatch.Helpers; +namespace NAK.Melons.MenuScalePatch.Helpers; //TODO: Implement desktop ratio scaling back to MM diff --git a/MenuScalePatch/Helpers/QuickMenuHelper.cs b/MenuScalePatch/Helpers/QuickMenuHelper.cs index e2b5fce..834251f 100644 --- a/MenuScalePatch/Helpers/QuickMenuHelper.cs +++ b/MenuScalePatch/Helpers/QuickMenuHelper.cs @@ -1,16 +1,8 @@ -using ABI_RC.Core.InteractionSystem; -using ABI_RC.Core.Player; +using ABI_RC.Core.Player; using ABI_RC.Core.Savior; -using ABI_RC.Core; -using ABI_RC.Systems.MovementSystem; -using cohtml; -using HarmonyLib; -using MelonLoader; using UnityEngine; -using System.Reflection; -using NAK.Melons.MenuScalePatch.Helpers; -namespace MenuScalePatch.Helpers; +namespace NAK.Melons.MenuScalePatch.Helpers; /** diff --git a/MenuScalePatch/MSP_Menus.cs b/MenuScalePatch/MSP_Menus.cs index 0e56fbf..290781c 100644 --- a/MenuScalePatch/MSP_Menus.cs +++ b/MenuScalePatch/MSP_Menus.cs @@ -1,16 +1,11 @@ -using System; -using System.Reflection; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using UnityEngine; +using ABI_RC.Core; using ABI_RC.Core.InteractionSystem; using ABI_RC.Core.Player; using ABI_RC.Core.Savior; -using ABI_RC.Core; using ABI_RC.Systems.MovementSystem; using HarmonyLib; +using System.Reflection; +using UnityEngine; namespace NAK.Melons.MenuScalePatch.Helpers; @@ -46,16 +41,22 @@ public class MSP_MenuInfo public static void HandleIndependentLookInput() { //angle of independent look axis - float angle = (float)ms_followAngleY.GetValue(MovementSystem.Instance); - bool isPressed = CVRInputManager.Instance.independentHeadTurn; + bool isPressed = CVRInputManager.Instance.independentHeadTurn || CVRInputManager.Instance.independentHeadToggle; if (isPressed && !independentHeadTurn) { independentHeadTurn = true; MSP_MenuInfo.ToggleDesktopInputMethod(false); - }else if (!isPressed && independentHeadTurn && angle == 0f) + QuickMenuHelper.Instance.UpdateWorldAnchors(); + MainMenuHelper.Instance.UpdateWorldAnchors(); + } + else if (!isPressed && independentHeadTurn) { - independentHeadTurn = false; - MSP_MenuInfo.ToggleDesktopInputMethod(true); + float angle = (float)ms_followAngleY.GetValue(MovementSystem.Instance); + if (angle == 0f) + { + independentHeadTurn = false; + MSP_MenuInfo.ToggleDesktopInputMethod(true); + } } } } \ No newline at end of file diff --git a/MenuScalePatch/Main.cs b/MenuScalePatch/Main.cs index 812989b..72a78d2 100644 --- a/MenuScalePatch/Main.cs +++ b/MenuScalePatch/Main.cs @@ -1,10 +1,4 @@ -using ABI_RC.Core.InteractionSystem; -using ABI_RC.Core.Player; -using ABI_RC.Core.Savior; -using cohtml; -using HarmonyLib; -using MelonLoader; -using UnityEngine; +using MelonLoader; using NAK.Melons.MenuScalePatch.Helpers; namespace NAK.Melons.MenuScalePatch;