mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
[DesktopVRSwitch] Fixes for 2023r171
This commit is contained in:
parent
ba6a5f4778
commit
be82bf228c
12 changed files with 61 additions and 129 deletions
|
@ -3,7 +3,6 @@ using ABI_RC.Core.Savior;
|
||||||
using ABI_RC.Core.Util.Object_Behaviour;
|
using ABI_RC.Core.Util.Object_Behaviour;
|
||||||
using ABI_RC.Systems.IK;
|
using ABI_RC.Systems.IK;
|
||||||
using ABI_RC.Systems.IK.TrackingModules;
|
using ABI_RC.Systems.IK.TrackingModules;
|
||||||
using cohtml;
|
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using NAK.DesktopVRSwitch.Patches;
|
using NAK.DesktopVRSwitch.Patches;
|
||||||
using NAK.DesktopVRSwitch.VRModeTrackers;
|
using NAK.DesktopVRSwitch.VRModeTrackers;
|
||||||
|
@ -12,11 +11,11 @@ using Valve.VR;
|
||||||
|
|
||||||
namespace NAK.DesktopVRSwitch.HarmonyPatches;
|
namespace NAK.DesktopVRSwitch.HarmonyPatches;
|
||||||
|
|
||||||
class CheckVRPatches
|
internal class CheckVRPatches
|
||||||
{
|
{
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(CheckVR), nameof(CheckVR.Start))]
|
[HarmonyPatch(typeof(CheckVR), nameof(CheckVR.Awake))]
|
||||||
static void Postfix_CheckVR_Start(ref CheckVR __instance)
|
private static void Postfix_CheckVR_Start(ref CheckVR __instance)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -30,33 +29,19 @@ class CheckVRPatches
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class IKSystemPatches
|
internal class IKSystemPatches
|
||||||
{
|
{
|
||||||
[HarmonyPostfix] //lazy fix so i dont need to wait few frames
|
[HarmonyPostfix] //lazy fix so device indices can change properly
|
||||||
[HarmonyPatch(typeof(TrackingPoint), nameof(TrackingPoint.Initialize))]
|
|
||||||
static void Postfix_TrackingPoint_Initialize(ref TrackingPoint __instance)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
__instance.referenceTransform.localScale = Vector3.one;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Error($"Error during the patched method {nameof(Postfix_TrackingPoint_Initialize)}");
|
|
||||||
DesktopVRSwitch.Logger.Error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[HarmonyPostfix] //lazy fix so device indecies can change properly
|
|
||||||
[HarmonyPatch(typeof(SteamVRTrackingModule), nameof(SteamVRTrackingModule.ModuleDestroy))]
|
[HarmonyPatch(typeof(SteamVRTrackingModule), nameof(SteamVRTrackingModule.ModuleDestroy))]
|
||||||
static void Postfix_SteamVRTrackingModule_ModuleDestroy(ref SteamVRTrackingModule __instance)
|
private static void Postfix_SteamVRTrackingModule_ModuleDestroy(ref SteamVRTrackingModule __instance)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for (int i = 0; i < __instance.TrackingPoints.Count; i++)
|
foreach (TrackingPoint t in __instance.TrackingPoints)
|
||||||
{
|
{
|
||||||
UnityEngine.Object.Destroy(__instance.TrackingPoints[i].referenceGameObject);
|
UnityEngine.Object.Destroy(t.referenceGameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
__instance.TrackingPoints.Clear();
|
__instance.TrackingPoints.Clear();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -67,12 +52,12 @@ class IKSystemPatches
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CVRWorldPatches
|
internal class CVRWorldPatches
|
||||||
{
|
{
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(CVRWorld), nameof(CVRWorld.SetDefaultCamValues))]
|
[HarmonyPatch(typeof(CVRWorld), nameof(CVRWorld.SetDefaultCamValues))]
|
||||||
[HarmonyPatch(typeof(CVRWorld), nameof(CVRWorld.CopyRefCamValues))]
|
[HarmonyPatch(typeof(CVRWorld), nameof(CVRWorld.CopyRefCamValues))]
|
||||||
static void Postfix_CVRWorld_HandleCamValues()
|
private static void Postfix_CVRWorld_HandleCamValues()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -86,11 +71,11 @@ class CVRWorldPatches
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CameraFacingObjectPatches
|
internal class CameraFacingObjectPatches
|
||||||
{
|
{
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPatch(typeof(CameraFacingObject), nameof(CameraFacingObject.Start))]
|
[HarmonyPatch(typeof(CameraFacingObject), nameof(CameraFacingObject.Start))]
|
||||||
static void Postfix_CameraFacingObject_Start(ref CameraFacingObject __instance)
|
private static void Postfix_CameraFacingObject_Start(ref CameraFacingObject __instance)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -104,11 +89,11 @@ class CameraFacingObjectPatches
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CVRPickupObjectPatches
|
internal class CVRPickupObjectPatches
|
||||||
{
|
{
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(CVRPickupObject), nameof(CVRPickupObject.Start))]
|
[HarmonyPatch(typeof(CVRPickupObject), nameof(CVRPickupObject.Start))]
|
||||||
static void Prefix_CVRPickupObject_Start(ref CVRPickupObject __instance)
|
private static void Prefix_CVRPickupObject_Start(ref CVRPickupObject __instance)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -119,7 +104,7 @@ class CVRPickupObjectPatches
|
||||||
Transform desktopOrigin = vrOrigin?.Find("[Desktop]");
|
Transform desktopOrigin = vrOrigin?.Find("[Desktop]");
|
||||||
if (vrOrigin != null && desktopOrigin != null)
|
if (vrOrigin != null && desktopOrigin != null)
|
||||||
{
|
{
|
||||||
var tracker = __instance.gameObject.AddComponent<CVRPickupObjectTracker>();
|
CVRPickupObjectTracker tracker = __instance.gameObject.AddComponent<CVRPickupObjectTracker>();
|
||||||
tracker._pickupObject = __instance;
|
tracker._pickupObject = __instance;
|
||||||
tracker._storedGripOrigin = (!MetaPort.Instance.isUsingVr ? vrOrigin : desktopOrigin);
|
tracker._storedGripOrigin = (!MetaPort.Instance.isUsingVr ? vrOrigin : desktopOrigin);
|
||||||
}
|
}
|
||||||
|
@ -132,42 +117,18 @@ class CVRPickupObjectPatches
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class CohtmlUISystemPatches
|
internal class SteamVRBehaviourPatches
|
||||||
{
|
|
||||||
[HarmonyPrefix]
|
|
||||||
[HarmonyPatch(typeof(CohtmlUISystem), nameof(CohtmlUISystem.RegisterGamepad))]
|
|
||||||
[HarmonyPatch(typeof(CohtmlUISystem), nameof(CohtmlUISystem.UnregisterGamepad))]
|
|
||||||
[HarmonyPatch(typeof(CohtmlUISystem), nameof(CohtmlUISystem.UpdateGamepadState))]
|
|
||||||
static bool Prefix_CohtmlUISystem_FuckOff()
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
GameFace Version 1.34.0.4 – released 10 Nov 2022
|
|
||||||
Fixed a crash when registering and unregistering gamepads
|
|
||||||
Fix Fixed setting a gamepad object when creating GamepadEvent from JavaScript
|
|
||||||
Fix Fixed a crash when unregistering a gamepad twice
|
|
||||||
Fix Fixed a GamepadEvent related crash during garbage collector tracing
|
|
||||||
|
|
||||||
we are using 1.17.0 (released 10/09/21) :):):)
|
|
||||||
**/
|
|
||||||
|
|
||||||
// dont
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class SteamVRBehaviourPatches
|
|
||||||
{
|
{
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
[HarmonyPatch(typeof(SteamVR_Behaviour), nameof(SteamVR_Behaviour.OnQuit))]
|
[HarmonyPatch(typeof(SteamVR_Behaviour), nameof(SteamVR_Behaviour.OnQuit))]
|
||||||
static bool Prefix_SteamVR_Behaviour_OnQuit()
|
private static bool Prefix_SteamVR_Behaviour_OnQuit()
|
||||||
{
|
{
|
||||||
if (DesktopVRSwitch.EntrySwitchToDesktopOnExit.Value)
|
if (!DesktopVRSwitch.EntrySwitchToDesktopOnExit.Value)
|
||||||
{
|
return true;
|
||||||
// If we don't switch fast enough, SteamVR will force close.
|
|
||||||
// World Transition might cause issues. Might need to override.
|
// If we don't switch fast enough, SteamVR will force close.
|
||||||
VRModeSwitchManager.Instance?.AttemptSwitch();
|
// World Transition might cause issues. Might need to override.
|
||||||
return false;
|
VRModeSwitchManager.Instance?.AttemptSwitch();
|
||||||
}
|
return false;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -40,8 +40,6 @@ public class DesktopVRSwitch : MelonMod
|
||||||
ApplyPatches(typeof(HarmonyPatches.IKSystemPatches));
|
ApplyPatches(typeof(HarmonyPatches.IKSystemPatches));
|
||||||
// post processing fixes
|
// post processing fixes
|
||||||
ApplyPatches(typeof(HarmonyPatches.CVRWorldPatches));
|
ApplyPatches(typeof(HarmonyPatches.CVRWorldPatches));
|
||||||
// cohtml gamepad handling nuke
|
|
||||||
ApplyPatches(typeof(HarmonyPatches.CohtmlUISystemPatches));
|
|
||||||
|
|
||||||
// prevent steamvr behaviour from closing game
|
// prevent steamvr behaviour from closing game
|
||||||
ApplyPatches(typeof(HarmonyPatches.SteamVRBehaviourPatches));
|
ApplyPatches(typeof(HarmonyPatches.SteamVRBehaviourPatches));
|
||||||
|
@ -55,7 +53,7 @@ public class DesktopVRSwitch : MelonMod
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterVRModeTrackers()
|
private static void RegisterVRModeTrackers()
|
||||||
{
|
{
|
||||||
// Core trackers
|
// Core trackers
|
||||||
VRModeSwitchManager.RegisterVRModeTracker(new CheckVRTracker());
|
VRModeSwitchManager.RegisterVRModeTracker(new CheckVRTracker());
|
||||||
|
@ -86,7 +84,7 @@ public class DesktopVRSwitch : MelonMod
|
||||||
VRModeSwitchManager.RegisterVRModeTracker(new CVRWorldTracker());
|
VRModeSwitchManager.RegisterVRModeTracker(new CVRWorldTracker());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplyPatches(Type type)
|
private void ApplyPatches(Type type)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,7 @@ using UnityEngine.Rendering.PostProcessing;
|
||||||
|
|
||||||
namespace NAK.DesktopVRSwitch.Patches;
|
namespace NAK.DesktopVRSwitch.Patches;
|
||||||
|
|
||||||
class ReferenceCameraPatch
|
internal class ReferenceCameraPatch
|
||||||
{
|
{
|
||||||
public static void OnWorldLoad()
|
public static void OnWorldLoad()
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ class ReferenceCameraPatch
|
||||||
CopyToInactiveCam(activeCamera, inactiveCamera);
|
CopyToInactiveCam(activeCamera, inactiveCamera);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CopyToInactiveCam(Camera activeCam, Camera inactiveCam)
|
private static void CopyToInactiveCam(Camera activeCam, Camera inactiveCam)
|
||||||
{
|
{
|
||||||
if (inactiveCam == null || activeCam == null)
|
if (inactiveCam == null || activeCam == null)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -9,11 +9,7 @@ internal static class Utils
|
||||||
{
|
{
|
||||||
internal static GameObject GetPlayerCameraObject(bool intoVR)
|
internal static GameObject GetPlayerCameraObject(bool intoVR)
|
||||||
{
|
{
|
||||||
if (intoVR)
|
return intoVR ? PlayerSetup.Instance.vrCamera : PlayerSetup.Instance.desktopCamera;
|
||||||
{
|
|
||||||
return PlayerSetup.Instance.vrCamera;
|
|
||||||
}
|
|
||||||
return PlayerSetup.Instance.desktopCamera;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void ClearLocalAvatar()
|
internal static void ClearLocalAvatar()
|
||||||
|
@ -27,10 +23,4 @@ internal static class Utils
|
||||||
DesktopVRSwitch.Logger.Msg("Attempting to reload current local avatar from GUID.");
|
DesktopVRSwitch.Logger.Msg("Attempting to reload current local avatar from GUID.");
|
||||||
AssetManagement.Instance.LoadLocalAvatar(MetaPort.Instance.currentAvatarGuid);
|
AssetManagement.Instance.LoadLocalAvatar(MetaPort.Instance.currentAvatarGuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool IsLocalAvatarLoaded()
|
|
||||||
{
|
|
||||||
return PlayerSetup.Instance._avatar != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,12 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace NAK.DesktopVRSwitch;
|
namespace NAK.DesktopVRSwitch;
|
||||||
|
|
||||||
class VRModeSwitchDebugger : MonoBehaviour
|
internal class VRModeSwitchDebugger : MonoBehaviour
|
||||||
{
|
{
|
||||||
Coroutine _switchCoroutine;
|
private Coroutine _switchCoroutine;
|
||||||
WaitForSeconds _sleep;
|
private WaitForSeconds _sleep;
|
||||||
|
|
||||||
void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
if (_switchCoroutine == null)
|
if (_switchCoroutine == null)
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@ class VRModeSwitchDebugger : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDisable()
|
private void OnDisable()
|
||||||
{
|
{
|
||||||
if (_switchCoroutine != null)
|
if (_switchCoroutine != null)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ class VRModeSwitchDebugger : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerator SwitchLoop()
|
private IEnumerator SwitchLoop()
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class VRModeSwitchManager : MonoBehaviour
|
||||||
public static event UnityAction<bool> OnPreVRModeSwitch;
|
public static event UnityAction<bool> OnPreVRModeSwitch;
|
||||||
public static event UnityAction<bool> OnPostVRModeSwitch;
|
public static event UnityAction<bool> OnPostVRModeSwitch;
|
||||||
public static event UnityAction<bool> OnFailVRModeSwitch;
|
public static event UnityAction<bool> OnFailVRModeSwitch;
|
||||||
const string XRSETTINGS_DEVICE = "OpenVR";
|
private const string XRSETTINGS_DEVICE = "OpenVR";
|
||||||
|
|
||||||
public static void RegisterVRModeTracker(VRModeTracker observer)
|
public static void RegisterVRModeTracker(VRModeTracker observer)
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ public class VRModeSwitchManager : MonoBehaviour
|
||||||
|
|
||||||
public bool SwitchInProgress { get; private set; }
|
public bool SwitchInProgress { get; private set; }
|
||||||
|
|
||||||
void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
if (Instance != null)
|
if (Instance != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
using ABI_RC.Core.Savior;
|
using ABI_RC.Core.Savior;
|
||||||
|
using ABI_RC.Systems.InputManagement;
|
||||||
|
using ABI_RC.Systems.InputManagement.InputModules;
|
||||||
|
|
||||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||||
|
|
||||||
|
@ -14,14 +16,17 @@ public class CVRInputManagerTracker : VRModeTracker
|
||||||
VRModeSwitchManager.OnPostVRModeSwitch -= OnPostSwitch;
|
VRModeSwitchManager.OnPostVRModeSwitch -= OnPostSwitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnPostSwitch(bool intoVR)
|
private void OnPostSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
DesktopVRSwitch.Logger.Msg("Resetting CVRInputManager inputs.");
|
DesktopVRSwitch.Logger.Msg("Resetting CVRInputManager inputs.");
|
||||||
|
|
||||||
CVRInputManager.Instance.inputEnabled = true;
|
CVRInputManager.Instance.inputEnabled = true;
|
||||||
|
|
||||||
|
// IM CRYING
|
||||||
|
CVRInputManager.Instance.reload = true;
|
||||||
|
|
||||||
//just in case
|
//just in case
|
||||||
CVRInputManager.Instance.blockedByUi = false;
|
CVRInputManager.Instance.textInputFocused = false;
|
||||||
//sometimes head can get stuck, so just in case
|
//sometimes head can get stuck, so just in case
|
||||||
CVRInputManager.Instance.independentHeadToggle = false;
|
CVRInputManager.Instance.independentHeadToggle = false;
|
||||||
//just nice to load into desktop with idle gesture
|
//just nice to load into desktop with idle gesture
|
||||||
|
@ -31,5 +36,12 @@ public class CVRInputManagerTracker : VRModeTracker
|
||||||
CVRInputManager.Instance.gestureRightRaw = 0f;
|
CVRInputManager.Instance.gestureRightRaw = 0f;
|
||||||
//turn off finger tracking input
|
//turn off finger tracking input
|
||||||
CVRInputManager.Instance.individualFingerTracking = false;
|
CVRInputManager.Instance.individualFingerTracking = false;
|
||||||
|
|
||||||
|
//add input module if you started in desktop
|
||||||
|
if (CVRInputManager._moduleXR == null)
|
||||||
|
CVRInputManager.Instance.AddInputModule(CVRInputManager._moduleXR = new CVRInputModule_XR());
|
||||||
|
|
||||||
|
//enable xr input or whatnot
|
||||||
|
CVRInputManager._moduleXR.InputEnabled = intoVR;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,12 +8,12 @@ public class CVRPickupObjectTracker : MonoBehaviour
|
||||||
internal CVRPickupObject _pickupObject;
|
internal CVRPickupObject _pickupObject;
|
||||||
internal Transform _storedGripOrigin;
|
internal Transform _storedGripOrigin;
|
||||||
|
|
||||||
void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
VRModeSwitchManager.OnPostVRModeSwitch += OnPostSwitch;
|
VRModeSwitchManager.OnPostVRModeSwitch += OnPostSwitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDestroy()
|
private void OnDestroy()
|
||||||
{
|
{
|
||||||
VRModeSwitchManager.OnPostVRModeSwitch -= OnPostSwitch;
|
VRModeSwitchManager.OnPostVRModeSwitch -= OnPostSwitch;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,15 @@ namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||||
|
|
||||||
public class CameraFacingObjectTracker : MonoBehaviour
|
public class CameraFacingObjectTracker : MonoBehaviour
|
||||||
{
|
{
|
||||||
CameraFacingObject _cameraFacingObject;
|
private CameraFacingObject _cameraFacingObject;
|
||||||
|
|
||||||
void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
_cameraFacingObject = GetComponent<CameraFacingObject>();
|
_cameraFacingObject = GetComponent<CameraFacingObject>();
|
||||||
VRModeSwitchManager.OnPostVRModeSwitch += OnPostSwitch;
|
VRModeSwitchManager.OnPostVRModeSwitch += OnPostSwitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnDestroy()
|
private void OnDestroy()
|
||||||
{
|
{
|
||||||
VRModeSwitchManager.OnPostVRModeSwitch -= OnPostSwitch;
|
VRModeSwitchManager.OnPostVRModeSwitch -= OnPostSwitch;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,10 @@ public class MovementSystemTracker : VRModeTracker
|
||||||
|
|
||||||
DesktopVRSwitch.Logger.Msg("Storing player world position and rotation.");
|
DesktopVRSwitch.Logger.Msg("Storing player world position and rotation.");
|
||||||
|
|
||||||
preSwitchWorldPosition = MovementSystem.Instance.rotationPivot.transform.position;
|
var pivotTransform = MovementSystem.Instance.rotationPivot.transform;
|
||||||
|
preSwitchWorldPosition = pivotTransform.position;
|
||||||
preSwitchWorldPosition.y = MovementSystem.Instance.transform.position.y;
|
preSwitchWorldPosition.y = MovementSystem.Instance.transform.position.y;
|
||||||
preSwitchWorldRotation = MovementSystem.Instance.rotationPivot.transform.rotation;
|
preSwitchWorldRotation = pivotTransform.rotation;
|
||||||
|
|
||||||
MovementSystem.Instance.ChangeCrouch(false);
|
MovementSystem.Instance.ChangeCrouch(false);
|
||||||
MovementSystem.Instance.ChangeProne(false);
|
MovementSystem.Instance.ChangeProne(false);
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
using ABI_RC.Core.Player;
|
|
||||||
|
|
||||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
|
||||||
|
|
||||||
public class VRTrackerManagerTracker : VRModeTracker
|
|
||||||
{
|
|
||||||
public override void TrackerInit()
|
|
||||||
{
|
|
||||||
VRModeSwitchManager.OnPostVRModeSwitch += OnPostSwitch;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void TrackerDestroy()
|
|
||||||
{
|
|
||||||
VRModeSwitchManager.OnPostVRModeSwitch -= OnPostSwitch;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnPostSwitch(bool intoVR)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Msg("Resetting VRTrackerManager.");
|
|
||||||
|
|
||||||
// VRTrackerManager will still get old Left/Right hand objects.
|
|
||||||
// This only breaks CVRGlobalParams1 reporting battry status
|
|
||||||
// MetaPort.Update
|
|
||||||
|
|
||||||
VRTrackerManager.Instance.poses = null;
|
|
||||||
VRTrackerManager.Instance.leftHand = null;
|
|
||||||
VRTrackerManager.Instance.rightHand = null;
|
|
||||||
VRTrackerManager.Instance.hasCheckedForKnuckles = false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -14,7 +14,7 @@ public class ViewManagerTracker : VRModeTracker
|
||||||
VRModeSwitchManager.OnPreVRModeSwitch -= OnPreSwitch;
|
VRModeSwitchManager.OnPreVRModeSwitch -= OnPreSwitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnPreSwitch(bool intoVR)
|
private void OnPreSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
DesktopVRSwitch.Logger.Msg("Closing ViewManager - Main Menu.");
|
DesktopVRSwitch.Logger.Msg("Closing ViewManager - Main Menu.");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue