depricated bunch of mods i will never touch or are native now

This commit is contained in:
NotAKidoS 2024-09-06 01:22:37 -05:00
parent 1ed32799a8
commit 7f4237bf95
29 changed files with 0 additions and 0 deletions

View file

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

View file

@ -0,0 +1,236 @@
using ABI_RC.Systems.InputManagement;
using UnityEngine;
namespace NAK.EzCurls;
internal class InputModuleCurlAdjuster : CVRInputModule
{
public static InputModuleCurlAdjuster Instance { get; private set; }
#region Variables
public bool enabled = false;
// Curl clamping/adjustment
public bool UseCurlSnapping = false;
public float SnappedCurlValue = 0.4f;
public float RangeStartPercent = 0.25f;
public float RangeEndPercent = 0.5f;
// Curl smoothing/averaging
public bool UseCurlSmoothing = true;
public bool DontSmoothExtremes = true;
public bool OnlySmoothNearbyCurl = false;
public float CurlSimilarityThreshold = 0.5f;
public float CurlSmoothingFactor = 0.4f;
// Curve control
public bool UseCurveControl = false;
public AnimationCurve DensityCurve = new(new Keyframe(0, 0), new Keyframe(0.5f, 1), new Keyframe(1, 0));
// Tuned Curve control
public bool UseTunedCurveControl = false;
private readonly AnimationCurve TunedDensityCurve = new(
new Keyframe(0, 0), // Start at (0, 0)
new Keyframe(0.5f, 0.5f), // Normal behavior up to (0.3, 0.3)
new Keyframe(0.85f, 0.6f), // Only 0.1f movement from 0.5 to 0.9
new Keyframe(1, 1) // Normal behavior from 0.9 to 1
);
#endregion
#region Overrides
public override void ModuleAdded()
{
if (Instance != null
&& Instance != this)
return;
Instance = this;
base.ModuleAdded();
ModSettings.OnSettingsChanged();
}
public override void UpdateInput()
=> DoCurlAdjustments();
#endregion
private void DoCurlAdjustments()
{
if (!enabled
|| !_inputManager.individualFingerTracking)
return;
DoCurlSmoothing();
DoCurlSnapping();
DoCurlCurveControl();
}
#region Smooth Curls
private void DoCurlSmoothing()
{
if (!UseCurlSmoothing)
return;
if (OnlySmoothNearbyCurl)
{
SmoothCurlsNear(
ref _inputManager.fingerCurlLeftIndex,
ref _inputManager.fingerCurlLeftMiddle,
ref _inputManager.fingerCurlLeftRing,
ref _inputManager.fingerCurlLeftPinky
);
SmoothCurlsNear(
ref _inputManager.fingerCurlRightIndex,
ref _inputManager.fingerCurlRightMiddle,
ref _inputManager.fingerCurlRightRing,
ref _inputManager.fingerCurlRightPinky
);
}
else
{
SmoothCurls(
ref _inputManager.fingerCurlLeftIndex,
ref _inputManager.fingerCurlLeftMiddle,
ref _inputManager.fingerCurlLeftRing,
ref _inputManager.fingerCurlLeftPinky
);
SmoothCurls(
ref _inputManager.fingerCurlRightIndex,
ref _inputManager.fingerCurlRightMiddle,
ref _inputManager.fingerCurlRightRing,
ref _inputManager.fingerCurlRightPinky
);
}
}
private void SmoothCurls(ref float index, ref float middle, ref float ring, ref float pinky)
{
var values = new List<float> { index, middle, ring, pinky };
for (var i = 0; i < values.Count; i++)
for (var j = i + 1; j < values.Count; j++)
if (Math.Abs(values[i] - values[j]) <= CurlSimilarityThreshold)
{
// Compute new smoothed values
var smoothedValue = (values[i] + values[j]) / 2;
// Calculate smoothing factors for both values
var smoothingFactor1 = CalculateSmoothingFactor(values[i]);
var smoothingFactor2 = CalculateSmoothingFactor(values[j]);
// Adjust both values towards the smoothed value
values[i] = values[i] + smoothingFactor1 * CurlSmoothingFactor * (smoothedValue - values[i]);
values[j] = values[j] + smoothingFactor2 * CurlSmoothingFactor * (smoothedValue - values[j]);
}
index = values[0];
middle = values[1];
ring = values[2];
pinky = values[3];
}
private void SmoothCurlsNear(ref float index, ref float middle, ref float ring, ref float pinky)
{
var values = new List<float> { index, middle, ring, pinky };
for (var i = 0; i < values.Count - 1; i++)
if (Math.Abs(values[i] - values[i + 1]) <= CurlSimilarityThreshold)
{
// Compute new smoothed value
var smoothedValue = (values[i] + values[i + 1]) / 2;
// Calculate smoothing factors for both values
var smoothingFactor1 = CalculateSmoothingFactor(values[i]);
var smoothingFactor2 = CalculateSmoothingFactor(values[i + 1]);
// Adjust both values towards the smoothed value
values[i] = values[i] + smoothingFactor1 * CurlSmoothingFactor * (smoothedValue - values[i]);
values[i + 1] = values[i + 1] +
smoothingFactor2 * CurlSmoothingFactor * (smoothedValue - values[i + 1]);
}
index = values[0];
middle = values[1];
ring = values[2];
pinky = values[3];
}
// calculate the smoothing factor based on the curl value
private float CalculateSmoothingFactor(float curlValue)
{
if (!DontSmoothExtremes)
return 1f;
// Compute the distance from the center (0.5) and square it
var dist = curlValue - 0.5f;
return 1.0f - 4 * dist * dist;
}
#endregion
#region Snap Curls
private void DoCurlSnapping()
{
if (!UseCurlSnapping)
return;
SnapCurls(ref _inputManager.fingerCurlLeftIndex);
SnapCurls(ref _inputManager.fingerCurlLeftMiddle);
SnapCurls(ref _inputManager.fingerCurlLeftRing);
SnapCurls(ref _inputManager.fingerCurlLeftPinky);
SnapCurls(ref _inputManager.fingerCurlRightIndex);
SnapCurls(ref _inputManager.fingerCurlRightMiddle);
SnapCurls(ref _inputManager.fingerCurlRightRing);
SnapCurls(ref _inputManager.fingerCurlRightPinky);
}
private void SnapCurls(ref float fingerCurl)
{
if (fingerCurl >= RangeStartPercent && fingerCurl <= RangeEndPercent)
fingerCurl = SnappedCurlValue;
}
#endregion
#region Curve Curls
private void DoCurlCurveControl()
{
if (!UseCurveControl)
return;
AdjustCurlUsingCurve(ref _inputManager.fingerCurlLeftIndex);
AdjustCurlUsingCurve(ref _inputManager.fingerCurlLeftMiddle);
AdjustCurlUsingCurve(ref _inputManager.fingerCurlLeftRing);
AdjustCurlUsingCurve(ref _inputManager.fingerCurlLeftPinky);
AdjustCurlUsingCurve(ref _inputManager.fingerCurlRightIndex);
AdjustCurlUsingCurve(ref _inputManager.fingerCurlRightMiddle);
AdjustCurlUsingCurve(ref _inputManager.fingerCurlRightRing);
AdjustCurlUsingCurve(ref _inputManager.fingerCurlRightPinky);
}
// middle of curve is more "dense"
private void AdjustCurlUsingCurve(ref float fingerCurl)
{
if (UseTunedCurveControl)
{
fingerCurl = TunedDensityCurve.Evaluate(fingerCurl);
return;
}
fingerCurl = DensityCurve.Evaluate(fingerCurl);
}
#endregion
}

View file

@ -0,0 +1,22 @@
using MelonLoader;
using System.Reflection;
using ABI_RC.Systems.InputManagement;
using ABI_RC.Systems.InputManagement.InputModules;
namespace NAK.EzCurls;
public class EzCurls : MelonMod
{
public override void OnInitializeMelon()
{
HarmonyInstance.Patch(
typeof(CVRInputModule_XR).GetMethod(nameof(CVRInputModule_XR.ModuleAdded)),
postfix: new HarmonyLib.HarmonyMethod(typeof(EzCurls).GetMethod(nameof(OnCVRInputModule_XRModuleAdded_Postfix), BindingFlags.NonPublic | BindingFlags.Static))
);
ModSettings.Initialize();
}
private static void OnCVRInputModule_XRModuleAdded_Postfix()
=> CVRInputManager.Instance.AddInputModule(new InputModuleCurlAdjuster());
}

View file

@ -0,0 +1,116 @@
using MelonLoader;
using UnityEngine;
namespace NAK.EzCurls;
public static class ModSettings
{
#region Melon Prefs
private const string SettingsCategory = nameof(EzCurls);
private static readonly MelonPreferences_Category Category =
MelonPreferences.CreateCategory(SettingsCategory);
// Tuned to the values Liquid uses, sign language nerd
private static readonly MelonPreferences_Entry<bool> EntryEnabled =
Category.CreateEntry("Enabled", true,
description: "Enable EzCurls.");
private static readonly MelonPreferences_Entry<bool> EntryUseCurlSnapping =
Category.CreateEntry("UseCurlSnapping", true,
description: "Finger curl snapping to a specified value when in the specified range.");
private static readonly MelonPreferences_Entry<float> EntrySnappedCurlValue =
Category.CreateEntry("SnappedCurlValue", 0.4f,
description: "The value to which the finger curl snaps within the range.");
private static readonly MelonPreferences_Entry<float> EntryRangeStartPercent =
Category.CreateEntry("RangeStartPercent", 0.25f,
description: "The minimum value for the SnappedCurlValue range.");
private static readonly MelonPreferences_Entry<float> EntryRangeEndPercent =
Category.CreateEntry("RangeEndPercent", 0.5f,
description: "The maximum value for the SnappedCurlValue range.");
private static readonly MelonPreferences_Entry<bool> EntryUseCurlSmoothing =
Category.CreateEntry("UseCurlSmoothing", true,
description: "Finger curl smoothing to average out similar finger positions.");
private static readonly MelonPreferences_Entry<bool> EntryOnlySmoothNearbyCurl =
Category.CreateEntry("OnlySmoothNearbyCurl", false,
description: "Should the curl smoothing only influence the nearest curl?");
private static readonly MelonPreferences_Entry<bool> EntryDontSmoothExtremes =
Category.CreateEntry("DontSmoothExtremes", true,
description: "Should the finger curl smoothing be less effective on curls towards 0 or 1?");
private static readonly MelonPreferences_Entry<float> EntryCurlSimilarityThreshold =
Category.CreateEntry("CurlSimilarityThreshold", 0.5f,
description: "The threshold for curl similarity during curl smoothing.");
private static readonly MelonPreferences_Entry<float> EntryCurlSmoothingFactor =
Category.CreateEntry("CurlSmoothingFactor", 0.4f,
description: "The multiplier for curl smoothing.");
// Curve control settings
private static readonly MelonPreferences_Entry<bool> EntryUseCurveControl =
Category.CreateEntry("UseCurveControl", true,
description: "Enable curve control mode to make the midrange of the curl more dense.");
private static readonly MelonPreferences_Entry<bool> EntryUseTunedCurveControl =
Category.CreateEntry("UseTunedCurveControl", true,
description: "Enables a pre-tuned curve.");
private static readonly MelonPreferences_Entry<float> EntryCurveMin =
Category.CreateEntry("CurveMin", 0.0f,
description: "The minimum value of the density curve.");
private static readonly MelonPreferences_Entry<float> EntryCurveMiddle =
Category.CreateEntry("CurveMiddle", 0.5f,
description: "The middle value of the density curve.");
private static readonly MelonPreferences_Entry<float> EntryCurveMax =
Category.CreateEntry("CurveMax", 1.0f,
description: "The maximum value of the density curve.");
#endregion
internal static void Initialize()
{
foreach (MelonPreferences_Entry setting in Category.Entries)
setting.OnEntryValueChangedUntyped.Subscribe(OnSettingsChanged);
}
internal static void OnSettingsChanged(object oldValue = null, object newValue = null)
{
if (InputModuleCurlAdjuster.Instance == null)
return;
// enabled
InputModuleCurlAdjuster.Instance.enabled = EntryEnabled.Value;
// curl snapping
InputModuleCurlAdjuster.Instance.UseCurlSnapping = EntryUseCurlSnapping.Value;
InputModuleCurlAdjuster.Instance.SnappedCurlValue = EntrySnappedCurlValue.Value;
InputModuleCurlAdjuster.Instance.RangeStartPercent = EntryRangeStartPercent.Value;
InputModuleCurlAdjuster.Instance.RangeEndPercent = EntryRangeEndPercent.Value;
// curl smoothing
InputModuleCurlAdjuster.Instance.UseCurlSmoothing = EntryUseCurlSmoothing.Value;
InputModuleCurlAdjuster.Instance.OnlySmoothNearbyCurl = EntryOnlySmoothNearbyCurl.Value;
InputModuleCurlAdjuster.Instance.DontSmoothExtremes = EntryDontSmoothExtremes.Value;
InputModuleCurlAdjuster.Instance.CurlSimilarityThreshold = EntryCurlSimilarityThreshold.Value;
InputModuleCurlAdjuster.Instance.CurlSmoothingFactor = EntryCurlSmoothingFactor.Value;
// curve control
InputModuleCurlAdjuster.Instance.UseCurveControl = EntryUseCurveControl.Value;
InputModuleCurlAdjuster.Instance.UseTunedCurveControl = EntryUseTunedCurveControl.Value;
InputModuleCurlAdjuster.Instance.DensityCurve = new AnimationCurve(
new Keyframe(0, EntryCurveMin.Value),
new Keyframe(0.5f, EntryCurveMiddle.Value),
new Keyframe(1, EntryCurveMax.Value)
);
}
}

View file

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

View file

@ -0,0 +1,16 @@
# EzCurls
A mod that allows you to tune your finger curls to your liking. Supposedly can help with VR sign language, as raw finger curls are not that great for quick and precise gestures.
The settings are not too coherent, it is mostly a bunch of things thrown at the wall, but it works for me. I hope it works for you too.
---
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": -1,
"name": "EzCurls",
"modversion": "1.0.0",
"gameversion": "2023r173",
"loaderversion": "0.6.1",
"modtype": "Mod",
"author": "NotAKidoS",
"description": "A mod that allows you to tune your finger curls to your liking. Supposedly can help with VR sign language, as raw finger curls are not that great for quick and precise gestures.\n\nThe settings are not too coherent, it is mostly a bunch of things thrown at the wall, but it works for me. I hope it works for you too.",
"searchtags": [
"curls",
"fingers",
"index",
"knuckles"
],
"requirements": [
"UIExpansionKit"
],
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r24/EzCurls.dll",
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/EzCurls/",
"changelog": "- Initial CVRMG release",
"embedcolor": "7d7d7d"
}

View file

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

View file

@ -0,0 +1,23 @@
using System.Reflection;
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using HarmonyLib;
using MelonLoader;
namespace NAK.HeadLookLockingInputFix;
public class HeadLookLockingInputFixMod : MelonMod
{
public override void OnInitializeMelon()
{
HarmonyInstance.Patch(
typeof(InputManager).GetMethod(nameof(InputManager.HandleMenuHeadLook),
BindingFlags.NonPublic | BindingFlags.Instance),
prefix: new HarmonyMethod(typeof(HeadLookLockingInputFixMod).GetMethod(nameof(OnPreHandleMenuHeadLook),
BindingFlags.NonPublic | BindingFlags.Static))
);
}
private static bool OnPreHandleMenuHeadLook()
=> !MetaPort.Instance.isUsingVr; // only execute in Desktop
}

View file

@ -0,0 +1,32 @@
using MelonLoader;
using NAK.HeadLookLockingInputFix.Properties;
using System.Reflection;
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyTitle(nameof(NAK.HeadLookLockingInputFix))]
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
[assembly: AssemblyProduct(nameof(NAK.HeadLookLockingInputFix))]
[assembly: MelonInfo(
typeof(NAK.HeadLookLockingInputFix.HeadLookLockingInputFixMod),
nameof(NAK.HeadLookLockingInputFix),
AssemblyInfoParams.Version,
AssemblyInfoParams.Author,
downloadLink: "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/HeadLookLockingInputFix"
)]
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
[assembly: MelonColor(255, 246, 25, 99)] // red-pink
[assembly: MelonAuthorColor(255, 158, 21, 32)] // red
[assembly: HarmonyDontPatchAll]
namespace NAK.HeadLookLockingInputFix.Properties;
internal static class AssemblyInfoParams
{
public const string Version = "1.0.0";
public const string Author = "NotAKidoS";
}

View file

@ -0,0 +1,14 @@
# HeadLookLockingInputFix
Fixes a bug where pressing the independent head look key (ALT) while in VR with the game window focused and a menu open would disable input and soft-lock you.
---
Here is the block of text where I tell you this mod is not affiliated with or endorsed by ABI.
https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
> This mod is an independent creation 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,24 @@
{
"_id": 224,
"name": "HeadLookLockingInputFix",
"modversion": "1.0.0",
"gameversion": "2024r175",
"loaderversion": "0.6.1",
"modtype": "Mod",
"author": "NotAKidoS",
"description": "Fixes a bug where pressing the independent head look key (ALT) while in VR with the game window focused and a menu open would disable input and soft-lock you.",
"searchtags": [
"input",
"locked",
"vr",
"fix",
"meow"
],
"requirements": [
"None"
],
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r34/HeadLookLockingInputFix.dll",
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/HeadLookLockingInputFix/",
"changelog": "- Initial release",
"embedcolor": "#f61963"
}

View file

@ -0,0 +1,34 @@
using ABI_RC.Core.InteractionSystem;
using ABI_RC.Systems.IK;
using ABI_RC.Systems.IK.SubSystems;
using HarmonyLib;
using NAK.IKAdjustments.Systems;
namespace NAK.IKAdjustments.HarmonyPatches;
internal static class IKSystemPatches
{
[HarmonyPostfix]
[HarmonyPatch(typeof(IKSystem), nameof(IKSystem.Start))]
private static void Postfix_IKSystem_Start(ref IKSystem __instance)
{
__instance.gameObject.AddComponent<IKAdjuster>();
}
[HarmonyPostfix]
[HarmonyPatch(typeof(BodySystem), nameof(BodySystem.ResetCalibration))]
private static void Postfix_IKSystem_ResetIkSettings()
{
IKAdjuster.Instance.ResetAllOffsets();
}
}
internal static class CVR_MenuManagerPatches
{
[HarmonyPostfix]
[HarmonyPatch(typeof(CVR_MenuManager), nameof(CVR_MenuManager.ToggleQuickMenu), typeof(bool))]
private static void Postfix_CVR_MenuManager_ToggleQuickMenu(bool show)
{
if (show) IKAdjuster.Instance.ExitAdjustMode();
}
}

View file

@ -0,0 +1,204 @@
using ABI_RC.Core.InteractionSystem;
using ABI_RC.Systems.IK;
using ABI_RC.Systems.IK.SubSystems;
using ABI_RC.Systems.InputManagement;
using UnityEngine;
namespace NAK.IKAdjustments.Systems;
public class IKAdjuster : MonoBehaviour
{
#region Grab Definitions
public class GrabState
{
public bool handGrabbed;
public TrackingPoint tracker;
public Vector3 displayOffset;
public Quaternion displayOffsetRotation;
public GrabState otherGrab;
}
public enum AdjustMode
{
Position = 0,
Rotation,
Both
}
#endregion
public static IKAdjuster Instance;
public bool isAdjustMode;
public float Setting_MaxGrabDistance = 0.2f;
public AdjustMode Setting_AdjustMode = AdjustMode.Position;
private GrabState leftGrabState = new();
private GrabState rightGrabState = new();
#region Unity Events
private void Start()
{
Instance = this;
leftGrabState.otherGrab = rightGrabState;
rightGrabState.otherGrab = leftGrabState;
}
private void Update()
{
if (!isAdjustMode) return;
if (BodySystem.isCalibrating)
{
isAdjustMode = false;
return;
}
UpdateGrabbing(true, ref leftGrabState);
UpdateGrabbing(false, ref rightGrabState);
}
#endregion
#region Public Methods
public void EnterAdjustMode()
{
if (isAdjustMode)
return;
isAdjustMode = true;
IKSystem.Instance.TrackingSystem.SetTrackingPointVisibility(true);
CVR_MenuManager.Instance.ToggleQuickMenu(false);
foreach (TrackingPoint tracker in IKSystem.Instance.TrackingSystem.AllTrackingPoints) tracker.ClearLineTarget();
}
public void ExitAdjustMode()
{
if (!isAdjustMode)
return;
isAdjustMode = false;
IKSystem.Instance.TrackingSystem.SetTrackingPointVisibility(false);
}
public void ResetAllOffsets()
{
foreach (TrackingPoint tracker in IKSystem.Instance.TrackingSystem.AllTrackingPoints)
{
tracker.offsetTransform.SetParent(tracker.displayObject.transform, true);
tracker.displayObject.transform.localPosition = Vector3.zero;
tracker.displayObject.transform.localRotation = Quaternion.identity;
tracker.offsetTransform.SetParent(tracker.referenceTransform, true);
}
}
public void CycleAdjustMode()
{
var currentValue = (int)Setting_AdjustMode;
var numValues = Enum.GetValues(typeof(AdjustMode)).Length;
var nextValue = (currentValue + 1) % numValues;
Setting_AdjustMode = (AdjustMode)nextValue;
}
#endregion
#region Private Methods
private void UpdateGrabbing(bool isLeft, ref GrabState grabState)
{
var isGrabbing = isLeft
? CVRInputManager.Instance.gripLeftValue > 0.9f
: CVRInputManager.Instance.gripRightValue > 0.9f;
var isInteracting = isLeft
? CVRInputManager.Instance.interactLeftValue > 0.9f
: CVRInputManager.Instance.interactRightValue > 0.9f;
Transform handTracker = isLeft
? IKSystem.Instance.leftController.transform
: IKSystem.Instance.rightController.transform;
if (grabState.tracker == null && !grabState.handGrabbed && isGrabbing)
{
OnGrab(handTracker, grabState);
}
else if (grabState.tracker != null)
{
if (!isGrabbing)
OnRelease(grabState);
else if (isInteracting)
OnReset(grabState);
else
Holding(handTracker, grabState);
}
grabState.handGrabbed = isGrabbing;
}
private void OnGrab(Transform handTracker, GrabState grabState)
{
Transform nearestTransform = FindNearestTransform(handTracker);
if (nearestTransform != null &&
Vector3.Distance(nearestTransform.GetChild(0).position, handTracker.position) <=
Setting_MaxGrabDistance)
{
grabState.tracker =
IKSystem.Instance.TrackingSystem.AllTrackingPoints.Find(tp => tp.referenceTransform == nearestTransform);
if (grabState.otherGrab.tracker == grabState.tracker) OnRelease(grabState.otherGrab);
grabState.displayOffset = grabState.tracker.displayObject.transform.position - handTracker.position;
grabState.displayOffsetRotation = Quaternion.Inverse(handTracker.rotation) *
grabState.tracker.displayObject.transform.rotation;
grabState.tracker.offsetTransform.SetParent(grabState.tracker.displayObject.transform, true);
}
}
private void OnRelease(GrabState grabState)
{
grabState.tracker.offsetTransform.SetParent(grabState.tracker.referenceTransform, true);
grabState.tracker.ClearLineTarget();
grabState.tracker = null;
}
private void OnReset(GrabState grabState)
{
grabState.tracker.displayObject.transform.localRotation = Quaternion.identity;
grabState.tracker.displayObject.transform.localPosition = Vector3.zero;
grabState.tracker.offsetTransform.SetParent(grabState.tracker.referenceTransform, true);
grabState.tracker.ClearLineTarget();
grabState.tracker = null;
}
private void Holding(Transform handTracker, GrabState grabState)
{
switch (Setting_AdjustMode)
{
case AdjustMode.Position:
grabState.tracker.displayObject.transform.position = handTracker.position + grabState.displayOffset;
break;
case AdjustMode.Rotation:
grabState.tracker.displayObject.transform.rotation =
handTracker.rotation * grabState.displayOffsetRotation;
break;
case AdjustMode.Both:
grabState.tracker.displayObject.transform.rotation =
handTracker.rotation * grabState.displayOffsetRotation;
grabState.tracker.displayObject.transform.position = handTracker.position + grabState.displayOffset;
break;
}
grabState.tracker.SetLineTarget(grabState.tracker.referenceTransform.position);
}
private Transform FindNearestTransform(Transform handTransform)
{
var validTrackingPointTransforms = TrackingSystem.ValidTrackingPointTransforms;
if (validTrackingPointTransforms == null || validTrackingPointTransforms.Count == 0) return null;
return validTrackingPointTransforms
.OrderBy(t => Vector3.Distance(handTransform.position, t.GetChild(0).position)).FirstOrDefault();
}
#endregion
}

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<NoWarn />
</PropertyGroup>
<ItemGroup>
<Reference Include="BTKUILib">
<HintPath>$(MsBuildThisFileDirectory)\..\.ManagedLibs\BTKUILib.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
</Project>

View file

@ -0,0 +1,31 @@
using System.Runtime.CompilerServices;
using BTKUILib;
using BTKUILib.UIObjects;
using MelonLoader;
using NAK.IKAdjustments.Systems;
namespace NAK.IKAdjustments.Integrations;
public static class BTKUIAddon
{
[MethodImpl(MethodImplOptions.NoInlining)]
public static void Initialize()
{
//Add myself to the Misc Menu
Page miscPage = QuickMenuAPI.MiscTabPage;
Category miscCategory = miscPage.AddCategory(IKAdjustments.SettingsCategory);
// Add button
miscCategory.AddButton("Tracking Adjust", "",
"Adjust tracking points in this mode. Grip to adjust. Trigger to reset.")
.OnPress += () => { IKAdjuster.Instance.EnterAdjustMode(); };
// Reset Button
miscCategory.AddButton("Reset Offsets", "", "Reset all tracked point offsets.")
.OnPress += () => { IKAdjuster.Instance.ResetAllOffsets(); };
// Cycle GrabMode Button
miscCategory.AddButton("Cycle Mode", "", "Cycle grab mode. Position, Rotation, or Both.")
.OnPress += () => { IKAdjuster.Instance.CycleAdjustMode(); };
}
}

View file

@ -0,0 +1,39 @@
using MelonLoader;
using NAK.IKAdjustments.HarmonyPatches;
using NAK.IKAdjustments.Integrations;
namespace NAK.IKAdjustments;
public class IKAdjustments : MelonMod
{
internal static string SettingsCategory = nameof(IKAdjustments);
public override void OnInitializeMelon()
{
ApplyPatches(typeof(IKSystemPatches));
InitializeIntegration("BTKUILib", BTKUIAddon.Initialize);
}
private void InitializeIntegration(string modName, Action integrationAction)
{
if (RegisteredMelons.All(it => it.Info.Name != modName))
return;
LoggerInstance.Msg($"Initializing {modName} integration.");
integrationAction.Invoke();
}
private void ApplyPatches(Type type)
{
try
{
HarmonyInstance.PatchAll(type);
}
catch (Exception e)
{
LoggerInstance.Msg($"Failed while patching {type.Name}!");
LoggerInstance.Error(e);
}
}
}

View file

@ -0,0 +1,33 @@
using MelonLoader;
using NAK.IKAdjustments.Properties;
using System.Reflection;
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyTitle(nameof(NAK.IKAdjustments))]
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
[assembly: AssemblyProduct(nameof(NAK.IKAdjustments))]
[assembly: MelonInfo(
typeof(NAK.IKAdjustments.IKAdjustments),
nameof(NAK.IKAdjustments),
AssemblyInfoParams.Version,
AssemblyInfoParams.Author,
downloadLink: "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/IKAdjustments"
)]
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
[assembly: MelonOptionalDependencies("BTKUILib")]
[assembly: MelonColor(255, 155, 89, 182)]
[assembly: MelonAuthorColor(255, 158, 21, 32)]
[assembly: HarmonyDontPatchAll]
namespace NAK.IKAdjustments.Properties;
internal static class AssemblyInfoParams
{
public const string Version = "1.0.0";
public const string Author = "NotAKidoS";
}

View file

@ -0,0 +1,106 @@
using System.Reflection;
using ABI_RC.Core.InteractionSystem;
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using ABI_RC.Systems.GameEventSystem;
using ABI_RC.Systems.VRModeSwitch;
using MelonLoader;
using UnityEngine;
namespace NAK.MoreMenuOptions;
public class MoreMenuOptions : MelonMod
{
// very lazy mod lol
public override void OnInitializeMelon()
{
// Main Menu Scale & Distance Modifier Settings
ModSettings.EntryMainMenuModiferUsage.OnEntryValueChanged.Subscribe(OnMMUsageTypeChanged);
ModSettings.EntryMMScaleModifier.OnEntryValueChanged.Subscribe(OnMMFloatModifierChanged);
ModSettings.EntryMMDistanceModifier.OnEntryValueChanged.Subscribe(OnMMFloatModifierChanged);
// Quick Menu World Anchor In VR Setting
ModSettings.EntryQMWorldAnchorInVR.OnEntryValueChanged.Subscribe(OnQMWorldAnchorInVRChanged);
// Game Event Subscriptions
CVRGameEventSystem.World.OnLoad.AddListener(OnGameStart);
VRModeSwitchEvents.OnPostVRModeSwitch.AddListener(OnVRModeSwitched);
}
#region Game Events
private void OnGameStart(string _)
{
UpdateMenuSettings();
CVRGameEventSystem.World.OnLoad.RemoveListener(OnGameStart); // only need to run once
}
private void OnVRModeSwitched(bool switchToVr)
=> UpdateMenuSettings();
private void UpdateMenuSettings()
{
UpdateMainMenuModifierSettings();
UpdateQuickMenuModifierSettings();
}
#endregion Game Events
#region Main Menu Scale & Distance Modifier Settings
internal enum MainMenuModifierUsage
{
None,
Desktop,
VR,
Both
}
private void OnMMUsageTypeChanged(MainMenuModifierUsage _, MainMenuModifierUsage __)
=> UpdateMainMenuModifierSettings();
private void OnMMFloatModifierChanged(float _, float __)
=> UpdateMainMenuModifierSettings();
private void UpdateMainMenuModifierSettings()
{
if (CVRMainMenuPositionHelper.Instance == null)
return;
MainMenuModifierUsage usage = ModSettings.EntryMainMenuModiferUsage.Value;
bool isVrActive = MetaPort.Instance.isUsingVr;
bool applyVrModifier = (isVrActive && usage is MainMenuModifierUsage.VR or MainMenuModifierUsage.Both);
bool applyDesktopModifier = (!isVrActive && usage is MainMenuModifierUsage.Desktop or MainMenuModifierUsage.Both);
if (applyVrModifier || applyDesktopModifier)
{
CVRMainMenuPositionHelper.Instance.menuTransform.localPosition = new Vector3(0f, 0f, ModSettings.EntryMMDistanceModifier.Value);
CVRMainMenuPositionHelper.Instance.menuTransform.parent.localScale = Vector3.one * ModSettings.EntryMMScaleModifier.Value;
}
else // None or invalid usage
{
CVRMainMenuPositionHelper.Instance.menuTransform.localPosition = Vector3.zero;
CVRMainMenuPositionHelper.Instance.menuTransform.parent.localScale = Vector3.one;
}
}
#endregion Main Menu Scale & Distance Modifier Settings
#region Quick Menu World Anchor In VR Setting
private void OnQMWorldAnchorInVRChanged(bool _, bool __)
=> UpdateQuickMenuModifierSettings();
private void UpdateQuickMenuModifierSettings()
{
if (CVRQuickMenuPositionHelper.Instance == null)
return;
CVRQuickMenuPositionHelper.Instance.worldAnchorMenu =
ModSettings.EntryQMWorldAnchorInVR.Value && MetaPort.Instance.isUsingVr;
}
#endregion Quick Menu World Anchor In VR Setting
}

View file

@ -0,0 +1,27 @@
using MelonLoader;
namespace NAK.MoreMenuOptions;
public static class ModSettings
{
private const string SettingsCategory = nameof(MoreMenuOptions);
private static readonly MelonPreferences_Category Category =
MelonPreferences.CreateCategory(SettingsCategory);
// main menu options
internal static readonly MelonPreferences_Entry<MoreMenuOptions.MainMenuModifierUsage> EntryMainMenuModiferUsage =
Category.CreateEntry("Main Menu Modifier Usage", MoreMenuOptions.MainMenuModifierUsage.Both, description: "The usage of the main menu modifier.");
internal static readonly MelonPreferences_Entry<float> EntryMMScaleModifier =
Category.CreateEntry("Main Menu Scale Modifier", 0.75f, description: "The scale of the main menu.");
internal static readonly MelonPreferences_Entry<float> EntryMMDistanceModifier =
Category.CreateEntry("Main Menu Distance Modifier", 0.1f, description: "The distance of the main menu from the camera.");
// quick menu options
internal static readonly MelonPreferences_Entry<bool> EntryQMWorldAnchorInVR =
Category.CreateEntry("Quick Menu World Anchor In VR", false, description: "Toggle the quick menu world anchor in VR.");
}

View file

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

View file

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

View file

@ -0,0 +1,21 @@
# MoreMenuOptions
Exposes some menu options:
- Main Menu Scale Modifier
- Main Menu Distance Modifier
- Quick Menu World Anchor in VR
By default, the menu is adjusted to a more comfortable scale for VR only, but can be configured in the mod settings.
The mod is very slapped together and messy lol.
---
Here is the block of text where I tell you this mod is not affiliated with or endorsed by ABI.
https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
> This mod is an independent creation 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": -1,
"name": "MoreMenuOptions",
"modversion": "1.0.0",
"gameversion": "2024r175",
"loaderversion": "0.6.1",
"modtype": "Mod",
"author": "NotAKidoS",
"description": "Exposes some menu options:\n- Main Menu Scale Modifier\n- Main Menu Distance Modifier\n- Quick Menu World Anchor in VR\n\nBy default, the menu is adjusted to a more comfortable scale, but can be configured in the mod settings.",
"searchtags": [
"menu",
"scale",
"distance",
"anchor"
],
"requirements": [
"None"
],
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r26/MoreMenuOptions.dll",
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/MoreMenuOptions/",
"changelog": "- Initial Release",
"embedcolor": "#89b7d9"
}

View file

@ -0,0 +1,58 @@
using System.Reflection;
using ABI_RC.Systems.VRModeSwitch;
using HarmonyLib;
using MelonLoader;
using Valve.VR;
namespace NAK.SwitchToDesktopOnSteamVRExit;
public class SwitchToDesktopOnSteamVRExit : MelonMod
{
private const string SettingsCategory = nameof(SwitchToDesktopOnSteamVRExit);
private static readonly MelonPreferences_Category Category =
MelonPreferences.CreateCategory(SettingsCategory);
private static readonly MelonPreferences_Entry<bool> EntryEnabled =
Category.CreateEntry("Enabled", true, description: "Toggle SwitchToDesktopOnSteamVRExit entirely.");
public override void OnInitializeMelon()
{
ApplyPatches(typeof(SteamVRBehaviour_Patches));
}
private void ApplyPatches(Type type)
{
try
{
HarmonyInstance.PatchAll(type);
}
catch (Exception e)
{
LoggerInstance.Msg($"Failed while patching {type.Name}!");
LoggerInstance.Error(e);
}
}
#region Patches
private static class SteamVRBehaviour_Patches
{
[HarmonyPrefix]
[HarmonyPatch(typeof(SteamVR_Behaviour), /*nameof(SteamVR_Behaviour.OnQuit)*/ "OnQuit")]
private static bool Prefix_SteamVR_Behaviour_OnQuit()
{
if (!EntryEnabled.Value)
return true;
// If we don't switch fast enough, SteamVR will force close.
// World Transition might cause issues. Might need to override.
if (VRModeSwitchManager.Instance != null)
VRModeSwitchManager.Instance.AttemptSwitch();
return false;
}
}
#endregion Patches
}

View file

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

View file

@ -0,0 +1,17 @@
# SwitchToDesktopOnSteamVRExit
Simple mod that initiates a VR Switch to Desktop when SteamVR is exited. By default, this is enabled, but can be disabled in the mod settings.
Same behaviour the original DesktopVRSwitch mod provided before the VR Switch functionality became native.
---
Here is the block of text where I tell you this mod is not affiliated with or endorsed by ABI.
https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
> This mod is an independent creation 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,2 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk"/>

View file

@ -0,0 +1,23 @@
{
"_id": 202,
"name": "SwitchToDesktopOnSteamVRExit",
"modversion": "1.0.0",
"gameversion": "2024r175",
"loaderversion": "0.6.1",
"modtype": "Mod",
"author": "NotAKidoS",
"description": "Simple mod that initiates a VR Switch to Desktop when SteamVR is exited. By default, this is enabled, but can be disabled in the mod settings.",
"searchtags": [
"steamvr",
"vrswitch",
"desktopvrswitch",
"exit"
],
"requirements": [
"None"
],
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r26/SwitchToDesktopOnSteamVRExit.dll",
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/SwitchToDesktopOnSteamVRExit/",
"changelog": "- Initial Release",
"embedcolor": "#3498db"
}