From 1e69e7684bd7c771b099f2a524ed858026ead6f4 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Wed, 7 Sep 2022 05:32:46 -0500 Subject: [PATCH 01/10] Initial commit --- .gitattributes | 2 + .gitignore | 398 +++++++++++++++++++++++++++++++++++++++++++++++++ LICENSE | 21 +++ README.md | 2 + 4 files changed, 423 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..426d76d --- /dev/null +++ b/.gitignore @@ -0,0 +1,398 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..262b1ec --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 NotAKidoS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..9e68130 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# GestureLock + Simple GestureLock for CVR. From 6f1de836b1a7769b7bd9bb6cb2fb8f2d6a7cd736 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Wed, 7 Sep 2022 05:35:22 -0500 Subject: [PATCH 02/10] Initial Upload works ig --- GestureLock/GestureLock.csproj | 40 +++++++ GestureLock/GestureLock.sln | 25 +++++ GestureLock/Main.cs | 140 +++++++++++++++++++++++++ GestureLock/Properties/AssemblyInfo.cs | 30 ++++++ 4 files changed, 235 insertions(+) create mode 100644 GestureLock/GestureLock.csproj create mode 100644 GestureLock/GestureLock.sln create mode 100644 GestureLock/Main.cs create mode 100644 GestureLock/Properties/AssemblyInfo.cs diff --git a/GestureLock/GestureLock.csproj b/GestureLock/GestureLock.csproj new file mode 100644 index 0000000..ae47bce --- /dev/null +++ b/GestureLock/GestureLock.csproj @@ -0,0 +1,40 @@ + + + + + net472 + enable + latest + false + + + + + C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll + + + C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll + + + 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\UnityEngine.CoreModule.dll + + + C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.InputLegacyModule.dll + + + + + + + + + diff --git a/GestureLock/GestureLock.sln b/GestureLock/GestureLock.sln new file mode 100644 index 0000000..65fa197 --- /dev/null +++ b/GestureLock/GestureLock.sln @@ -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 diff --git a/GestureLock/Main.cs b/GestureLock/Main.cs new file mode 100644 index 0000000..ffc7af4 --- /dev/null +++ b/GestureLock/Main.cs @@ -0,0 +1,140 @@ +using ABI_RC.Core.UI; +using ABI_RC.Core.Savior; +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 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) + { + if (!MetaPort.Instance.isUsingVr || !enabled) return; + + touchDoubleTimer += Time.deltaTime; + toggleLock = false; + + switch (bind) + { + 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; + } + } + + //Apply GestureLock + [HarmonyPostfix] + [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 (toggleLock) + { + isLocked = !isLocked; + oldGestureLeft = ___gestureLeft; + oldGestureRight = ___gestureRight; + MelonLogger.Msg("Gestures " + (isLocked ? "Locked" : "Unlocked")); + CohtmlHud.Instance.ViewDropTextImmediate("", "Gesture Lock ", "Gestures " + (isLocked ? "Locked" : "Unlocked")); + } + if (isLocked) + { + ___gestureLeftRaw = oldGestureLeft; + ___gestureLeft = oldGestureLeft; + ___gestureRightRaw = oldGestureRight; + ___gestureRight = oldGestureRight; + } + } + } +} diff --git a/GestureLock/Properties/AssemblyInfo.cs b/GestureLock/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..94de873 --- /dev/null +++ b/GestureLock/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +using MelonLoader; +using GestureLock.Properties; +using System.Reflection; + + +[assembly: AssemblyVersion(AssemblyInfoParams.Version)] +[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)] +[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)] +[assembly: AssemblyTitle(nameof(GestureLock))] +[assembly: AssemblyCompany(AssemblyInfoParams.Author)] +[assembly: AssemblyProduct(nameof(GestureLock))] + +[assembly: MelonInfo( + typeof(GestureLock.GestureLock), + nameof(GestureLock), + AssemblyInfoParams.Version, + AssemblyInfoParams.Author, + downloadLink: "" +)] + +[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")] +[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] +[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)] + +namespace GestureLock.Properties; +internal static class AssemblyInfoParams +{ + public const string Version = "1.0.0"; + public const string Author = "NotAKidoS"; +} \ No newline at end of file From 0f544878c18e35e92b6ad2fd2887ceb1a76ddceb Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Wed, 7 Sep 2022 05:42:15 -0500 Subject: [PATCH 03/10] Update README.md --- README.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/README.md b/README.md index 9e68130..4aef126 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,29 @@ # GestureLock Simple GestureLock for CVR. + +Double-touch the selected binding for the selected hand to toggle. + +--- + +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 + +> I am not affiliated with ABI in any official capacity, these mods are not endorsed or outright permitted by ABI and are subject to scrutiny. + +> Neither I nor these mods are in any way affiliated with Alpha Blend Interactive and/or ChilloutVR. Using these modifications might cause issues with the performance, security or stability of the game. Use at your own risk. + +> Any modifications that are not approved can get your ABI account terminated and such this modification is following the "modding guidelines" at the best it could be. +> They reserve the right to punish users using my mod. +> If you are scared of using modifications in your game do not install mods. + +> I do not affiliate ABI and the mod is not supported by ABI. + +> Me and this modification are in no affiliation with ABI and not supported by ABI. + +> This mod is not affiliated with Alpha Blend Interactive. The mod comes with no warranty. Use at your own risk, as I am not responsible for any misuse. + +> I'm not affiliated with Alpha Blend Interactive and this mod is not officially supported by the game. + +> When releasing mods to the public, it is required to state, that the mod authors and modification are in no affiliation with ABI and not supported by ABI. :trollface: + +> i ran out of places to steal disclaimers from From 78c500598eb5c79170a1fdf50a695fe2cd579f9e Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Wed, 7 Sep 2022 17:58:41 -0500 Subject: [PATCH 04/10] Use Controller Toggle Gestures bind. Toggle will not do anything if using Knuckles controllers. I do not own Knuckles so idk what it should do. :shrug: --- GestureLock/GestureLock.csproj | 5 +- GestureLock/Main.cs | 101 +++---------------------- GestureLock/Properties/AssemblyInfo.cs | 8 +- GestureLock/format.json | 23 ++++++ README.md | 4 +- 5 files changed, 42 insertions(+), 99 deletions(-) create mode 100644 GestureLock/format.json 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. --- From 405c6aea220f70d6cb15d1b375dff9308c5c8d96 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Wed, 7 Sep 2022 18:16:31 -0500 Subject: [PATCH 05/10] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 713e11b..9ba9c48 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,9 @@ Uses ChilloutVR's "Controller Toggle Gestures" binding in SteamVR to lock Gestur 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) + + --- Here is the block of text where I tell you this mod is not affiliated or endorsed by ABI. From 13eab5704397e518af2020dbc231e845dcb787a3 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Wed, 7 Sep 2022 18:30:02 -0500 Subject: [PATCH 06/10] Update format.json --- GestureLock/format.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GestureLock/format.json b/GestureLock/format.json index ddc986a..d10f56c 100644 --- a/GestureLock/format.json +++ b/GestureLock/format.json @@ -6,7 +6,7 @@ "loaderversion": "0.5.4", "modtype": "Mod", "author": "NotAKidoS", - "description": "Locks GestureLeft & GestureRight on SteamVR binding.", + "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", @@ -16,8 +16,8 @@ "requirements": [ "None" ], - "downloadlink": "https://github.com/NotAKidOnSteam/GestureLock/releases/download/r1/GestureLock.dll", + "downloadlink": "https://github.com/NotAKidOnSteam/GestureLock/releases/download/r3/GestureLock.dll", "sourcelink": "https://github.com/NotAKidOnSteam/GestureLock/", - "changelog": "Use SteamVR Index Gesture Lock binding instead of touch input.", + "changelog": "Use SteamVR Controller Gesture Lock binding instead of touch input.", "embedcolor": "804221" } \ No newline at end of file From 2b358862abbc420a646ac5901bd0225b76b4bfdb Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 15 Sep 2022 13:36:14 -0500 Subject: [PATCH 07/10] Fixed camera gestures. commented out any changes to gestureraw now camera gestures work, and i assume elsewhere in cvr that utilize gesture recognition --- GestureLock/Main.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GestureLock/Main.cs b/GestureLock/Main.cs index 61842ea..fcdd274 100644 --- a/GestureLock/Main.cs +++ b/GestureLock/Main.cs @@ -51,9 +51,9 @@ public class GestureLock : MelonMod } if (isLocked) { - ___gestureLeftRaw = oldGestureLeft; + //___gestureLeftRaw = oldGestureLeft; ___gestureLeft = oldGestureLeft; - ___gestureRightRaw = oldGestureRight; + //___gestureRightRaw = oldGestureRight; ___gestureRight = oldGestureRight; } } From 49563a00d3701c237ed5c492141ccba227015069 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Thu, 15 Sep 2022 14:11:37 -0500 Subject: [PATCH 08/10] dll bump --- GestureLock/Properties/AssemblyInfo.cs | 2 +- GestureLock/format.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GestureLock/Properties/AssemblyInfo.cs b/GestureLock/Properties/AssemblyInfo.cs index 83a8d04..91ee63a 100644 --- a/GestureLock/Properties/AssemblyInfo.cs +++ b/GestureLock/Properties/AssemblyInfo.cs @@ -25,6 +25,6 @@ using System.Reflection; namespace GestureLock.Properties; internal static class AssemblyInfoParams { - public const string Version = "1.1.0"; + public const string Version = "1.1.1"; public const string Author = "NotAKidoS"; } \ No newline at end of file diff --git a/GestureLock/format.json b/GestureLock/format.json index d10f56c..f877190 100644 --- a/GestureLock/format.json +++ b/GestureLock/format.json @@ -1,7 +1,7 @@ { "_id": 93, "name": "GestureLock", - "modversion": "1.1.0", + "modversion": "1.1.1", "gameversion": "2022r168", "loaderversion": "0.5.4", "modtype": "Mod", @@ -16,8 +16,8 @@ "requirements": [ "None" ], - "downloadlink": "https://github.com/NotAKidOnSteam/GestureLock/releases/download/r3/GestureLock.dll", + "downloadlink": "https://github.com/NotAKidOnSteam/GestureLock/releases/download/r4/GestureLock.dll", "sourcelink": "https://github.com/NotAKidOnSteam/GestureLock/", - "changelog": "Use SteamVR Controller Gesture Lock binding instead of touch input.", + "changelog": "Gesture recognizer now works properly while gestures are locked.\nCan pull camera out with gestures while locked.", "embedcolor": "804221" } \ No newline at end of file From d9b41dc5cc2ced12e756eae6cfc3a2dbf1628401 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Fri, 3 Feb 2023 03:59:40 -0600 Subject: [PATCH 09/10] buimp --- GestureLock/Main.cs | 95 ++++++++++++++------------ GestureLock/Properties/AssemblyInfo.cs | 17 +++-- GestureLock/format.json | 10 +-- 3 files changed, 65 insertions(+), 57 deletions(-) diff --git a/GestureLock/Main.cs b/GestureLock/Main.cs index fcdd274..e349807 100644 --- a/GestureLock/Main.cs +++ b/GestureLock/Main.cs @@ -5,57 +5,66 @@ using HarmonyLib; using MelonLoader; using Valve.VR; -namespace GestureLock; +//I legitimately threw this at ChatGPT to rewrite cause i couldn't be bothered. -public class GestureLock : MelonMod +namespace NAK.Melons.GestureLock { - [HarmonyPatch] - private class HarmonyPatches + public class GestureLockMod : MelonMod { - private static bool isLocked = false; - private static bool toggleLock = false; - private static float oldGestureLeft = 0; - private static float oldGestureRight = 0; - - //Read VR Buttons - [HarmonyPostfix] - [HarmonyPatch(typeof(InputModuleSteamVR), "UpdateInput")] - private static void AfterUpdateInput(ref SteamVR_Action_Boolean ___steamVrIndexGestureToggle, ref VRTrackerManager ____trackerManager) + [HarmonyPatch] + private class HarmonyPatches { - if (!MetaPort.Instance.isUsingVr) return; + private static bool isLocked; + private static float oldGestureLeft; + private static float oldGestureRight; - toggleLock = false; - if (___steamVrIndexGestureToggle.stateDown) + [HarmonyPostfix] + [HarmonyPatch(typeof(InputModuleSteamVR), "UpdateInput")] + private static void Postfix_InputModuleSteamVR_UpdateInput + ( + ref CVRInputManager ____inputManager, + ref VRTrackerManager ____trackerManager, + ref SteamVR_Action_Boolean ___steamVrIndexGestureToggle + ) { - if (!____trackerManager.trackerNames.Contains("knuckles")) + if (!MetaPort.Instance.isUsingVr) { - toggleLock = true; + 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; } } } - - //Apply GestureLock - [HarmonyPostfix] - [HarmonyPatch(typeof(CVRInputManager), "Update")] - private static void AfterUpdate(ref float ___gestureLeftRaw, ref float ___gestureLeft, ref float ___gestureRightRaw, ref float ___gestureRight) - { - if (!MetaPort.Instance.isUsingVr) return; - - if (toggleLock) - { - isLocked = !isLocked; - oldGestureLeft = ___gestureLeft; - oldGestureRight = ___gestureRight; - MelonLogger.Msg("Gestures " + (isLocked ? "Locked" : "Unlocked")); - CohtmlHud.Instance.ViewDropTextImmediate("", "Gesture Lock ", "Gestures " + (isLocked ? "Locked" : "Unlocked")); - } - if (isLocked) - { - //___gestureLeftRaw = oldGestureLeft; - ___gestureLeft = oldGestureLeft; - //___gestureRightRaw = oldGestureRight; - ___gestureRight = oldGestureRight; - } - } } -} +} \ No newline at end of file diff --git a/GestureLock/Properties/AssemblyInfo.cs b/GestureLock/Properties/AssemblyInfo.cs index 91ee63a..8eb8fcb 100644 --- a/GestureLock/Properties/AssemblyInfo.cs +++ b/GestureLock/Properties/AssemblyInfo.cs @@ -1,18 +1,17 @@ -using GestureLock.Properties; -using MelonLoader; +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(GestureLock))] +[assembly: AssemblyTitle(nameof(NAK.Melons.GestureLock))] [assembly: AssemblyCompany(AssemblyInfoParams.Author)] -[assembly: AssemblyProduct(nameof(GestureLock))] +[assembly: AssemblyProduct(nameof(NAK.Melons.GestureLock))] [assembly: MelonInfo( - typeof(GestureLock.GestureLock), - nameof(GestureLock), + typeof(NAK.Melons.GestureLock.GestureLockMod), + nameof(NAK.Melons.GestureLock), AssemblyInfoParams.Version, AssemblyInfoParams.Author, downloadLink: "https://github.com/NotAKidOnSteam/GestureLock" @@ -22,9 +21,9 @@ using System.Reflection; [assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)] -namespace GestureLock.Properties; +namespace NAK.Melons.GestureLock.Properties; internal static class AssemblyInfoParams { - public const string Version = "1.1.1"; + public const string Version = "2.0.0"; public const string Author = "NotAKidoS"; } \ No newline at end of file diff --git a/GestureLock/format.json b/GestureLock/format.json index f877190..4baff42 100644 --- a/GestureLock/format.json +++ b/GestureLock/format.json @@ -1,9 +1,9 @@ { "_id": 93, "name": "GestureLock", - "modversion": "1.1.1", - "gameversion": "2022r168", - "loaderversion": "0.5.4", + "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.", @@ -16,8 +16,8 @@ "requirements": [ "None" ], - "downloadlink": "https://github.com/NotAKidOnSteam/GestureLock/releases/download/r4/GestureLock.dll", + "downloadlink": "https://github.com/NotAKidOnSteam/GestureLock/releases/download/v2.0.0/GestureLock.dll", "sourcelink": "https://github.com/NotAKidOnSteam/GestureLock/", - "changelog": "Gesture recognizer now works properly while gestures are locked.\nCan pull camera out with gestures while locked.", + "changelog": "- Simplification & refactor.", "embedcolor": "804221" } \ No newline at end of file From 2628e25bd2a67031c946041d1b513cbbcff2f991 Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Tue, 7 Feb 2023 14:52:23 -0600 Subject: [PATCH 10/10] Update README.md gonna see how a smaller disclaimer feels --- README.md | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 9ba9c48..6c6c4b1 100644 --- a/README.md +++ b/README.md @@ -13,22 +13,8 @@ Does nothing on Knuckles controllers as the bind is used for finger tracking. 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 -> I am not affiliated with ABI in any official capacity, these mods are not endorsed or outright permitted by ABI and are subject to scrutiny. +> This mod is an independent creation and is not affiliated with, supported by or approved by Alpha Blend Interactive. -> Neither I nor these mods are in any way affiliated with Alpha Blend Interactive and/or ChilloutVR. Using these modifications might cause issues with the performance, security or stability of the game. Use at your own risk. +> 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. -> Any modifications that are not approved can get your ABI account terminated and such this modification is following the "modding guidelines" at the best it could be. -> They reserve the right to punish users using my mod. -> If you are scared of using modifications in your game do not install mods. - -> I do not affiliate ABI and the mod is not supported by ABI. - -> Me and this modification are in no affiliation with ABI and not supported by ABI. - -> This mod is not affiliated with Alpha Blend Interactive. The mod comes with no warranty. Use at your own risk, as I am not responsible for any misuse. - -> I'm not affiliated with Alpha Blend Interactive and this mod is not officially supported by the game. - -> When releasing mods to the public, it is required to state, that the mod authors and modification are in no affiliation with ABI and not supported by ABI. :trollface: - -> i ran out of places to steal disclaimers from +> To the best of my knowledge, I have adhered to the Modding Guidelines established by Alpha Blend Interactive.