mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
[DesktopVRSwitch] Stop being a baby.
???
This commit is contained in:
parent
133f5200b4
commit
6774c3ff6d
22 changed files with 205 additions and 169 deletions
2
ControllerFreeze/ControllerFreeze.csproj
Normal file
2
ControllerFreeze/ControllerFreeze.csproj
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk"/>
|
20
ControllerFreeze/HarmonyPatches.cs
Normal file
20
ControllerFreeze/HarmonyPatches.cs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
using ABI_RC.Core.Player;
|
||||||
|
using ABI_RC.Core.Savior;
|
||||||
|
using ABI_RC.Systems.IK.SubSystems;
|
||||||
|
using HarmonyLib;
|
||||||
|
|
||||||
|
namespace NAK.ControllerFreeze.HarmonyPatches;
|
||||||
|
|
||||||
|
class PlayerSetupPatches
|
||||||
|
{
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(PlayerSetup), nameof(PlayerSetup.Update))]
|
||||||
|
static void Postfix_PlayerSetup_Update()
|
||||||
|
{
|
||||||
|
if (MetaPort.Instance.isUsingVr)
|
||||||
|
{
|
||||||
|
BodySystem.TrackingLeftArmEnabled = true;
|
||||||
|
BodySystem.TrackingRightArmEnabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
ControllerFreeze/Main.cs
Normal file
24
ControllerFreeze/Main.cs
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
using MelonLoader;
|
||||||
|
|
||||||
|
namespace NAK.ControllerFreeze;
|
||||||
|
|
||||||
|
public class ControllerFreeze : MelonMod
|
||||||
|
{
|
||||||
|
public override void OnInitializeMelon()
|
||||||
|
{
|
||||||
|
ApplyPatches(typeof(HarmonyPatches.PlayerSetupPatches));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ApplyPatches(Type type)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HarmonyInstance.PatchAll(type);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LoggerInstance.Msg($"Failed while patching {type.Name}!");
|
||||||
|
LoggerInstance.Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
30
ControllerFreeze/Properties/AssemblyInfo.cs
Normal file
30
ControllerFreeze/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
using MelonLoader;
|
||||||
|
using NAK.ControllerFreeze.Properties;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
|
||||||
|
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
|
||||||
|
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
|
||||||
|
[assembly: AssemblyTitle(nameof(NAK.ControllerFreeze))]
|
||||||
|
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
|
||||||
|
[assembly: AssemblyProduct(nameof(NAK.ControllerFreeze))]
|
||||||
|
|
||||||
|
[assembly: MelonInfo(
|
||||||
|
typeof(NAK.ControllerFreeze.ControllerFreeze),
|
||||||
|
nameof(NAK.ControllerFreeze),
|
||||||
|
AssemblyInfoParams.Version,
|
||||||
|
AssemblyInfoParams.Author,
|
||||||
|
downloadLink: "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/ControllerFreeze"
|
||||||
|
)]
|
||||||
|
|
||||||
|
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
|
||||||
|
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||||
|
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||||
|
[assembly: HarmonyDontPatchAll]
|
||||||
|
|
||||||
|
namespace NAK.ControllerFreeze.Properties;
|
||||||
|
internal static class AssemblyInfoParams
|
||||||
|
{
|
||||||
|
public const string Version = "1.0.5";
|
||||||
|
public const string Author = "NotAKidoS";
|
||||||
|
}
|
16
ControllerFreeze/README.md
Normal file
16
ControllerFreeze/README.md
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# ControllerFreeze
|
||||||
|
|
||||||
|
This made no sense to dirty ControllerFreeze with, so it is now its own mod.
|
||||||
|
|
||||||
|
Prevents game disabling arm tracking when a controller is inactive.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Here is the block of text where I tell you this mod is not affiliated or endorsed by ABI.
|
||||||
|
https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
|
||||||
|
|
||||||
|
> This mod is an independent creation and is not affiliated with, supported by or approved by Alpha Blend Interactive.
|
||||||
|
|
||||||
|
> Use of this mod is done so at the user's own risk and the creator cannot be held responsible for any issues arising from its use.
|
||||||
|
|
||||||
|
> To the best of my knowledge, I have adhered to the Modding Guidelines established by Alpha Blend Interactive.
|
23
ControllerFreeze/format.json
Normal file
23
ControllerFreeze/format.json
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"_id": -1,
|
||||||
|
"name": "ControllerFreeze",
|
||||||
|
"modversion": "1.0.5",
|
||||||
|
"gameversion": "2022r170p1",
|
||||||
|
"loaderversion": "0.6.1",
|
||||||
|
"modtype": "Mod",
|
||||||
|
"author": "NotAKidoS",
|
||||||
|
"description": "Allows your controllers to track while the SteamVR overlay is open. This also fixes Quest/Touch controllers feeling slow during fast movements.\n\nSupport for SmoothRay & DesktopVRSwitch.",
|
||||||
|
"searchtags": [
|
||||||
|
"vr",
|
||||||
|
"quest",
|
||||||
|
"controller",
|
||||||
|
"tracking"
|
||||||
|
],
|
||||||
|
"requirements": [
|
||||||
|
"None"
|
||||||
|
],
|
||||||
|
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r9/ControllerFreeze.dll",
|
||||||
|
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/ControllerFreeze/",
|
||||||
|
"changelog": "Initial CVRMG Release",
|
||||||
|
"embedcolor": "3498db"
|
||||||
|
}
|
|
@ -75,9 +75,12 @@ public class VRModeSwitchManager : MonoBehaviour
|
||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
|
|
||||||
if (_useWorldTransition) // start visual transition and wait for it to complete
|
if (_useWorldTransition)
|
||||||
yield return WorldTransitionSystem.Instance.StartTransitionCoroutine();
|
{ // start visual transition and wait for it to complete
|
||||||
|
WorldTransitionSystem.Instance.StartTransition();
|
||||||
|
yield return new WaitForSeconds(WorldTransitionSystem.Instance.CurrentInLength);
|
||||||
|
}
|
||||||
|
|
||||||
// Check if OpenVR is running
|
// Check if OpenVR is running
|
||||||
bool isUsingVr = IsInVR();
|
bool isUsingVr = IsInVR();
|
||||||
|
|
||||||
|
@ -110,8 +113,11 @@ public class VRModeSwitchManager : MonoBehaviour
|
||||||
InvokeOnFailedSwitch(!isUsingVr);
|
InvokeOnFailedSwitch(!isUsingVr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_useWorldTransition) // finish the visual transition and wait
|
if (_useWorldTransition)
|
||||||
yield return WorldTransitionSystem.Instance.ContinueTransitionCoroutine();
|
{ // would be cool to have out length
|
||||||
|
WorldTransitionSystem.Instance.ContinueTransitionCoroutine();
|
||||||
|
yield return new WaitForSeconds(WorldTransitionSystem.Instance.CurrentInLength);
|
||||||
|
}
|
||||||
|
|
||||||
SwitchInProgress = false;
|
SwitchInProgress = false;
|
||||||
yield break;
|
yield break;
|
||||||
|
|
|
@ -17,14 +17,8 @@ public class CVRGestureRecognizerTracker : VRModeTracker
|
||||||
|
|
||||||
private void OnPostSwitch(bool intoVR)
|
private void OnPostSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
CVRGestureRecognizer _cvrGestureRecognizer = CVRGestureRecognizer.Instance;
|
|
||||||
if (_cvrGestureRecognizer == null)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Error("Error while getting CVRGestureRecognizer!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DesktopVRSwitch.Logger.Msg("Updating CVRGestureRecognizer _camera to active camera.");
|
DesktopVRSwitch.Logger.Msg("Updating CVRGestureRecognizer _camera to active camera.");
|
||||||
|
|
||||||
_cvrGestureRecognizer._camera = Utils.GetPlayerCameraObject(intoVR).GetComponent<Camera>();
|
CVRGestureRecognizer.Instance._camera = Utils.GetPlayerCameraObject(intoVR).GetComponent<Camera>();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,26 +17,20 @@ public class CVRInputManagerTracker : VRModeTracker
|
||||||
|
|
||||||
void OnPostSwitch(bool intoVR)
|
void OnPostSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
CVRInputManager _cvrInputManager = CVRInputManager.Instance;
|
|
||||||
if (_cvrInputManager == null)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Error("Error while getting CVRInputManager!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DesktopVRSwitch.Logger.Msg("Resetting CVRInputManager inputs.");
|
DesktopVRSwitch.Logger.Msg("Resetting CVRInputManager inputs.");
|
||||||
|
|
||||||
_cvrInputManager.inputEnabled = true;
|
CVRInputManager.Instance.inputEnabled = true;
|
||||||
|
|
||||||
//just in case
|
//just in case
|
||||||
_cvrInputManager.blockedByUi = false;
|
CVRInputManager.Instance.blockedByUi = false;
|
||||||
//sometimes head can get stuck, so just in case
|
//sometimes head can get stuck, so just in case
|
||||||
_cvrInputManager.independentHeadToggle = false;
|
CVRInputManager.Instance.independentHeadToggle = false;
|
||||||
//just nice to load into desktop with idle gesture
|
//just nice to load into desktop with idle gesture
|
||||||
_cvrInputManager.gestureLeft = 0f;
|
CVRInputManager.Instance.gestureLeft = 0f;
|
||||||
_cvrInputManager.gestureLeftRaw = 0f;
|
CVRInputManager.Instance.gestureLeftRaw = 0f;
|
||||||
_cvrInputManager.gestureRight = 0f;
|
CVRInputManager.Instance.gestureRight = 0f;
|
||||||
_cvrInputManager.gestureRightRaw = 0f;
|
CVRInputManager.Instance.gestureRightRaw = 0f;
|
||||||
//turn off finger tracking input
|
//turn off finger tracking input
|
||||||
_cvrInputManager.individualFingerTracking = false;
|
CVRInputManager.Instance.individualFingerTracking = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -19,30 +19,27 @@ public class CVRWorldTracker : VRModeTracker
|
||||||
|
|
||||||
private void OnPostSwitch(bool intoVR)
|
private void OnPostSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
CVRWorld _cvrWorld = CVRWorld.Instance;
|
|
||||||
if (_cvrWorld == null)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Error("Error while getting CVRWorld!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DesktopVRSwitch.Logger.Msg("Configuring CVRWorld. Updating PostProcessing & DesktopCameraController FOV settings.");
|
DesktopVRSwitch.Logger.Msg("Configuring CVRWorld. Updating PostProcessing & DesktopCameraController FOV settings.");
|
||||||
|
|
||||||
// some post processing settings aren't used in VR
|
// some post processing settings aren't used in VR
|
||||||
_cvrWorld.UpdatePostProcessing();
|
CVRWorld.Instance.UpdatePostProcessing();
|
||||||
UpdateCVRDesktopCameraController(_cvrWorld);
|
UpdateCVRDesktopCameraController();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateCVRDesktopCameraController(CVRWorld _cvrWorld)
|
private void UpdateCVRDesktopCameraController()
|
||||||
{
|
{
|
||||||
// Just making sure- Starting in VR will not call Start() as rig is disabled
|
// Just making sure- Starting in VR will not call Start() as rig is disabled
|
||||||
if (CVR_DesktopCameraController._cam == null)
|
if (CVR_DesktopCameraController._cam == null)
|
||||||
CVR_DesktopCameraController._cam = PlayerSetup.Instance.desktopCamera.GetComponent<Camera>();
|
CVR_DesktopCameraController._cam = PlayerSetup.Instance.desktopCamera.GetComponent<Camera>();
|
||||||
|
|
||||||
CVR_DesktopCameraController.defaultFov = Mathf.Clamp(_cvrWorld.fov, 60f, 120f);
|
CVR_DesktopCameraController.defaultFov = Mathf.Clamp(CVRWorld.Instance.fov, 60f, 120f);
|
||||||
CVR_DesktopCameraController.zoomFov = CVR_DesktopCameraController.defaultFov * 0.5f;
|
CVR_DesktopCameraController.zoomFov = CVR_DesktopCameraController.defaultFov * 0.5f;
|
||||||
CVR_DesktopCameraController.enableZoom = _cvrWorld.enableZoom;
|
CVR_DesktopCameraController.enableZoom = CVRWorld.Instance.enableZoom;
|
||||||
CVR_DesktopCameraController.UpdateFov(); // must happen after PlayerSetupTracker
|
|
||||||
CVR_MenuManager.Instance.coreData.instance.current_game_rule_no_zoom = !_cvrWorld.enableZoom;
|
// must happen after PlayerSetupTracker
|
||||||
|
CVR_DesktopCameraController.UpdateFov();
|
||||||
|
|
||||||
|
CVR_MenuManager.Instance.coreData.instance.current_game_rule_no_zoom = !CVRWorld.Instance.enableZoom;
|
||||||
|
|
||||||
// UICamera has a script that copies the FOV from the desktop cam.
|
// UICamera has a script that copies the FOV from the desktop cam.
|
||||||
// Toggling the cameras on/off resets the aspect ratio,
|
// Toggling the cameras on/off resets the aspect ratio,
|
||||||
|
|
|
@ -16,12 +16,6 @@ public class CVR_InteractableManagerTracker : VRModeTracker
|
||||||
|
|
||||||
private void OnPostSwitch(bool intoVR)
|
private void OnPostSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
CVR_InteractableManager _cvrInteractableManager = CVR_InteractableManager.Instance;
|
|
||||||
if (_cvrInteractableManager == null)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Error("Error while getting CVR_InteractableManager!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DesktopVRSwitch.Logger.Msg($"Setting CVRInputManager inputEnabled & CVR_InteractableManager enableInteractions to {!intoVR}");
|
DesktopVRSwitch.Logger.Msg($"Setting CVRInputManager inputEnabled & CVR_InteractableManager enableInteractions to {!intoVR}");
|
||||||
|
|
||||||
CVR_InteractableManager.enableInteractions = !intoVR;
|
CVR_InteractableManager.enableInteractions = !intoVR;
|
||||||
|
|
|
@ -18,27 +18,15 @@ public class CVR_MenuManagerTracker : VRModeTracker
|
||||||
|
|
||||||
private void OnPreSwitch(bool intoVR)
|
private void OnPreSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
CVR_MenuManager _cvrMenuManager = CVR_MenuManager.Instance;
|
|
||||||
if (_cvrMenuManager == null)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Error("Error while getting CVR_MenuManager!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DesktopVRSwitch.Logger.Msg("Closing CVR_MenuManager - Quick Menu.");
|
DesktopVRSwitch.Logger.Msg("Closing CVR_MenuManager - Quick Menu.");
|
||||||
|
|
||||||
_cvrMenuManager.ToggleQuickMenu(false);
|
CVR_MenuManager.Instance.ToggleQuickMenu(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPostSwitch(bool intoVR)
|
private void OnPostSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
CVR_MenuManager _cvrMenuManager = CVR_MenuManager.Instance;
|
|
||||||
if (_cvrMenuManager == null)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Error("Error while getting CVR_MenuManager!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DesktopVRSwitch.Logger.Msg("Updating CVR_Menu_Data core data.");
|
DesktopVRSwitch.Logger.Msg("Updating CVR_Menu_Data core data.");
|
||||||
|
|
||||||
_cvrMenuManager.coreData.core.inVr = intoVR;
|
CVR_MenuManager.Instance.coreData.core.inVr = intoVR;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,17 +18,11 @@ public class CohtmlHudTracker : VRModeTracker
|
||||||
|
|
||||||
private void OnPostSwitch(bool intoVR)
|
private void OnPostSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
CohtmlHud _cohtmlHud = CohtmlHud.Instance;
|
|
||||||
if (_cohtmlHud == null)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Error("Error while getting CohtmlHud!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DesktopVRSwitch.Logger.Msg("Configuring new hud affinity for CohtmlHud.");
|
DesktopVRSwitch.Logger.Msg("Configuring new hud affinity for CohtmlHud.");
|
||||||
|
|
||||||
_cohtmlHud.gameObject.transform.parent = Utils.GetPlayerCameraObject(intoVR).transform;
|
CohtmlHud.Instance.gameObject.transform.parent = Utils.GetPlayerCameraObject(intoVR).transform;
|
||||||
// This handles rotation and position
|
// This handles rotation and position
|
||||||
CVRTools.ConfigureHudAffinity();
|
CVRTools.ConfigureHudAffinity();
|
||||||
_cohtmlHud.gameObject.transform.localScale = new Vector3(1.2f, 1f, 1.2f);
|
CohtmlHud.Instance.gameObject.transform.localScale = new Vector3(1.2f, 1f, 1.2f);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,15 +16,9 @@ public class HudOperationsTracker : VRModeTracker
|
||||||
|
|
||||||
private void OnPostSwitch(bool intoVR)
|
private void OnPostSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
HudOperations _hudOperations = HudOperations.Instance;
|
|
||||||
if (_hudOperations == null)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Error("Error while getting HudOperations!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DesktopVRSwitch.Logger.Msg("Switching HudOperations worldLoadingItem & worldLoadStatus.");
|
DesktopVRSwitch.Logger.Msg("Switching HudOperations worldLoadingItem & worldLoadStatus.");
|
||||||
|
|
||||||
_hudOperations.worldLoadingItem = intoVR ? _hudOperations.worldLoadingItemVr : _hudOperations.worldLoadingItemDesktop;
|
HudOperations.Instance.worldLoadingItem = intoVR ? HudOperations.Instance.worldLoadingItemVr : HudOperations.Instance.worldLoadingItemDesktop;
|
||||||
_hudOperations.worldLoadStatus = intoVR ? _hudOperations.worldLoadStatusVr : _hudOperations.worldLoadStatusDesktop;
|
HudOperations.Instance.worldLoadStatus = intoVR ? HudOperations.Instance.worldLoadStatusVr : HudOperations.Instance.worldLoadStatusDesktop;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -52,13 +52,12 @@ public class IKSystemTracker : VRModeTracker
|
||||||
BodySystem.isCalibratedAsFullBody = false;
|
BodySystem.isCalibratedAsFullBody = false;
|
||||||
BodySystem.isCalibrating = false;
|
BodySystem.isCalibrating = false;
|
||||||
BodySystem.isRecalibration = false;
|
BodySystem.isRecalibration = false;
|
||||||
|
|
||||||
// Make it so you don't instantly end up in FBT from Desktop
|
// Make it so you don't instantly end up in FBT from Desktop
|
||||||
IKSystem.firstAvatarLoaded = DesktopVRSwitch.EntryEnterCalibrationOnSwitch.Value;
|
IKSystem.firstAvatarLoaded = DesktopVRSwitch.EntryEnterCalibrationOnSwitch.Value;
|
||||||
|
|
||||||
// Turn off finger tracking just in case the user switched controllers
|
// Turn off finger tracking just in case the user switched controllers
|
||||||
if (IKSystem.Instance != null)
|
IKSystem.Instance.FingerSystem.controlActive = false;
|
||||||
IKSystem.Instance.FingerSystem.controlActive = false;
|
|
||||||
|
|
||||||
SetupSteamVRTrackingModule(intoVR);
|
SetupSteamVRTrackingModule(intoVR);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,36 +19,30 @@ public class MetaPortTracker : VRModeTracker
|
||||||
|
|
||||||
private void OnPostSwitch(bool intoVR)
|
private void OnPostSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
MetaPort _metaPort = MetaPort.Instance;
|
|
||||||
if (_metaPort == null)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Error("Error while getting MetaPort!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DesktopVRSwitch.Logger.Msg($"Setting MetaPort isUsingVr to {intoVR}.");
|
DesktopVRSwitch.Logger.Msg($"Setting MetaPort isUsingVr to {intoVR}.");
|
||||||
|
|
||||||
// Main thing most of the game checks for if using VR
|
// Main thing most of the game checks for if using VR
|
||||||
_metaPort.isUsingVr = intoVR;
|
MetaPort.Instance.isUsingVr = intoVR;
|
||||||
|
|
||||||
// replace
|
// replace
|
||||||
UpdateRichPresence(_metaPort);
|
UpdateRichPresence();
|
||||||
ResetSteamVROverrides(intoVR);
|
ResetSteamVROverrides(intoVR);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateRichPresence(MetaPort _metaPort)
|
private void UpdateRichPresence()
|
||||||
{
|
{
|
||||||
// Hacky way of updating rich presence
|
// Hacky way of updating rich presence
|
||||||
if (_metaPort.settings.GetSettingsBool("ImplementationRichPresenceDiscordEnabled", true))
|
if (MetaPort.Instance.settings.GetSettingsBool("ImplementationRichPresenceDiscordEnabled", true))
|
||||||
{
|
{
|
||||||
DesktopVRSwitch.Logger.Msg("Forcing Discord Rich Presence update.");
|
DesktopVRSwitch.Logger.Msg("Forcing Discord Rich Presence update.");
|
||||||
_metaPort.settings.SetSettingsBool("ImplementationRichPresenceDiscordEnabled", false);
|
MetaPort.Instance.settings.SetSettingsBool("ImplementationRichPresenceDiscordEnabled", false);
|
||||||
_metaPort.settings.SetSettingsBool("ImplementationRichPresenceDiscordEnabled", true);
|
MetaPort.Instance.settings.SetSettingsBool("ImplementationRichPresenceDiscordEnabled", true);
|
||||||
}
|
}
|
||||||
if (_metaPort.settings.GetSettingsBool("ImplementationRichPresenceSteamEnabled", true))
|
if (MetaPort.Instance.settings.GetSettingsBool("ImplementationRichPresenceSteamEnabled", true))
|
||||||
{
|
{
|
||||||
DesktopVRSwitch.Logger.Msg("Forcing Steam Rich Presence update.");
|
DesktopVRSwitch.Logger.Msg("Forcing Steam Rich Presence update.");
|
||||||
_metaPort.settings.SetSettingsBool("ImplementationRichPresenceSteamEnabled", false);
|
MetaPort.Instance.settings.SetSettingsBool("ImplementationRichPresenceSteamEnabled", false);
|
||||||
_metaPort.settings.SetSettingsBool("ImplementationRichPresenceSteamEnabled", true);
|
MetaPort.Instance.settings.SetSettingsBool("ImplementationRichPresenceSteamEnabled", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,41 +23,26 @@ public class MovementSystemTracker : VRModeTracker
|
||||||
VRModeSwitchManager.OnPostVRModeSwitch -= OnPostSwitch;
|
VRModeSwitchManager.OnPostVRModeSwitch -= OnPostSwitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
// why do i do this
|
|
||||||
private MovementSystem GetMovementSystemInstance()
|
|
||||||
{
|
|
||||||
MovementSystem _movementSystem = MovementSystem.Instance;
|
|
||||||
if (_movementSystem == null)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Error("Error while getting MovementSystem!");
|
|
||||||
}
|
|
||||||
return _movementSystem;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnPreSwitch(bool intoVR)
|
private void OnPreSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
MovementSystem _movementSystem = GetMovementSystemInstance();
|
|
||||||
if (_movementSystem != null)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Msg("Storing player world position and rotation.");
|
|
||||||
preSwitchWorldPosition = _movementSystem.rotationPivot.transform.position;
|
|
||||||
preSwitchWorldPosition.y = _movementSystem.transform.position.y;
|
|
||||||
preSwitchWorldRotation = _movementSystem.rotationPivot.transform.rotation;
|
|
||||||
|
|
||||||
_movementSystem.ChangeCrouch(false);
|
DesktopVRSwitch.Logger.Msg("Storing player world position and rotation.");
|
||||||
_movementSystem.ChangeProne(false);
|
|
||||||
_movementSystem.SetImmobilized(true);
|
preSwitchWorldPosition = MovementSystem.Instance.rotationPivot.transform.position;
|
||||||
}
|
preSwitchWorldPosition.y = MovementSystem.Instance.transform.position.y;
|
||||||
|
preSwitchWorldRotation = MovementSystem.Instance.rotationPivot.transform.rotation;
|
||||||
|
|
||||||
|
MovementSystem.Instance.ChangeCrouch(false);
|
||||||
|
MovementSystem.Instance.ChangeProne(false);
|
||||||
|
MovementSystem.Instance.SetImmobilized(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnFailedSwitch(bool intoVR)
|
private void OnFailedSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
MovementSystem _movementSystem = GetMovementSystemInstance();
|
DesktopVRSwitch.Logger.Msg("Resetting MovementSystem mobility.");
|
||||||
if (_movementSystem != null)
|
|
||||||
{
|
MovementSystem.Instance.SetImmobilized(false);
|
||||||
DesktopVRSwitch.Logger.Msg("Resetting MovementSystem mobility.");
|
|
||||||
_movementSystem.SetImmobilized(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPostSwitch(bool intoVR)
|
private void OnPostSwitch(bool intoVR)
|
||||||
|
@ -65,27 +50,23 @@ public class MovementSystemTracker : VRModeTracker
|
||||||
// Lazy
|
// Lazy
|
||||||
MelonLoader.MelonCoroutines.Start(TeleportFrameAfter(intoVR));
|
MelonLoader.MelonCoroutines.Start(TeleportFrameAfter(intoVR));
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator TeleportFrameAfter(bool intoVR)
|
private IEnumerator TeleportFrameAfter(bool intoVR)
|
||||||
{
|
{
|
||||||
yield return null; // need to wait a frame
|
yield return null; // need to wait a frame
|
||||||
|
|
||||||
MovementSystem _movementSystem = GetMovementSystemInstance();
|
DesktopVRSwitch.Logger.Msg("Resetting MovementSystem mobility and applying stored position and rotation.");
|
||||||
if (_movementSystem != null)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Msg("Resetting MovementSystem mobility and applying stored position and rotation.");
|
|
||||||
|
|
||||||
_movementSystem.rotationPivot = Utils.GetPlayerCameraObject(intoVR).transform;
|
MovementSystem.Instance.rotationPivot = Utils.GetPlayerCameraObject(intoVR).transform;
|
||||||
_movementSystem.TeleportToPosRot(preSwitchWorldPosition, preSwitchWorldRotation, false);
|
MovementSystem.Instance.TeleportToPosRot(preSwitchWorldPosition, preSwitchWorldRotation, false);
|
||||||
|
|
||||||
if (!intoVR)
|
if (!intoVR)
|
||||||
_movementSystem.UpdateColliderCenter(_movementSystem.transform.position);
|
MovementSystem.Instance.UpdateColliderCenter(MovementSystem.Instance.transform.position);
|
||||||
|
|
||||||
_movementSystem.ChangeCrouch(false);
|
|
||||||
_movementSystem.ChangeProne(false);
|
|
||||||
_movementSystem.SetImmobilized(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
MovementSystem.Instance.ChangeCrouch(false);
|
||||||
|
MovementSystem.Instance.ChangeProne(false);
|
||||||
|
MovementSystem.Instance.SetImmobilized(false);
|
||||||
|
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,15 +16,9 @@ public class PlayerSetupTracker : VRModeTracker
|
||||||
|
|
||||||
private void OnPostSwitch(bool intoVR)
|
private void OnPostSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
PlayerSetup _playerSetup = PlayerSetup.Instance;
|
|
||||||
if (_playerSetup == null)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Error("Error while getting PlayerSetup!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DesktopVRSwitch.Logger.Msg("Switching active PlayerSetup camera rigs. Updating Desktop camera FOV.");
|
DesktopVRSwitch.Logger.Msg("Switching active PlayerSetup camera rigs. Updating Desktop camera FOV.");
|
||||||
|
|
||||||
_playerSetup.desktopCameraRig.SetActive(!intoVR);
|
PlayerSetup.Instance.desktopCameraRig.SetActive(!intoVR);
|
||||||
_playerSetup.vrCameraRig.SetActive(intoVR);
|
PlayerSetup.Instance.vrCameraRig.SetActive(intoVR);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,16 +16,10 @@ public class PortableCameraTracker : VRModeTracker
|
||||||
|
|
||||||
private void OnPostSwitch(bool intoVR)
|
private void OnPostSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
PortableCamera _portableCamera = PortableCamera.Instance;
|
|
||||||
if (_portableCamera == null)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Error("Error while getting PortableCamera!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DesktopVRSwitch.Logger.Msg("Forcing PortableCamera canvas mirroring off.");
|
DesktopVRSwitch.Logger.Msg("Forcing PortableCamera canvas mirroring off.");
|
||||||
|
|
||||||
// Tell the game we are in mirror mode so it'll disable it (if enabled)
|
// Tell the game we are in mirror mode so it'll disable it (if enabled)
|
||||||
_portableCamera.mode = MirroringMode.Mirror;
|
PortableCamera.Instance.mode = MirroringMode.Mirror;
|
||||||
_portableCamera.ChangeMirroring();
|
PortableCamera.Instance.ChangeMirroring();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,17 +16,15 @@ public class VRTrackerManagerTracker : VRModeTracker
|
||||||
|
|
||||||
private void OnPostSwitch(bool intoVR)
|
private void OnPostSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
VRTrackerManager _vrTrackerManager = VRTrackerManager.Instance;
|
|
||||||
if (_vrTrackerManager == null)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Error("Error while getting VRTrackerManager!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DesktopVRSwitch.Logger.Msg("Resetting VRTrackerManager.");
|
DesktopVRSwitch.Logger.Msg("Resetting VRTrackerManager.");
|
||||||
|
|
||||||
_vrTrackerManager.poses = null;
|
// VRTrackerManager will still get old Left/Right hand objects.
|
||||||
_vrTrackerManager.leftHand = null;
|
// This only breaks CVRGlobalParams1 reporting battry status
|
||||||
_vrTrackerManager.rightHand = null;
|
// MetaPort.Update
|
||||||
_vrTrackerManager.hasCheckedForKnuckles = false;
|
|
||||||
|
VRTrackerManager.Instance.poses = null;
|
||||||
|
VRTrackerManager.Instance.leftHand = null;
|
||||||
|
VRTrackerManager.Instance.rightHand = null;
|
||||||
|
VRTrackerManager.Instance.hasCheckedForKnuckles = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,14 +16,8 @@ public class ViewManagerTracker : VRModeTracker
|
||||||
|
|
||||||
public void OnPreSwitch(bool intoVR)
|
public void OnPreSwitch(bool intoVR)
|
||||||
{
|
{
|
||||||
ViewManager _viewManager = ViewManager.Instance;
|
|
||||||
if (_viewManager == null)
|
|
||||||
{
|
|
||||||
DesktopVRSwitch.Logger.Error("Error while getting ViewManager!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
DesktopVRSwitch.Logger.Msg("Closing ViewManager - Main Menu.");
|
DesktopVRSwitch.Logger.Msg("Closing ViewManager - Main Menu.");
|
||||||
|
|
||||||
_viewManager.UiStateToggle(false);
|
ViewManager.Instance.UiStateToggle(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -63,6 +63,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HeadBobbingFix", "HeadBobbi
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClickToMove", "ClickToMove\ClickToMove.csproj", "{8D392BEE-E959-4906-A2A7-5EB9E3AE4D00}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClickToMove", "ClickToMove\ClickToMove.csproj", "{8D392BEE-E959-4906-A2A7-5EB9E3AE4D00}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControllerFreeze", "ControllerFreeze\ControllerFreeze.csproj", "{ADAAC4FB-D78B-4FD2-B23A-EA6AF6B0B4A5}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -189,6 +191,10 @@ Global
|
||||||
{8D392BEE-E959-4906-A2A7-5EB9E3AE4D00}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{8D392BEE-E959-4906-A2A7-5EB9E3AE4D00}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{8D392BEE-E959-4906-A2A7-5EB9E3AE4D00}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{8D392BEE-E959-4906-A2A7-5EB9E3AE4D00}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{8D392BEE-E959-4906-A2A7-5EB9E3AE4D00}.Release|Any CPU.Build.0 = Release|Any CPU
|
{8D392BEE-E959-4906-A2A7-5EB9E3AE4D00}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{ADAAC4FB-D78B-4FD2-B23A-EA6AF6B0B4A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{ADAAC4FB-D78B-4FD2-B23A-EA6AF6B0B4A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{ADAAC4FB-D78B-4FD2-B23A-EA6AF6B0B4A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{ADAAC4FB-D78B-4FD2-B23A-EA6AF6B0B4A5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue