mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-04 07:19:22 +00:00
Merge remote-tracking branch 'TrackedControllerFix/main'
Merged TrackedControllerFix
This commit is contained in:
commit
2712713ccf
7 changed files with 245 additions and 0 deletions
19
TrackedControllerFix/HarmonyPatches.cs
Normal file
19
TrackedControllerFix/HarmonyPatches.cs
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
using ABI_RC.Core.Player;
|
||||||
|
using HarmonyLib;
|
||||||
|
using Valve.VR;
|
||||||
|
|
||||||
|
namespace NAK.Melons.TrackedControllerFix.HarmonyPatches;
|
||||||
|
|
||||||
|
internal class PlayerSetupPatches
|
||||||
|
{
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(PlayerSetup), "Start")]
|
||||||
|
private static void Post_PlayerSetup_Start(ref PlayerSetup __instance)
|
||||||
|
{
|
||||||
|
// Add TrackedControllerFix
|
||||||
|
var vrLeftHandTracker = __instance.vrLeftHandTracker.AddComponent<TrackedControllerFix>();
|
||||||
|
vrLeftHandTracker.inputSource = SteamVR_Input_Sources.LeftHand;
|
||||||
|
var vrRightHandTracker = __instance.vrRightHandTracker.AddComponent<TrackedControllerFix>();
|
||||||
|
vrRightHandTracker.inputSource = SteamVR_Input_Sources.RightHand;
|
||||||
|
}
|
||||||
|
}
|
24
TrackedControllerFix/Main.cs
Normal file
24
TrackedControllerFix/Main.cs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
using MelonLoader;
|
||||||
|
|
||||||
|
namespace NAK.Melons.TrackedControllerFix;
|
||||||
|
|
||||||
|
public class TrackedControllerFixMod : MelonMod
|
||||||
|
{
|
||||||
|
public override void OnInitializeMelon()
|
||||||
|
{
|
||||||
|
ApplyPatches(typeof(HarmonyPatches.PlayerSetupPatches));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ApplyPatches(Type type)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HarmonyInstance.PatchAll(type);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LoggerInstance.Msg($"Failed while patching {type.Name}!");
|
||||||
|
LoggerInstance.Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
30
TrackedControllerFix/Properties/AssemblyInfo.cs
Normal file
30
TrackedControllerFix/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
using MelonLoader;
|
||||||
|
using NAK.Melons.TrackedControllerFix.Properties;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
|
||||||
|
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
|
||||||
|
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
|
||||||
|
[assembly: AssemblyTitle(nameof(NAK.Melons.TrackedControllerFix))]
|
||||||
|
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
|
||||||
|
[assembly: AssemblyProduct(nameof(NAK.Melons.TrackedControllerFix))]
|
||||||
|
|
||||||
|
[assembly: MelonInfo(
|
||||||
|
typeof(NAK.Melons.TrackedControllerFix.TrackedControllerFixMod),
|
||||||
|
nameof(NAK.Melons.TrackedControllerFix),
|
||||||
|
AssemblyInfoParams.Version,
|
||||||
|
AssemblyInfoParams.Author,
|
||||||
|
downloadLink: "https://github.com/NotAKidOnSteam/TrackedControllerFix"
|
||||||
|
)]
|
||||||
|
|
||||||
|
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
||||||
|
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||||
|
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||||
|
[assembly: HarmonyDontPatchAll]
|
||||||
|
|
||||||
|
namespace NAK.Melons.TrackedControllerFix.Properties;
|
||||||
|
internal static class AssemblyInfoParams
|
||||||
|
{
|
||||||
|
public const string Version = "1.0.2";
|
||||||
|
public const string Author = "NotAKidoS";
|
||||||
|
}
|
54
TrackedControllerFix/TrackedControllerFix.cs
Normal file
54
TrackedControllerFix/TrackedControllerFix.cs
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
using UnityEngine;
|
||||||
|
using Valve.VR;
|
||||||
|
|
||||||
|
namespace NAK.Melons.TrackedControllerFix;
|
||||||
|
|
||||||
|
public class TrackedControllerFix : MonoBehaviour
|
||||||
|
{
|
||||||
|
public SteamVR_Input_Sources inputSource;
|
||||||
|
public int deviceIndex;
|
||||||
|
|
||||||
|
private SteamVR_TrackedObject trackedObject;
|
||||||
|
private SteamVR_Behaviour_Pose oldBehaviourPose;
|
||||||
|
private SteamVR_Action_Pose actionPose = SteamVR_Input.GetAction<SteamVR_Action_Pose>("Pose", false);
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
trackedObject = gameObject.AddComponent<SteamVR_TrackedObject>();
|
||||||
|
oldBehaviourPose = gameObject.GetComponent<SteamVR_Behaviour_Pose>();
|
||||||
|
oldBehaviourPose.broadcastDeviceChanges = false; //this fucks us
|
||||||
|
if (actionPose != null) CheckDeviceIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
if (actionPose != null) actionPose[inputSource].onDeviceConnectedChanged += OnDeviceConnectedChanged;
|
||||||
|
oldBehaviourPose.enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
|
{
|
||||||
|
if (actionPose != null) actionPose[inputSource].onDeviceConnectedChanged -= OnDeviceConnectedChanged;
|
||||||
|
oldBehaviourPose.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDeviceConnectedChanged(SteamVR_Action_Pose changedAction, SteamVR_Input_Sources changedSource, bool connected)
|
||||||
|
{
|
||||||
|
if (actionPose != changedAction) actionPose = changedAction;
|
||||||
|
if (changedSource != inputSource) return;
|
||||||
|
CheckDeviceIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckDeviceIndex()
|
||||||
|
{
|
||||||
|
if (actionPose[inputSource].active && actionPose[inputSource].deviceIsConnected)
|
||||||
|
{
|
||||||
|
int trackedDeviceIndex = (int)actionPose[inputSource].trackedDeviceIndex;
|
||||||
|
if (deviceIndex != trackedDeviceIndex)
|
||||||
|
{
|
||||||
|
deviceIndex = trackedDeviceIndex;
|
||||||
|
trackedObject.SetDeviceIndex(deviceIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
70
TrackedControllerFix/TrackedControllerFix.csproj
Normal file
70
TrackedControllerFix/TrackedControllerFix.csproj
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.1</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="Assembly-CSharp-firstpass">
|
||||||
|
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Aura2_Core">
|
||||||
|
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Aura2_Core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="cohtml.Net">
|
||||||
|
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\cohtml.Net.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Cohtml.Runtime">
|
||||||
|
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.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="UIExpansionKit">
|
||||||
|
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\Mods\UIExpansionKit.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Unity.Postprocessing.Runtime">
|
||||||
|
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Unity.Postprocessing.Runtime.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Unity.TextMeshPro">
|
||||||
|
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Unity.TextMeshPro.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.AnimationModule">
|
||||||
|
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.AnimationModule.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>
|
||||||
|
<Reference Include="UnityEngine.PhysicsModule">
|
||||||
|
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.VRModule">
|
||||||
|
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.VRModule.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.XRModule">
|
||||||
|
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.XRModule.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>
|
25
TrackedControllerFix/TrackedControllerFix.sln
Normal file
25
TrackedControllerFix/TrackedControllerFix.sln
Normal 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}") = "TrackedControllerFix", "TrackedControllerFix.csproj", "{988BC351-E04B-4756-A6FC-A7E55E830DB6}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{988BC351-E04B-4756-A6FC-A7E55E830DB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{988BC351-E04B-4756-A6FC-A7E55E830DB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{988BC351-E04B-4756-A6FC-A7E55E830DB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{988BC351-E04B-4756-A6FC-A7E55E830DB6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {F38A646E-1C36-4233-AC20-4E9F0CED9BDF}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
23
TrackedControllerFix/format.json
Normal file
23
TrackedControllerFix/format.json
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"_id": -1,
|
||||||
|
"name": "TrackedControllerFix",
|
||||||
|
"modversion": "1.0.0",
|
||||||
|
"gameversion": "2022r170",
|
||||||
|
"loaderversion": "0.5.7",
|
||||||
|
"modtype": "Mod",
|
||||||
|
"author": "NotAKidoS",
|
||||||
|
"description": "Allows your controllers to track while the SteamVR overlay is open. This also fixes Quest/Touch controllers feeling slow during fast movements.",
|
||||||
|
"searchtags": [
|
||||||
|
"vr",
|
||||||
|
"quest",
|
||||||
|
"controller",
|
||||||
|
"tracking"
|
||||||
|
],
|
||||||
|
"requirements": [
|
||||||
|
"None"
|
||||||
|
],
|
||||||
|
"downloadlink": "https://github.com/NotAKidOnSteam/TrackedControllerFix/releases/download/v1.0.0/TrackedControllerFix.dll",
|
||||||
|
"sourcelink": "https://github.com/NotAKidOnSteam/TrackedControllerFix/",
|
||||||
|
"changelog": "Initial Release",
|
||||||
|
"embedcolor": "3498db"
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue