mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 23:09:22 +00:00
[DesktopVRSwitch] Fixes for 2023r172.
This commit is contained in:
parent
39cbdf8ed5
commit
6b32a6475d
6 changed files with 43 additions and 38 deletions
29
DesktopVRSwitch/Patches/DestroySteamVRInstancesImmediate.cs
Normal file
29
DesktopVRSwitch/Patches/DestroySteamVRInstancesImmediate.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using ABI_RC.Systems.IK;
|
||||
using ABI_RC.Systems.IK.TrackingModules;
|
||||
using ABI_RC.Systems.InputManagement;
|
||||
using ABI_RC.Systems.InputManagement.XR.Modules;
|
||||
|
||||
namespace NAK.DesktopVRSwitch.Patches;
|
||||
|
||||
internal static class SteamVRNullReferencePatch
|
||||
{
|
||||
public static void DestroySteamVRInstancesImmediate()
|
||||
{
|
||||
// set to null so input manager doesnt attempt to access it
|
||||
if (CVRInputManager._moduleXR != null)
|
||||
{
|
||||
if (CVRInputManager._moduleXR._leftModule != null)
|
||||
if (CVRInputManager._moduleXR._leftModule is CVRXRModule_SteamVR leftModule) leftModule._steamVr = null;
|
||||
if (CVRInputManager._moduleXR._rightModule != null)
|
||||
if (CVRInputManager._moduleXR._rightModule is CVRXRModule_SteamVR rightModule) rightModule._steamVr = null;
|
||||
}
|
||||
|
||||
if (IKSystem.Instance == null)
|
||||
return;
|
||||
|
||||
// set to null so tracking module doesnt attempt to access it
|
||||
foreach (TrackingModule module in IKSystem.Instance._trackingModules)
|
||||
if (module is SteamVRTrackingModule steamVRModule)
|
||||
steamVRModule._steamVr = null;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue