mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
polish my pain
This commit is contained in:
parent
4a5527d7de
commit
367a167469
5 changed files with 35 additions and 57 deletions
|
@ -1,12 +1,9 @@
|
||||||
using ABI_RC.Core.InteractionSystem;
|
using ABI_RC.Core.InteractionSystem;
|
||||||
using ABI_RC.Core.Player;
|
using ABI_RC.Core.Player;
|
||||||
using ABI_RC.Core.Savior;
|
using ABI_RC.Core.Savior;
|
||||||
using ABI_RC.Core;
|
|
||||||
using cohtml;
|
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using NAK.Melons.MenuScalePatch.Helpers;
|
using NAK.Melons.MenuScalePatch.Helpers;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using MenuScalePatch.Helpers;
|
|
||||||
|
|
||||||
namespace NAK.Melons.MenuScalePatch.HarmonyPatches;
|
namespace NAK.Melons.MenuScalePatch.HarmonyPatches;
|
||||||
|
|
||||||
|
@ -25,7 +22,7 @@ internal class HarmonyPatches
|
||||||
{
|
{
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(CVR_MenuManager), "SetScale")]
|
[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;
|
____scaleFactor = avatarHeight / 1.8f;
|
||||||
if (MetaPort.Instance.isUsingVr) ____scaleFactor *= 0.5f;
|
if (MetaPort.Instance.isUsingVr) ____scaleFactor *= 0.5f;
|
||||||
|
@ -35,7 +32,7 @@ internal class HarmonyPatches
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(ViewManager), "SetScale")]
|
[HarmonyPatch(typeof(ViewManager), "SetScale")]
|
||||||
private static void CheckMMScale(out bool __runOriginal)
|
private static void Prefix_ViewManager_SetScale(out bool __runOriginal)
|
||||||
{
|
{
|
||||||
//bitch
|
//bitch
|
||||||
__runOriginal = false;
|
__runOriginal = false;
|
||||||
|
@ -47,8 +44,10 @@ internal class HarmonyPatches
|
||||||
[HarmonyPatch(typeof(CVR_MenuManager), "UpdateMenuPosition")]
|
[HarmonyPatch(typeof(CVR_MenuManager), "UpdateMenuPosition")]
|
||||||
private static void Prefix_CVR_MenuManager_UpdateMenuPosition(out bool __runOriginal)
|
private static void Prefix_CVR_MenuManager_UpdateMenuPosition(out bool __runOriginal)
|
||||||
{
|
{
|
||||||
|
//fuck u
|
||||||
__runOriginal = false;
|
__runOriginal = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(ViewManager), "UpdateMenuPosition")]
|
[HarmonyPatch(typeof(ViewManager), "UpdateMenuPosition")]
|
||||||
private static void Prefix_ViewManager_UpdateMenuPosition(ref float ___cachedScreenAspectRatio, out bool __runOriginal)
|
private static void Prefix_ViewManager_UpdateMenuPosition(ref float ___cachedScreenAspectRatio, out bool __runOriginal)
|
||||||
|
@ -63,7 +62,7 @@ internal class HarmonyPatches
|
||||||
//Set QM stuff
|
//Set QM stuff
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(CVR_MenuManager), "Start")]
|
[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>();
|
QuickMenuHelper helper = __instance.quickMenu.gameObject.AddComponent<QuickMenuHelper>();
|
||||||
helper.handAnchor = ____leftVrAnchor.transform;
|
helper.handAnchor = ____leftVrAnchor.transform;
|
||||||
|
@ -72,7 +71,7 @@ internal class HarmonyPatches
|
||||||
//Set MM stuff
|
//Set MM stuff
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(ViewManager), "Start")]
|
[HarmonyPatch(typeof(ViewManager), "Start")]
|
||||||
private static void SetupMMHelper(ref ViewManager __instance)
|
private static void Postfix_ViewManager_Start(ref ViewManager __instance)
|
||||||
{
|
{
|
||||||
__instance.gameObject.AddComponent<MainMenuHelper>();
|
__instance.gameObject.AddComponent<MainMenuHelper>();
|
||||||
}
|
}
|
||||||
|
@ -80,7 +79,7 @@ internal class HarmonyPatches
|
||||||
//hook quickmenu open/close
|
//hook quickmenu open/close
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(CVR_MenuManager), "ToggleQuickMenu", new Type[] { typeof(bool) })]
|
[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 (QuickMenuHelper.Instance == null) return;
|
||||||
if (show != ____quickMenuOpen)
|
if (show != ____quickMenuOpen)
|
||||||
|
@ -91,14 +90,6 @@ internal class HarmonyPatches
|
||||||
QuickMenuHelper.Instance.enabled = show;
|
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
|
//hook menu open/close
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(ViewManager), "UiStateToggle", new Type[] { typeof(bool) })]
|
[HarmonyPatch(typeof(ViewManager), "UiStateToggle", new Type[] { typeof(bool) })]
|
||||||
|
@ -113,10 +104,18 @@ internal class HarmonyPatches
|
||||||
MainMenuHelper.Instance.enabled = show;
|
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.
|
//Support for changing VRMode during runtime.
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(PlayerSetup), "CalibrateAvatar")]
|
[HarmonyPatch(typeof(PlayerSetup), "CalibrateAvatar")]
|
||||||
private static void CheckVRModeOnSwitch()
|
private static void Postfix_PlayerSetup_CalibrateAvatar()
|
||||||
{
|
{
|
||||||
MSP_MenuInfo.CameraTransform = PlayerSetup.Instance.GetActiveCamera().transform;
|
MSP_MenuInfo.CameraTransform = PlayerSetup.Instance.GetActiveCamera().transform;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.Savior;
|
||||||
using ABI_RC.Core;
|
|
||||||
using ABI_RC.Systems.MovementSystem;
|
|
||||||
using cohtml;
|
|
||||||
using HarmonyLib;
|
|
||||||
using MelonLoader;
|
|
||||||
using UnityEngine;
|
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
|
//TODO: Implement desktop ratio scaling back to MM
|
||||||
|
|
||||||
|
|
|
@ -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.Savior;
|
||||||
using ABI_RC.Core;
|
|
||||||
using ABI_RC.Systems.MovementSystem;
|
|
||||||
using cohtml;
|
|
||||||
using HarmonyLib;
|
|
||||||
using MelonLoader;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Reflection;
|
|
||||||
using NAK.Melons.MenuScalePatch.Helpers;
|
|
||||||
|
|
||||||
namespace MenuScalePatch.Helpers;
|
namespace NAK.Melons.MenuScalePatch.Helpers;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
using System;
|
using ABI_RC.Core;
|
||||||
using System.Reflection;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using UnityEngine;
|
|
||||||
using ABI_RC.Core.InteractionSystem;
|
using ABI_RC.Core.InteractionSystem;
|
||||||
using ABI_RC.Core.Player;
|
using ABI_RC.Core.Player;
|
||||||
using ABI_RC.Core.Savior;
|
using ABI_RC.Core.Savior;
|
||||||
using ABI_RC.Core;
|
|
||||||
using ABI_RC.Systems.MovementSystem;
|
using ABI_RC.Systems.MovementSystem;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
|
using System.Reflection;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NAK.Melons.MenuScalePatch.Helpers;
|
namespace NAK.Melons.MenuScalePatch.Helpers;
|
||||||
|
|
||||||
|
@ -46,16 +41,22 @@ public class MSP_MenuInfo
|
||||||
public static void HandleIndependentLookInput()
|
public static void HandleIndependentLookInput()
|
||||||
{
|
{
|
||||||
//angle of independent look axis
|
//angle of independent look axis
|
||||||
float angle = (float)ms_followAngleY.GetValue(MovementSystem.Instance);
|
bool isPressed = CVRInputManager.Instance.independentHeadTurn || CVRInputManager.Instance.independentHeadToggle;
|
||||||
bool isPressed = CVRInputManager.Instance.independentHeadTurn;
|
|
||||||
if (isPressed && !independentHeadTurn)
|
if (isPressed && !independentHeadTurn)
|
||||||
{
|
{
|
||||||
independentHeadTurn = true;
|
independentHeadTurn = true;
|
||||||
MSP_MenuInfo.ToggleDesktopInputMethod(false);
|
MSP_MenuInfo.ToggleDesktopInputMethod(false);
|
||||||
}else if (!isPressed && independentHeadTurn && angle == 0f)
|
QuickMenuHelper.Instance.UpdateWorldAnchors();
|
||||||
|
MainMenuHelper.Instance.UpdateWorldAnchors();
|
||||||
|
}
|
||||||
|
else if (!isPressed && independentHeadTurn)
|
||||||
{
|
{
|
||||||
independentHeadTurn = false;
|
float angle = (float)ms_followAngleY.GetValue(MovementSystem.Instance);
|
||||||
MSP_MenuInfo.ToggleDesktopInputMethod(true);
|
if (angle == 0f)
|
||||||
|
{
|
||||||
|
independentHeadTurn = false;
|
||||||
|
MSP_MenuInfo.ToggleDesktopInputMethod(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,10 +1,4 @@
|
||||||
using ABI_RC.Core.InteractionSystem;
|
using MelonLoader;
|
||||||
using ABI_RC.Core.Player;
|
|
||||||
using ABI_RC.Core.Savior;
|
|
||||||
using cohtml;
|
|
||||||
using HarmonyLib;
|
|
||||||
using MelonLoader;
|
|
||||||
using UnityEngine;
|
|
||||||
using NAK.Melons.MenuScalePatch.Helpers;
|
using NAK.Melons.MenuScalePatch.Helpers;
|
||||||
|
|
||||||
namespace NAK.Melons.MenuScalePatch;
|
namespace NAK.Melons.MenuScalePatch;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue