diff --git a/GestureLock/GestureLock.csproj b/GestureLock/GestureLock.csproj
index ae47bce..b987c6c 100644
--- a/GestureLock/GestureLock.csproj
+++ b/GestureLock/GestureLock.csproj
@@ -19,10 +19,7 @@
C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll
- ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\SteamVR.dll
-
-
- ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\Mods\UIExpansionKit.dll
+ C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\SteamVR.dll
C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll
diff --git a/GestureLock/Main.cs b/GestureLock/Main.cs
index ffc7af4..61842ea 100644
--- a/GestureLock/Main.cs
+++ b/GestureLock/Main.cs
@@ -1,115 +1,36 @@
-using ABI_RC.Core.UI;
+using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
+using ABI_RC.Core.UI;
using HarmonyLib;
using MelonLoader;
-using UnityEngine;
using Valve.VR;
namespace GestureLock;
public class GestureLock : MelonMod
{
- private static MelonPreferences_Category m_catagoryGestureLock;
- private static MelonPreferences_Entry m_entryGestureLock;
- private static MelonPreferences_Entry m_entryGestureBind;
- private static MelonPreferences_Entry m_entryGestureHand;
-
- private enum BindHand
- {
- LeftHand,
- RightHand
- }
- private enum BindingOptions
- {
- ButtonATouch,
- ButtonBTouch,
- StickTouch,
- TriggerTouch
- }
-
- public override void OnApplicationStart()
- {
- m_catagoryGestureLock = MelonPreferences.CreateCategory(nameof(GestureLock));
- m_entryGestureLock = m_catagoryGestureLock.CreateEntry("Enabled", true, description: "Double-touch VR binding.");
- m_entryGestureHand = m_catagoryGestureLock.CreateEntry("VR Hand", BindHand.LeftHand);
- m_entryGestureBind = m_catagoryGestureLock.CreateEntry("VR Binding", BindingOptions.StickTouch);
-
- m_catagoryGestureLock.SaveToFile(false);
- m_entryGestureLock.OnValueChangedUntyped += UpdateSettings;
- m_entryGestureHand.OnValueChangedUntyped += UpdateSettings;
- m_entryGestureBind.OnValueChangedUntyped += UpdateSettings;
-
- UpdateSettings();
- }
- private static void UpdateSettings()
- {
- HarmonyPatches.enabled = m_entryGestureLock.Value;
- HarmonyPatches.bind = m_entryGestureBind.Value;
- HarmonyPatches.hand = (SteamVR_Input_Sources)m_entryGestureHand.Value+1;
- }
-
[HarmonyPatch]
private class HarmonyPatches
{
- public static bool enabled = m_entryGestureLock.Value;
- public static BindingOptions bind = m_entryGestureBind.Value;
- public static SteamVR_Input_Sources hand = SteamVR_Input_Sources.LeftHand;
-
private static bool isLocked = false;
+ private static bool toggleLock = false;
private static float oldGestureLeft = 0;
private static float oldGestureRight = 0;
- private static bool toggleLock = false;
- private static float touchDoubleTimer = 0f;
- private static bool touchArmed = false;
-
- private static void CheckTouch(bool input)
- {
- if (input)
- {
- if (touchArmed && touchDoubleTimer < 0.25f)
- {
- touchArmed = false;
- toggleLock = true;
- touchDoubleTimer = 1f;
- }
- else
- {
- touchDoubleTimer = 0f;
- }
- touchArmed = false;
- }
- else
- {
- touchArmed = true;
- }
- }
-
//Read VR Buttons
[HarmonyPostfix]
[HarmonyPatch(typeof(InputModuleSteamVR), "UpdateInput")]
- private static void AfterUpdateInput(ref SteamVR_Action_Boolean ___steamVrButtonATouch, ref SteamVR_Action_Boolean ___steamVrButtonBTouch, ref SteamVR_Action_Boolean ___steamVrStickTouch, ref SteamVR_Action_Boolean ___steamVrTriggerTouch)
+ private static void AfterUpdateInput(ref SteamVR_Action_Boolean ___steamVrIndexGestureToggle, ref VRTrackerManager ____trackerManager)
{
- if (!MetaPort.Instance.isUsingVr || !enabled) return;
+ if (!MetaPort.Instance.isUsingVr) return;
- touchDoubleTimer += Time.deltaTime;
toggleLock = false;
-
- switch (bind)
+ if (___steamVrIndexGestureToggle.stateDown)
{
- case BindingOptions.ButtonATouch:
- CheckTouch(___steamVrButtonATouch.GetState(hand));
- return;
- case BindingOptions.ButtonBTouch:
- CheckTouch(___steamVrButtonBTouch.GetState(hand));
- return;
- case BindingOptions.StickTouch:
- CheckTouch(___steamVrStickTouch.GetState(hand));
- return;
- case BindingOptions.TriggerTouch:
- CheckTouch(___steamVrTriggerTouch.GetState(hand));
- return;
- default: break;
+ if (!____trackerManager.trackerNames.Contains("knuckles"))
+ {
+ toggleLock = true;
+ }
}
}
@@ -118,7 +39,7 @@ public class GestureLock : MelonMod
[HarmonyPatch(typeof(CVRInputManager), "Update")]
private static void AfterUpdate(ref float ___gestureLeftRaw, ref float ___gestureLeft, ref float ___gestureRightRaw, ref float ___gestureRight)
{
- if (!MetaPort.Instance.isUsingVr || !enabled) return;
+ if (!MetaPort.Instance.isUsingVr) return;
if (toggleLock)
{
diff --git a/GestureLock/Properties/AssemblyInfo.cs b/GestureLock/Properties/AssemblyInfo.cs
index 94de873..83a8d04 100644
--- a/GestureLock/Properties/AssemblyInfo.cs
+++ b/GestureLock/Properties/AssemblyInfo.cs
@@ -1,5 +1,5 @@
-using MelonLoader;
-using GestureLock.Properties;
+using GestureLock.Properties;
+using MelonLoader;
using System.Reflection;
@@ -15,7 +15,7 @@ using System.Reflection;
nameof(GestureLock),
AssemblyInfoParams.Version,
AssemblyInfoParams.Author,
- downloadLink: ""
+ downloadLink: "https://github.com/NotAKidOnSteam/GestureLock"
)]
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
@@ -25,6 +25,6 @@ using System.Reflection;
namespace GestureLock.Properties;
internal static class AssemblyInfoParams
{
- public const string Version = "1.0.0";
+ public const string Version = "1.1.0";
public const string Author = "NotAKidoS";
}
\ No newline at end of file
diff --git a/GestureLock/format.json b/GestureLock/format.json
new file mode 100644
index 0000000..ddc986a
--- /dev/null
+++ b/GestureLock/format.json
@@ -0,0 +1,23 @@
+{
+ "_id": 93,
+ "name": "GestureLock",
+ "modversion": "1.1.0",
+ "gameversion": "2022r168",
+ "loaderversion": "0.5.4",
+ "modtype": "Mod",
+ "author": "NotAKidoS",
+ "description": "Locks GestureLeft & GestureRight on SteamVR binding.",
+ "searchtags": [
+ "gesture",
+ "lock",
+ "GestureLeft",
+ "GestureRight"
+ ],
+ "requirements": [
+ "None"
+ ],
+ "downloadlink": "https://github.com/NotAKidOnSteam/GestureLock/releases/download/r1/GestureLock.dll",
+ "sourcelink": "https://github.com/NotAKidOnSteam/GestureLock/",
+ "changelog": "Use SteamVR Index Gesture Lock binding instead of touch input.",
+ "embedcolor": "804221"
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 4aef126..713e11b 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,9 @@
# GestureLock
Simple GestureLock for CVR.
-Double-touch the selected binding for the selected hand to toggle.
+Uses ChilloutVR's "Controller Toggle Gestures" binding in SteamVR to lock GestureLeft & GestureRight input.
+
+Does nothing on Knuckles controllers as the bind is used for finger tracking.
---