mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
[DesktopVRSwitch] Prevent SteamVR_Behaviour from closing game.
Was going to use my own event and switch before quit, but SteamVR_Behaviour was the one doing it the entire time. Very convenient for me.
This commit is contained in:
parent
52d4ef3279
commit
337134d2b5
3 changed files with 34 additions and 7 deletions
|
@ -8,6 +8,7 @@ using HarmonyLib;
|
|||
using NAK.DesktopVRSwitch.Patches;
|
||||
using NAK.DesktopVRSwitch.VRModeTrackers;
|
||||
using UnityEngine;
|
||||
using Valve.VR;
|
||||
|
||||
namespace NAK.DesktopVRSwitch.HarmonyPatches;
|
||||
|
||||
|
@ -110,4 +111,21 @@ class CohtmlUISystemPatches
|
|||
// dont
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class SteamVRBehaviourPatches
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(SteamVR_Behaviour), nameof(SteamVR_Behaviour.OnQuit))]
|
||||
static bool Prefix_SteamVR_Behaviour_OnQuit()
|
||||
{
|
||||
if (DesktopVRSwitch.EntrySwitchToDesktopOnExit.Value)
|
||||
{
|
||||
// If we don't switch fast enough, SteamVR will force close.
|
||||
// World Transition might cause issues. Might need to override.
|
||||
VRModeSwitchManager.Instance?.AttemptSwitch();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue