funky patch for FBT

This commit is contained in:
NotAKidoS 2023-02-21 04:23:55 -06:00
parent 94abe14f0c
commit 7e942d61cc
2 changed files with 16 additions and 1 deletions

View file

@ -8,8 +8,9 @@ namespace NAK.Melons.DesktopVRSwitch;
public class DesktopVRSwitch : MonoBehaviour public class DesktopVRSwitch : MonoBehaviour
{ {
//Debug Setting //Debug Settings
public bool _reloadLocalAvatar = true; public bool _reloadLocalAvatar = true;
public bool _softVRSwitch = false;
//Internal Stuff //Internal Stuff
private bool _switchInProgress = false; private bool _switchInProgress = false;
@ -91,6 +92,7 @@ public class DesktopVRSwitch : MonoBehaviour
//one frame after switch attempt //one frame after switch attempt
public void FailedVRModeSwitch(bool isVR) public void FailedVRModeSwitch(bool isVR)
{ {
if (_softVRSwitch) return;
//let tracked objects know a switch failed //let tracked objects know a switch failed
VRModeSwitchTracker.FailVRModeSwitch(isVR); VRModeSwitchTracker.FailVRModeSwitch(isVR);
} }
@ -98,6 +100,7 @@ public class DesktopVRSwitch : MonoBehaviour
//one frame before switch attempt //one frame before switch attempt
public void PreVRModeSwitch(bool isVR) public void PreVRModeSwitch(bool isVR)
{ {
if (_softVRSwitch) return;
//let tracked objects know we are attempting to switch //let tracked objects know we are attempting to switch
VRModeSwitchTracker.PreVRModeSwitch(isVR); VRModeSwitchTracker.PreVRModeSwitch(isVR);
} }
@ -105,6 +108,7 @@ public class DesktopVRSwitch : MonoBehaviour
//one frame after switch attempt //one frame after switch attempt
public void PostVRModeSwitch(bool isVR) public void PostVRModeSwitch(bool isVR)
{ {
if (_softVRSwitch) return;
//close the menus //close the menus
TryCatchHell.CloseCohtmlMenus(); TryCatchHell.CloseCohtmlMenus();

View file

@ -3,6 +3,7 @@ using ABI_RC.Core.Player;
using ABI_RC.Core.Savior; 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.MovementSystem; using ABI_RC.Systems.MovementSystem;
using HarmonyLib; using HarmonyLib;
using NAK.Melons.DesktopVRSwitch.Patches; using NAK.Melons.DesktopVRSwitch.Patches;
@ -96,6 +97,16 @@ internal class IKSystemPatches
{ {
__instance.referenceTransform.localScale = Vector3.one; __instance.referenceTransform.localScale = Vector3.one;
} }
[HarmonyPostfix] //lazy fix so device indecies can change properly
[HarmonyPatch(typeof(SteamVRTrackingModule), "ModuleDestroy")]
private static void Postfix_SteamVRTrackingModule_ModuleDestroy(ref SteamVRTrackingModule __instance)
{
for (int i = 0; i < __instance.TrackingPoints.Count; i++)
{
UnityEngine.Object.Destroy(__instance.TrackingPoints[i].referenceGameObject);
}
__instance.TrackingPoints.Clear();
}
} }
internal class VRTrackerManagerPatches internal class VRTrackerManagerPatches