mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39: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
|
@ -118,32 +118,6 @@ internal class CVRPickupObjectPatches
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class CohtmlUISystemPatches
|
|
||||||
{
|
|
||||||
[HarmonyPrefix]
|
|
||||||
[HarmonyPatch(typeof(UISystem), nameof(UISystem.RegisterGamepad), typeof(uint), typeof(string), typeof(uint), typeof(uint), typeof(IntPtr))]
|
|
||||||
[HarmonyPatch(typeof(UISystem), nameof(UISystem.RegisterGamepad), typeof(uint), typeof(string), typeof(uint), typeof(uint))]
|
|
||||||
[HarmonyPatch(typeof(UISystem), nameof(UISystem.UpdateGamepadState), typeof(cohtml.GamepadState))]
|
|
||||||
[HarmonyPatch(typeof(UISystem), nameof(UISystem.UpdateGamepadState), typeof(uint), typeof(float[]), typeof(float[]))]
|
|
||||||
[HarmonyPatch(typeof(UISystem), nameof(UISystem.UnregisterGamepad))]
|
|
||||||
[HarmonyPatch(typeof(UISystem), nameof(UISystem.UpdateGamepadStateExtended))]
|
|
||||||
private static bool Prefix_UISystem_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
|
|
||||||
|
|
||||||
it is not fixed you fucking piece of shit
|
|
||||||
**/
|
|
||||||
|
|
||||||
// dont
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal class SteamVRBehaviourPatches
|
internal class SteamVRBehaviourPatches
|
||||||
{
|
{
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
|
|
|
@ -26,9 +26,6 @@ public class DesktopVRSwitch : MelonMod
|
||||||
// post processing fixes
|
// post processing fixes
|
||||||
ApplyPatches(typeof(HarmonyPatches.CVRWorldPatches));
|
ApplyPatches(typeof(HarmonyPatches.CVRWorldPatches));
|
||||||
|
|
||||||
// fuck you
|
|
||||||
ApplyPatches(typeof(HarmonyPatches.CohtmlUISystemPatches));
|
|
||||||
|
|
||||||
// prevent steamvr behaviour from closing game
|
// prevent steamvr behaviour from closing game
|
||||||
ApplyPatches(typeof(HarmonyPatches.SteamVRBehaviourPatches));
|
ApplyPatches(typeof(HarmonyPatches.SteamVRBehaviourPatches));
|
||||||
|
|
||||||
|
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -25,13 +25,6 @@ public class CVRInputManagerTracker : VRModeTracker
|
||||||
|
|
||||||
// IM CRYING
|
// IM CRYING
|
||||||
//CVRInputManager.Instance.reload = true;
|
//CVRInputManager.Instance.reload = true;
|
||||||
|
|
||||||
// set to null so input manager doesnt attempt to access it
|
|
||||||
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;
|
|
||||||
|
|
||||||
// TODO: MOVE THIS TO DIFFERENT TRACKER
|
// TODO: MOVE THIS TO DIFFERENT TRACKER
|
||||||
RootLogic.Instance.ToggleMouse(args.IsUsingVr);
|
RootLogic.Instance.ToggleMouse(args.IsUsingVr);
|
||||||
|
@ -50,7 +43,18 @@ public class CVRInputManagerTracker : VRModeTracker
|
||||||
|
|
||||||
//add input module if you started in desktop
|
//add input module if you started in desktop
|
||||||
if (CVRInputManager._moduleXR == null)
|
if (CVRInputManager._moduleXR == null)
|
||||||
|
{
|
||||||
CVRInputManager.Instance.AddInputModule(CVRInputManager._moduleXR = new CVRInputModule_XR());
|
CVRInputManager.Instance.AddInputModule(CVRInputManager._moduleXR = new CVRInputModule_XR());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// set to null so input manager doesnt attempt to access it
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
//enable xr input or whatnot
|
//enable xr input or whatnot
|
||||||
CVRInputManager._moduleXR.InputEnabled = args.IsUsingVr;
|
CVRInputManager._moduleXR.InputEnabled = args.IsUsingVr;
|
||||||
|
|
|
@ -35,6 +35,7 @@ internal static class XRHandler
|
||||||
// Remove SteamVR behaviour & render
|
// Remove SteamVR behaviour & render
|
||||||
UnityEngine.Object.DestroyImmediate(SteamVR_Behaviour.instance.gameObject);
|
UnityEngine.Object.DestroyImmediate(SteamVR_Behaviour.instance.gameObject);
|
||||||
SteamVR.enabled = false; // disposes SteamVR
|
SteamVR.enabled = false; // disposes SteamVR
|
||||||
|
Patches.SteamVRNullReferencePatch.DestroySteamVRInstancesImmediate();
|
||||||
|
|
||||||
// Disable UnityXR
|
// Disable UnityXR
|
||||||
XRGeneralSettings.Instance.Manager.StopSubsystems();
|
XRGeneralSettings.Instance.Manager.StopSubsystems();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"_id": 103,
|
"_id": 103,
|
||||||
"name": "DesktopVRSwitch",
|
"name": "DesktopVRSwitch",
|
||||||
"modversion": "4.4.1",
|
"modversion": "4.4.1",
|
||||||
"gameversion": "2023r171",
|
"gameversion": "2023r172",
|
||||||
"loaderversion": "0.6.1",
|
"loaderversion": "0.6.1",
|
||||||
"modtype": "Mod",
|
"modtype": "Mod",
|
||||||
"author": "NotAKidoS",
|
"author": "NotAKidoS",
|
||||||
|
@ -18,6 +18,6 @@
|
||||||
],
|
],
|
||||||
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r20/DesktopVRSwitch.dll",
|
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r20/DesktopVRSwitch.dll",
|
||||||
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/DesktopVRSwitch/",
|
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/DesktopVRSwitch/",
|
||||||
"changelog": "- Fixes for 2023r171.",
|
"changelog": "- Fixes for 2023r172.\n- Mouse is now force unlocked once entering VR mode as QOL.",
|
||||||
"embedcolor": "3498db"
|
"embedcolor": "3498db"
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue