Convert to 2023r171ex1

This commit is contained in:
SDraw 2023-02-14 21:31:07 +03:00
parent 7d3b76e092
commit b0ae6082bf
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
18 changed files with 371 additions and 581 deletions

View file

@ -11,10 +11,10 @@ namespace ml_lme
[DisallowMultipleComponent]
class LeapInput : CVRInputModule
{
static readonly FieldInfo ms_indexGestureToggle = typeof(InputModuleSteamVR).GetField("_steamVrIndexGestureToggleValue", BindingFlags.Instance | BindingFlags.NonPublic);
static readonly FieldInfo ms_indexGestureToggle = typeof(InputModuleOpenXR).GetField("_steamVrIndexGestureToggleValue", BindingFlags.Instance | BindingFlags.NonPublic);
CVRInputManager m_inputManager = null;
InputModuleSteamVR m_steamVrModule = null;
InputModuleOpenXR m_openXrModule = null;
bool m_inVR = false;
bool m_gripToGrab = true;
@ -32,7 +32,7 @@ namespace ml_lme
base.Start();
m_inputManager = CVRInputManager.Instance; // _inputManager is stripped out, cool beans
m_steamVrModule = m_inputManager.GetComponent<InputModuleSteamVR>();
m_openXrModule = m_inputManager.GetComponent<InputModuleOpenXR>();
m_inVR = Utils.IsInVR();
m_handRayLeft = LeapTracking.GetInstance().GetLeftHand().gameObject.AddComponent<ControllerRay>();
@ -240,7 +240,7 @@ namespace ml_lme
// Arbitrary
void UpdateFingerTracking()
{
m_inputManager.individualFingerTracking = (Settings.Enabled || (m_inVR && Utils.AreKnucklesInUse() && !(bool)ms_indexGestureToggle.GetValue(m_steamVrModule)));
m_inputManager.individualFingerTracking = (Settings.Enabled || (m_inVR && m_openXrModule.AreKnucklesInUse() && !(bool)ms_indexGestureToggle.GetValue(m_openXrModule)));
IKSystem.Instance.FingerSystem.controlActive = m_inputManager.individualFingerTracking;
}
@ -256,11 +256,6 @@ namespace ml_lme
m_inputManager.fingerCurlLeftMiddle = p_hand.m_bends[2];
m_inputManager.fingerCurlLeftRing = p_hand.m_bends[3];
m_inputManager.fingerCurlLeftPinky = p_hand.m_bends[4];
IKSystem.Instance.FingerSystem.leftThumbCurl = p_hand.m_bends[0];
IKSystem.Instance.FingerSystem.leftIndexCurl = p_hand.m_bends[1];
IKSystem.Instance.FingerSystem.leftMiddleCurl = p_hand.m_bends[2];
IKSystem.Instance.FingerSystem.leftRingCurl = p_hand.m_bends[3];
IKSystem.Instance.FingerSystem.leftPinkyCurl = p_hand.m_bends[4];
}
else
{
@ -269,11 +264,6 @@ namespace ml_lme
m_inputManager.fingerCurlRightMiddle = p_hand.m_bends[2];
m_inputManager.fingerCurlRightRing = p_hand.m_bends[3];
m_inputManager.fingerCurlRightPinky = p_hand.m_bends[4];
IKSystem.Instance.FingerSystem.rightThumbCurl = p_hand.m_bends[0];
IKSystem.Instance.FingerSystem.rightIndexCurl = p_hand.m_bends[1];
IKSystem.Instance.FingerSystem.rightMiddleCurl = p_hand.m_bends[2];
IKSystem.Instance.FingerSystem.rightRingCurl = p_hand.m_bends[3];
IKSystem.Instance.FingerSystem.rightPinkyCurl = p_hand.m_bends[4];
}
}

View file

@ -1,10 +1,4 @@
using System.Reflection;
[assembly: AssemblyTitle("LeapMotionExtension")]
[assembly: AssemblyVersion("1.3.1")]
[assembly: AssemblyFileVersion("1.3.1")]
[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.3.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.3.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]

View file

@ -1,7 +1,8 @@
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using ABI_RC.Core.UI;
using System.Linq;
using System.Reflection;
using UnityEngine;
using UnityEngine.XR;
namespace ml_lme
{
@ -9,11 +10,13 @@ namespace ml_lme
{
static readonly Quaternion ms_hmdRotationFix = new Quaternion(0f, 0.7071068f, 0.7071068f, 0f);
static readonly Quaternion ms_screentopRotationFix = new Quaternion(0f, 0f, -1f, 0f);
static readonly FieldInfo ms_leftControllerName = typeof(InputModuleOpenXR).GetField("_leftHandControllerName", BindingFlags.NonPublic | BindingFlags.Instance);
static readonly FieldInfo ms_rightControllerName = typeof(InputModuleOpenXR).GetField("_rightHandControllerName", BindingFlags.NonPublic | BindingFlags.Instance);
public static bool IsInVR() => ((ABI_RC.Core.Savior.CheckVR.Instance != null) && ABI_RC.Core.Savior.CheckVR.Instance.hasVrDeviceLoaded);
public static bool AreKnucklesInUse() => PlayerSetup.Instance._trackerManager.trackerNames.Contains("knuckles");
public static bool IsLeftHandTracked() => ((VRTrackerManager.Instance.leftHand != null) && VRTrackerManager.Instance.leftHand.active);
public static bool IsRightHandTracked() => ((VRTrackerManager.Instance.rightHand != null) && VRTrackerManager.Instance.rightHand.active);
public static bool IsInVR() => ((CheckVR.Instance != null) && CheckVR.Instance.hasVrDeviceLoaded);
public static bool AreKnucklesInUse(this InputModuleOpenXR p_module) => (((string)ms_leftControllerName.GetValue(p_module)).Contains("Index") || ((string)ms_rightControllerName.GetValue(p_module)).Contains("Index"));
public static bool IsLeftHandTracked() => InputDevices.GetDeviceAtXRNode(XRNode.LeftHand).isValid;
public static bool IsRightHandTracked() => InputDevices.GetDeviceAtXRNode(XRNode.RightHand).isValid;
public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false)
{
@ -22,9 +25,9 @@ namespace ml_lme
public static void ShowHUDNotification(string p_title, string p_message, string p_small = "", bool p_immediate = false)
{
if(CohtmlHud.Instance != null)
if (CohtmlHud.Instance != null)
{
if(p_immediate)
if (p_immediate)
CohtmlHud.Instance.ViewDropTextImmediate(p_title, p_message, p_small);
else
CohtmlHud.Instance.ViewDropText(p_title, p_message, p_small);
@ -38,23 +41,23 @@ namespace ml_lme
p_rot.x *= -1f;
p_rot.y *= -1f;
switch(p_mode)
switch (p_mode)
{
case Settings.LeapTrackingMode.Screentop:
{
p_pos.x *= -1f;
p_pos.y *= -1f;
p_rot = (ms_screentopRotationFix * p_rot);
}
break;
{
p_pos.x *= -1f;
p_pos.y *= -1f;
p_rot = (ms_screentopRotationFix * p_rot);
}
break;
case Settings.LeapTrackingMode.HMD:
{
p_pos.x *= -1f;
Swap(ref p_pos.y, ref p_pos.z);
p_rot = (ms_hmdRotationFix * p_rot);
}
break;
{
p_pos.x *= -1f;
Swap(ref p_pos.y, ref p_pos.z);
p_rot = (ms_hmdRotationFix * p_rot);
}
break;
}
}

View file

@ -1,144 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{83CC74B7-F444-40E1-BD06-67CEC995A919}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ml_lme</RootNamespace>
<AssemblyName>ml_lme</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFramework>netstandard2.1</TargetFramework>
<Platforms>x64</Platforms>
<PackageId>LeapMotionExtension</PackageId>
<Version>1.3.1</Version>
<Authors>SDraw</Authors>
<Company>None</Company>
<Product>LeapMotionExtension</Product>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony, Version=2.9.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>C:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>C:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="cohtml.Net">
<Private>False</Private>
</Reference>
<Reference Include="Cohtml.Runtime">
<Private>False</Private>
</Reference>
<Reference Include="MelonLoader">
<HintPath>C:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine">
<HintPath>C:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.AnimationModule">
<HintPath>C:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.AnimationModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.AssetBundleModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.AssetBundleModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>C:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Compile Remove="vendor\LeapSDK\**" />
<EmbeddedResource Remove="vendor\LeapSDK\**" />
<None Remove="vendor\LeapSDK\**" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssetsHandler.cs" />
<Compile Include="DependenciesHandler.cs" />
<Compile Include="GestureMatcher.cs" />
<Compile Include="LeapInput.cs" />
<Compile Include="LeapManager.cs" />
<Compile Include="LeapTracked.cs" />
<Compile Include="LeapTracking.cs" />
<Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Scripts.cs" />
<Compile Include="Settings.cs" />
<Compile Include="Utils.cs" />
<Compile Include="vendor\LeapCSharp\Arm.cs" />
<Compile Include="vendor\LeapCSharp\Bone.cs" />
<Compile Include="vendor\LeapCSharp\CircularObjectBuffer.cs" />
<Compile Include="vendor\LeapCSharp\Config.cs" />
<Compile Include="vendor\LeapCSharp\Connection.cs" />
<Compile Include="vendor\LeapCSharp\Controller.cs" />
<Compile Include="vendor\LeapCSharp\CopyFromLeapCExtensions.cs" />
<Compile Include="vendor\LeapCSharp\CopyFromOtherExtensions.cs" />
<Compile Include="vendor\LeapCSharp\CSharpExtensions.cs" />
<Compile Include="vendor\LeapCSharp\Device.cs" />
<Compile Include="vendor\LeapCSharp\DeviceList.cs" />
<Compile Include="vendor\LeapCSharp\DistortionData.cs" />
<Compile Include="vendor\LeapCSharp\Events.cs" />
<Compile Include="vendor\LeapCSharp\FailedDevice.cs" />
<Compile Include="vendor\LeapCSharp\FailedDeviceList.cs" />
<Compile Include="vendor\LeapCSharp\Finger.cs" />
<Compile Include="vendor\LeapCSharp\Frame.cs" />
<Compile Include="vendor\LeapCSharp\Hand.cs" />
<Compile Include="vendor\LeapCSharp\IController.cs" />
<Compile Include="vendor\LeapCSharp\Image.cs" />
<Compile Include="vendor\LeapCSharp\ImageData.cs" />
<Compile Include="vendor\LeapCSharp\LeapC.cs" />
<Compile Include="vendor\LeapCSharp\LeapQuaternion.cs" />
<Compile Include="vendor\LeapCSharp\LeapTransform.cs" />
<Compile Include="vendor\LeapCSharp\Logger.cs" />
<Compile Include="vendor\LeapCSharp\Matrix.cs" />
<Compile Include="vendor\LeapCSharp\MemoryManager.cs" />
<Compile Include="vendor\LeapCSharp\MessageSeverity.cs" />
<Compile Include="vendor\LeapCSharp\PointMapping.cs" />
<Compile Include="vendor\LeapCSharp\StructMarshal.cs" />
<Compile Include="vendor\LeapCSharp\TransformExtensions.cs" />
<Compile Include="vendor\LeapCSharp\Vector.cs" />
<None Remove="LeapMotionExtension.json" />
<None Remove="resources\leapmotion_controller.asset" />
<None Remove="resources\menu.js" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="resources\leapmotion_controller.asset" />
<EmbeddedResource Include="resources\menu.js" />
<EmbeddedResource Include="vendor\LeapSDK\lib\x64\LeapC.dll">
<Link>LeapC.dll</Link>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="resources\leapmotion_controller.asset" />
<Reference Include="0Harmony">
<HintPath>D:\games\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="cohtml.Net">
<HintPath>D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\cohtml.Net.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="Cohtml.Runtime">
<HintPath>D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="MelonLoader">
<HintPath>D:\games\Steam\steamapps\common\ChilloutVR\MelonLoader\MelonLoader.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine">
<HintPath>D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.AnimationModule">
<HintPath>D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.AnimationModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.AssetBundleModule">
<HintPath>D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.AssetBundleModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="UnityEngine.XRModule">
<HintPath>D:\games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.XRModule.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="resources\menu.js" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy /y "$(TargetPath)" "D:\Games\Steam\steamapps\common\ChilloutVR\Mods\"</PostBuildEvent>
</PropertyGroup>
</Project>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /y &quot;$(TargetPath)&quot; &quot;D:\Games\Steam\steamapps\common\ChilloutVR\Mods\&quot;" />
</Target>
</Project>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ReferencePath>D:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\;D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\</ReferencePath>
</PropertyGroup>
</Project>