Merge remote-tracking branch 'GestureLock/main'

Merged GestureLock
This commit is contained in:
NotAKidoS 2023-04-16 06:52:24 -05:00
commit 274d57ee42
6 changed files with 194 additions and 1 deletions

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>latest</LangVersion>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="MelonLoader">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll</HintPath>
</Reference>
<Reference Include="SteamVR">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\SteamVR.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="Deploy" AfterTargets="Build">
<Copy SourceFiles="$(TargetPath)" DestinationFolder="C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\Mods\" />
<Message Text="Copied $(TargetPath) to C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\Mods\" Importance="high" />
</Target>
</Project>

View file

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.2.32630.192
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GestureLock", "GestureLock.csproj", "{B318B038-DA12-4960-A35E-613BE26B7965}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B318B038-DA12-4960-A35E-613BE26B7965}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B318B038-DA12-4960-A35E-613BE26B7965}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B318B038-DA12-4960-A35E-613BE26B7965}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B318B038-DA12-4960-A35E-613BE26B7965}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0ABE9CFE-D4F5-4B5B-9D1A-5D0B1DA7E2CD}
EndGlobalSection
EndGlobal

70
GestureLock/Main.cs Normal file
View file

@ -0,0 +1,70 @@
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using ABI_RC.Core.UI;
using HarmonyLib;
using MelonLoader;
using Valve.VR;
//I legitimately threw this at ChatGPT to rewrite cause i couldn't be bothered.
namespace NAK.Melons.GestureLock
{
public class GestureLockMod : MelonMod
{
[HarmonyPatch]
private class HarmonyPatches
{
private static bool isLocked;
private static float oldGestureLeft;
private static float oldGestureRight;
[HarmonyPostfix]
[HarmonyPatch(typeof(InputModuleSteamVR), "UpdateInput")]
private static void Postfix_InputModuleSteamVR_UpdateInput
(
ref CVRInputManager ____inputManager,
ref VRTrackerManager ____trackerManager,
ref SteamVR_Action_Boolean ___steamVrIndexGestureToggle
)
{
if (!MetaPort.Instance.isUsingVr)
{
return;
}
if (___steamVrIndexGestureToggle.stateDown && !____trackerManager.trackerNames.Contains("knuckles"))
{
isLocked = !isLocked;
oldGestureLeft = ____inputManager.gestureLeft;
oldGestureRight = ____inputManager.gestureRight;
CohtmlHud.Instance.ViewDropTextImmediate("", "Gesture Lock", "Gestures " + (isLocked ? "Locked" : "Unlocked"));
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CVRInputManager), "Update")]
private static void Postfix_CVRInputManager_Update
(
ref float ___gestureLeft,
ref float ___gestureRight,
ref float ___gestureLeftRaw,
ref float ___gestureRightRaw
)
{
if (!MetaPort.Instance.isUsingVr)
{
return;
}
if (isLocked)
{
// Dont override raw, other systems like the camera gesture recognizer need it.
//gestureLeftRaw = gestureLeft;
//gestureRightRaw = gestureRight;
___gestureLeft = oldGestureLeft;
___gestureRight = oldGestureRight;
}
}
}
}
}

View file

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

23
GestureLock/format.json Normal file
View file

@ -0,0 +1,23 @@
{
"_id": 93,
"name": "GestureLock",
"modversion": "2.0.0",
"gameversion": "2022r170",
"loaderversion": "0.5.7",
"modtype": "Mod",
"author": "NotAKidoS",
"description": "Locks GestureLeft & GestureRight on SteamVR binding.\nDoes nothing on Knuckles controllers.\n\nMake sure to bind Controller Toggle Gestures in SteamVR.",
"searchtags": [
"gesture",
"lock",
"GestureLeft",
"GestureRight"
],
"requirements": [
"None"
],
"downloadlink": "https://github.com/NotAKidOnSteam/GestureLock/releases/download/v2.0.0/GestureLock.dll",
"sourcelink": "https://github.com/NotAKidOnSteam/GestureLock/",
"changelog": "- Simplification & refactor.",
"embedcolor": "804221"
}

View file

@ -125,6 +125,15 @@ Prevents VRIK from autodetecting toes in HalfbodyIK.
Optionally can be applied in FBT, but toes in FBT are nice so you are a monster if so.
![fuckthetoes](https://user-images.githubusercontent.com/37721153/216518012-ae3b1dde-17ea-419a-a875-48d57e13f3dd.png)
# GestureLock
Simple GestureLock for CVR.
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.
![VirtualDesktop Android-20220907-172923](https://user-images.githubusercontent.com/37721153/188999382-7663a863-49be-4b9b-8839-8b6e8c32783b.jpg)
---
@ -135,4 +144,4 @@ https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
> 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.
> To the best of my knowledge, I have adhered to the Modding Guidelines established by Alpha Blend Interactive.