Move many mods to Deprecated folder, fix spelling

This commit is contained in:
NotAKidoS 2025-04-03 02:57:35 -05:00
parent 5e822cec8d
commit 0042590aa6
539 changed files with 7475 additions and 3120 deletions

View file

@ -0,0 +1,203 @@
using ABI.CCK.Components;
using ABI_RC.Core;
using ABI_RC.Core.InteractionSystem;
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using HarmonyLib;
using NAK.MenuScalePatch.Helpers;
using System.Reflection;
using System.Reflection.Emit;
using UnityEngine;
namespace NAK.MenuScalePatch.HarmonyPatches;
/**
ViewManager.SetScale runs once a second when it should only run when aspect ratio changes- CVR bug
assuming its caused by cast from int to float getting the screen size, something floating point bleh
**/
[HarmonyPatch]
internal class HarmonyPatches
{
//stuff needed on start
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerSetup), "Start")]
private static void Postfix_PlayerSetup_Start()
{
MSP_MenuInfo.CameraTransform = PlayerSetup.Instance.GetActiveCamera().transform;
MenuScalePatch.UpdateSettings();
QuickMenuHelper.Instance.CreateWorldAnchors();
MainMenuHelper.Instance.CreateWorldAnchors();
}
[HarmonyPrefix]
[HarmonyPatch(typeof(CVR_MenuManager), "SetScale")]
private static bool Prefix_CVR_MenuManager_SetScale(float avatarHeight, ref float ____scaleFactor)
{
____scaleFactor = avatarHeight / 1.8f;
if (MetaPort.Instance.isUsingVr) ____scaleFactor *= 0.5f;
MSP_MenuInfo.ScaleFactor = ____scaleFactor;
if (!MSP_MenuInfo.PlayerAnchorMenus)
{
QuickMenuHelper.Instance.NeedsPositionUpdate = true;
MainMenuHelper.Instance.NeedsPositionUpdate = true;
}
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ViewManager), "SetScale")]
private static bool Prefix_ViewManager_SetScale()
{
return false;
}
//nuke UpdateMenuPosition methods
//there are 2 Jobs calling this each second, which is fucking my shit
[HarmonyPrefix]
[HarmonyPatch(typeof(CVR_MenuManager), "UpdateMenuPosition")]
private static bool Prefix_CVR_MenuManager_UpdateMenuPosition()
{
if (QuickMenuHelper.Instance == null) return true;
return !QuickMenuHelper.Instance.MenuIsOpen;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(ViewManager), "UpdateMenuPosition")]
private static bool Prefix_ViewManager_UpdateMenuPosition(ref float ___cachedScreenAspectRatio)
{
if (MainMenuHelper.Instance == null) return true;
//this is called once a second, so ill fix their dumb aspect ratio shit
float ratio = (float)Screen.width / (float)Screen.height;
float clamp = Mathf.Clamp(ratio, 0f, 1.8f);
MSP_MenuInfo.AspectRatio = 1.7777779f / clamp;
return !MainMenuHelper.Instance.MenuIsOpen;
}
//Set QM stuff
[HarmonyPostfix]
[HarmonyPatch(typeof(CVR_MenuManager), "Start")]
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;
}
//Set MM stuff
[HarmonyPostfix]
[HarmonyPatch(typeof(ViewManager), "Start")]
private static void Postfix_ViewManager_Start(ref ViewManager __instance)
{
__instance.gameObject.AddComponent<MainMenuHelper>();
}
//hook quickmenu open/close
[HarmonyPrefix]
[HarmonyPatch(typeof(CVR_MenuManager), "ToggleQuickMenu", new Type[] { typeof(bool) })]
private static bool Prefix_CVR_MenuManager_ToggleQuickMenu(bool show, ref CVR_MenuManager __instance, ref bool ____quickMenuOpen)
{
if (QuickMenuHelper.Instance == null) return true;
if (show != ____quickMenuOpen)
{
____quickMenuOpen = show;
__instance.quickMenu.enabled = true;
__instance.quickMenuAnimator.SetBool("Open", show);
QuickMenuHelper.Instance.MenuIsOpen = show;
QuickMenuHelper.Instance.UpdateWorldAnchors(show);
//shouldnt run if switching menus on desktop
if (!MetaPort.Instance.isUsingVr)
{
if (!show && MainMenuHelper.Instance.MenuIsOpen)
{
return false;
}
ViewManager.Instance.UiStateToggle(false);
}
MSP_MenuInfo.ToggleDesktopInputMethod(show);
CVRPlayerManager.Instance.ReloadAllNameplates();
}
return false;
}
//hook menu open/close
[HarmonyPrefix]
[HarmonyPatch(typeof(ViewManager), "UiStateToggle", new Type[] { typeof(bool) })]
private static bool Prefix_ViewManager_UiStateToggle(bool show, ref ViewManager __instance, ref bool ____gameMenuOpen)
{
if (MainMenuHelper.Instance == null) return true;
if (show != ____gameMenuOpen)
{
____gameMenuOpen = show;
__instance.gameMenuView.enabled = true;
__instance.uiMenuAnimator.SetBool("Open", show);
MainMenuHelper.Instance.MenuIsOpen = show;
MainMenuHelper.Instance.UpdateWorldAnchors(show);
//shouldnt run if switching menus on desktop
if (!MetaPort.Instance.isUsingVr)
{
if (!show && QuickMenuHelper.Instance.MenuIsOpen)
{
return false;
}
CVR_MenuManager.Instance.ToggleQuickMenu(false);
}
MSP_MenuInfo.ToggleDesktopInputMethod(show);
CVRPlayerManager.Instance.ReloadAllNameplates();
}
return false;
}
//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(CVRTools), "ConfigureHudAffinity")]
private static void Postfix_CVRTools_ConfigureHudAffinity()
{
MSP_MenuInfo.CameraTransform = PlayerSetup.Instance.GetActiveCamera().transform;
}
// prevents CVRWorld from closing menus when world transitioning, cause cool
[HarmonyTranspiler]
[HarmonyPatch(typeof(CVRWorld), nameof(CVRWorld.Start), MethodType.Enumerator)]
private static IEnumerable<CodeInstruction> Transpiler_CVRWorld_Start(IEnumerable<CodeInstruction> instructions, ILGenerator il)
{
var patchedInstructions = new CodeMatcher(instructions).MatchForward(false,
new CodeMatch(OpCodes.Ldsfld),
new CodeMatch(OpCodes.Ldc_I4_0),
new CodeMatch(i => i.opcode == OpCodes.Callvirt && i.operand is MethodInfo { Name: "ForceUiStatus" }))
.RemoveInstructions(3)
.InstructionEnumeration();
patchedInstructions = new CodeMatcher(patchedInstructions).MatchForward(false,
new CodeMatch(OpCodes.Ldsfld),
new CodeMatch(OpCodes.Ldc_I4_0),
new CodeMatch(i => i.opcode == OpCodes.Callvirt && i.operand is MethodInfo { Name: "ToggleQuickMenu" }))
.RemoveInstructions(3)
.InstructionEnumeration();
return patchedInstructions;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CVR_DesktopCameraController), nameof(CVR_DesktopCameraController.UpdateFov))]
private static void Postfix_CVR_DesktopCameraController_UpdateFov()
{
if (!MenuScalePatch.EntryUseFOVAdjustment.Value)
{
MSP_MenuInfo.FOVAdjustment = 1f;
return;
}
const float minFovValue = 60f;
const float maxFovValue = 120f;
MSP_MenuInfo.FOVAdjustment =
1f + (2f * Mathf.Clamp01((CVR_DesktopCameraController.defaultFov - minFovValue) / (maxFovValue - minFovValue)));
}
}

View file

@ -0,0 +1,112 @@
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using UnityEngine;
namespace NAK.MenuScalePatch.Helpers;
//TODO: Implement desktop ratio scaling back to MM
/**
This helper is assigned to the MainMenu object.
The DefaultExecutionOrder attribute saves me from needing
to use OnPreRender() callback... yay.
**/
[DefaultExecutionOrder(20000)]
public class MainMenuHelper : MonoBehaviour
{
public static MainMenuHelper Instance;
public Transform worldAnchor;
public bool NeedsPositionUpdate;
public bool MenuIsOpen;
private void Awake()
{
Instance = this;
}
private void LateUpdate()
{
if (!MenuIsOpen) return;
if (MSP_MenuInfo.PlayerAnchorMenus || NeedsPositionUpdate)
{
UpdateMenuPosition();
}
if (MSP_MenuInfo.UseIndependentHeadTurn)
{
MSP_MenuInfo.HandleIndependentHeadTurnInput();
}
}
public void CreateWorldAnchors()
{
//VR specific anchor
GameObject vrAnchor = new GameObject("MSP_MMVR_Anchor");
vrAnchor.transform.parent = PlayerSetup.Instance.vrCameraRig.transform;
vrAnchor.transform.localPosition = Vector3.zero;
worldAnchor = vrAnchor.transform;
}
public void UpdateWorldAnchors(bool updateMenuPos = false)
{
if (worldAnchor == null || MSP_MenuInfo.CameraTransform == null) return;
if (MetaPort.Instance.isUsingVr)
{
float zRotation = Mathf.Abs(MSP_MenuInfo.CameraTransform.localRotation.eulerAngles.z);
float minTilt = MetaPort.Instance.settings.GetSettingsFloat("GeneralMinimumMenuTilt", 0f);
if (zRotation <= minTilt || zRotation >= 360f - minTilt)
{
worldAnchor.rotation = Quaternion.LookRotation(MSP_MenuInfo.CameraTransform.forward, Vector3.up);
}
else
{
worldAnchor.rotation = MSP_MenuInfo.CameraTransform.rotation;
}
worldAnchor.position = MSP_MenuInfo.CameraTransform.position + MSP_MenuInfo.CameraTransform.forward * 2f * MSP_MenuInfo.ScaleFactor;
}
else
{
worldAnchor.rotation = MSP_MenuInfo.CameraTransform.rotation;
worldAnchor.position = MSP_MenuInfo.CameraTransform.position;
}
if (updateMenuPos) UpdateMenuPosition();
}
public void UpdateMenuPosition()
{
NeedsPositionUpdate = false;
if (MetaPort.Instance.isUsingVr)
{
HandleVRPosition();
return;
}
HandleDesktopPosition();
}
//Desktop Main Menu
public void HandleDesktopPosition()
{
if (MSP_MenuInfo.CameraTransform == null || MSP_MenuInfo.DisableMMHelper) return;
Transform activeAnchor = MSP_MenuInfo.isIndependentHeadTurn ? worldAnchor : MSP_MenuInfo.CameraTransform;
transform.localScale = new Vector3(1.6f * MSP_MenuInfo.ScaleFactor * MSP_MenuInfo.FOVAdjustment, 0.9f * MSP_MenuInfo.ScaleFactor * MSP_MenuInfo.FOVAdjustment, 1f);
transform.position = activeAnchor.position + activeAnchor.forward * 1f * MSP_MenuInfo.ScaleFactor * MSP_MenuInfo.AspectRatio;
transform.rotation = activeAnchor.rotation;
}
//VR Main Menu
public void HandleVRPosition()
{
if (worldAnchor == null || MSP_MenuInfo.DisableMMHelper_VR) return;
transform.localScale = new Vector3(1.6f * MSP_MenuInfo.ScaleFactor * 1.8f, 0.9f * MSP_MenuInfo.ScaleFactor * 1.8f, 1f);
transform.position = worldAnchor.position;
transform.rotation = worldAnchor.rotation;
}
}

View file

@ -0,0 +1,100 @@
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using UnityEngine;
namespace NAK.MenuScalePatch.Helpers;
/**
This helper is assigned to the QuickMenu object.
The DefaultExecutionOrder attribute saves me from needing
to use OnPreRender() callback... yay.
**/
[DefaultExecutionOrder(20000)]
public class QuickMenuHelper : MonoBehaviour
{
public static QuickMenuHelper Instance;
public Transform worldAnchor;
public Transform handAnchor;
public bool NeedsPositionUpdate;
public bool MenuIsOpen;
private void Awake()
{
Instance = this;
}
private void LateUpdate()
{
if (!MenuIsOpen) return;
if (MSP_MenuInfo.PlayerAnchorMenus || NeedsPositionUpdate || MetaPort.Instance.isUsingVr)
{
UpdateMenuPosition();
}
if (MSP_MenuInfo.UseIndependentHeadTurn)
{
MSP_MenuInfo.HandleIndependentHeadTurnInput();
}
}
public void CreateWorldAnchors()
{
//VR specific anchor
GameObject vrAnchor = new GameObject("MSP_QMVR_Anchor");
vrAnchor.transform.parent = PlayerSetup.Instance.vrCameraRig.transform;
vrAnchor.transform.localPosition = Vector3.zero;
worldAnchor = vrAnchor.transform;
}
public void UpdateWorldAnchors(bool updateMenuPos = false)
{
if (worldAnchor == null || MSP_MenuInfo.CameraTransform == null) return;
worldAnchor.rotation = MSP_MenuInfo.CameraTransform.rotation;
worldAnchor.position = MSP_MenuInfo.CameraTransform.position;
if (updateMenuPos) UpdateMenuPosition();
}
public void UpdateMenuPosition()
{
NeedsPositionUpdate = false;
if (MetaPort.Instance.isUsingVr)
{
HandleVRPosition();
return;
}
HandleDesktopPosition();
}
//Desktop Quick Menu
public void HandleDesktopPosition()
{
if (MSP_MenuInfo.CameraTransform == null || MSP_MenuInfo.DisableQMHelper) return;
Transform activeAnchor = MSP_MenuInfo.isIndependentHeadTurn ? worldAnchor : MSP_MenuInfo.CameraTransform;
transform.localScale = new Vector3(1f * MSP_MenuInfo.ScaleFactor * MSP_MenuInfo.FOVAdjustment, 1f * MSP_MenuInfo.ScaleFactor * MSP_MenuInfo.FOVAdjustment, 1f);
transform.rotation = activeAnchor.rotation;
transform.position = activeAnchor.position + activeAnchor.transform.forward * 1f * MSP_MenuInfo.ScaleFactor;
}
//VR Quick Menu
public void HandleVRPosition()
{
if (handAnchor == null || MSP_MenuInfo.DisableQMHelper_VR) return;
if (MSP_MenuInfo.WorldAnchorQM)
{
transform.localScale = new Vector3(1f * MSP_MenuInfo.ScaleFactor, 1f * MSP_MenuInfo.ScaleFactor, 1f);
transform.position = worldAnchor.position + worldAnchor.transform.forward * 1f * MSP_MenuInfo.ScaleFactor;
transform.rotation = worldAnchor.rotation;
return;
}
transform.localScale = new Vector3(1f * MSP_MenuInfo.ScaleFactor, 1f * MSP_MenuInfo.ScaleFactor, 1f);
transform.position = handAnchor.position;
transform.rotation = handAnchor.rotation;
}
}

View file

@ -0,0 +1,67 @@
using ABI_RC.Core;
using ABI_RC.Core.InteractionSystem;
using ABI_RC.Core.Savior;
using ABI_RC.Systems.MovementSystem;
using UnityEngine;
namespace NAK.MenuScalePatch.Helpers;
public class MSP_MenuInfo
{
//Shared Info
internal static float ScaleFactor = 1f;
internal static float AspectRatio = 1f;
internal static float FOVAdjustment = 1f;
internal static Transform CameraTransform;
//Settings...?
internal static bool WorldAnchorQM = false;
internal static bool UseIndependentHeadTurn = true;
internal static bool PlayerAnchorMenus = true;
//Debug/Integration
public static bool DisableQMHelper;
public static bool DisableQMHelper_VR;
public static bool DisableMMHelper;
public static bool DisableMMHelper_VR;
internal static bool isIndependentHeadTurn = false;
internal static void ToggleDesktopInputMethod(bool flag)
{
if (MetaPort.Instance.isUsingVr) return;
ViewManager.Instance._desktopMouseMode = flag;
CVR_MenuManager.Instance._desktopMouseMode = flag;
RootLogic.Instance.ToggleMouse(flag);
CVRInputManager.Instance.inputEnabled = !flag;
CVR_MenuManager.Instance.desktopControllerRay.enabled = !flag;
}
internal static void HandleIndependentHeadTurnInput()
{
//angle of independent look axis
bool isPressed = CVRInputManager.Instance.independentHeadTurn || CVRInputManager.Instance.independentHeadToggle;
if (isPressed && !isIndependentHeadTurn)
{
isIndependentHeadTurn = true;
MSP_MenuInfo.ToggleDesktopInputMethod(false);
QuickMenuHelper.Instance.UpdateWorldAnchors();
MainMenuHelper.Instance.UpdateWorldAnchors();
}
else if (!isPressed && isIndependentHeadTurn)
{
float angleX = MovementSystem.Instance._followAngleX;
float angleY = MovementSystem.Instance._followAngleY;
float manualAngleX = MovementSystem.Instance._manualAngleX;
if (angleY == 0f && angleX == manualAngleX)
{
isIndependentHeadTurn = false;
MSP_MenuInfo.ToggleDesktopInputMethod(true);
QuickMenuHelper.Instance.NeedsPositionUpdate = true;
MainMenuHelper.Instance.NeedsPositionUpdate = true;
}
}
}
}

View file

@ -0,0 +1,33 @@
using MelonLoader;
namespace NAK.MenuScalePatch;
public class MenuScalePatch : MelonMod
{
public static MelonPreferences_Category Category =
MelonPreferences.CreateCategory(nameof(MenuScalePatch));
public static MelonPreferences_Entry<bool> EntryUseIndependentHeadTurn =
Category.CreateEntry<bool>("Use Independent Head Turn", true, description: "Should you be able to use independent head turn in a menu while in Desktop?");
public static MelonPreferences_Entry<bool> EntryPlayerAnchorMenus =
Category.CreateEntry<bool>("Player Anchor Menus", true, description: "Should the menus be anchored to & constantly follow the player?");
public static MelonPreferences_Entry<bool> EntryUseFOVAdjustment =
Category.CreateEntry<bool>("Use FOV Adjustment", true, description: "Should the menus adjust to your changed FOV?");
public override void OnInitializeMelon()
{
foreach (var setting in Category.Entries)
{
setting.OnEntryValueChangedUntyped.Subscribe(OnUpdateSettings);
}
}
internal static void UpdateSettings()
{
Helpers.MSP_MenuInfo.UseIndependentHeadTurn = EntryUseIndependentHeadTurn.Value;
Helpers.MSP_MenuInfo.PlayerAnchorMenus = EntryPlayerAnchorMenus.Value;
}
private static void OnUpdateSettings(object arg1, object arg2) => UpdateSettings();
}

View file

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk"/>

View file

@ -0,0 +1,29 @@
using MelonLoader;
using NAK.MenuScalePatch.Properties;
using System.Reflection;
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyTitle(nameof(NAK.MenuScalePatch))]
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
[assembly: AssemblyProduct(nameof(NAK.MenuScalePatch))]
[assembly: MelonInfo(
typeof(NAK.MenuScalePatch.MenuScalePatch),
nameof(NAK.MenuScalePatch),
AssemblyInfoParams.Version,
AssemblyInfoParams.Author,
downloadLink: "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/MenuScalePatch"
)]
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
namespace NAK.MenuScalePatch.Properties;
internal static class AssemblyInfoParams
{
public const string Version = "4.2.8";
public const string Author = "NotAKidoS";
}

View file

@ -0,0 +1,33 @@
# MenuScalePatch
Originally forced menu position to update while scaling. Now changes ChilloutVR menu behavior to feel less clunky.
## Features:
* Menu position properly updates at end of update cycle.
* This makes sure menu is always correctly positioned while moving and scaling.
* This also allows for menus to be used while moving. (this is iffy though)
* Adds independent head moving support while on Desktop. (makes selecting users easier)
* Hold ALT while on Desktop. Native feature that now works while in a menu.
* Implemented world anchors for menus. They can now be placed in the world, but still attached to you.
* This is used for independent head movement internally, as well as a toggle for VR QM.
* Main Menu in VR is now attached to player rig.
* Menu will now follow you while moving in world space, but not while moving in play space.
* Menus are no longer forced closed on world start.
https://user-images.githubusercontent.com/37721153/189479474-41e93dff-a695-42f2-9d20-6a895a723039.mp4
---
Here is the block of text where I tell you this mod is not affiliated or endorsed by ABI.
https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
> This mod is an independent creation and is not affiliated with, supported by or approved by Alpha Blend Interactive.
> Use of this mod is done so at the user's own risk and the creator cannot be held responsible for any issues arising from its use.
> To the best of my knowledge, I have adhered to the Modding Guidelines established by Alpha Blend Interactive.

View file

@ -0,0 +1,23 @@
{
"_id": 95,
"name": "MenuScalePatch",
"modversion": "4.2.8",
"gameversion": "2022r170p1",
"loaderversion": "0.6.1",
"modtype": "Mod",
"author": "NotAKidoS",
"description": "Corrects MM and QM position when avatar is being scaled.\n\nOptional setting to enable Independent Head Turn while in menus.\nOptional setting to force menus to always follow player.\nOptional setting to adjust with FOV changes.",
"searchtags": [
"menu",
"scale",
"avatarscale",
"slider"
],
"requirements": [
"None"
],
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r13/MenuScalePatch.dll",
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/MenuScalePatch/",
"changelog": "- Added FOV handling to menu scaling. The menu will scale with changes to your FOV.",
"embedcolor": "363020"
}