polish my pain

This commit is contained in:
NotAKidoS 2023-01-03 21:38:23 -06:00
parent 4a5527d7de
commit 367a167469
5 changed files with 35 additions and 57 deletions

View file

@ -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<QuickMenuHelper>();
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<MainMenuHelper>();
}
@ -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;
}

View file

@ -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

View file

@ -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;
/**

View file

@ -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);
}
}
}
}

View file

@ -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;