mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
Move many mods to Deprecated folder, fix spelling
This commit is contained in:
parent
5e822cec8d
commit
0042590aa6
539 changed files with 7475 additions and 3120 deletions
|
@ -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;
|
||||
}
|
||||
}
|
103
.Deprecated/DesktopVRSwitch/Patches/ReferenceCameraPatch.cs
Normal file
103
.Deprecated/DesktopVRSwitch/Patches/ReferenceCameraPatch.cs
Normal file
|
@ -0,0 +1,103 @@
|
|||
using ABI_RC.Core.Base;
|
||||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core.Savior;
|
||||
using Aura2API;
|
||||
using BeautifyEffect;
|
||||
using UnityEngine;
|
||||
using UnityEngine.AzureSky;
|
||||
using UnityEngine.Rendering.PostProcessing;
|
||||
|
||||
namespace NAK.DesktopVRSwitch.Patches;
|
||||
|
||||
internal static class ReferenceCameraPatch
|
||||
{
|
||||
public static void OnWorldLoad()
|
||||
{
|
||||
Camera activeCamera = (MetaPort.Instance.isUsingVr ? PlayerSetup.Instance.vrCamera : PlayerSetup.Instance.desktopCamera).GetComponent<Camera>();
|
||||
Camera inactiveCamera = (MetaPort.Instance.isUsingVr ? PlayerSetup.Instance.desktopCamera : PlayerSetup.Instance.vrCamera).GetComponent<Camera>();
|
||||
CopyToInactiveCam(activeCamera, inactiveCamera);
|
||||
}
|
||||
|
||||
private static void CopyToInactiveCam(Camera activeCam, Camera inactiveCam)
|
||||
{
|
||||
if (inactiveCam == null || activeCam == null)
|
||||
return;
|
||||
|
||||
DesktopVRSwitch.Logger.Msg("Copying active camera settings & components to inactive camera.");
|
||||
|
||||
// Copy basic settings
|
||||
inactiveCam.farClipPlane = activeCam.farClipPlane;
|
||||
inactiveCam.nearClipPlane = activeCam.nearClipPlane;
|
||||
inactiveCam.depthTextureMode = activeCam.depthTextureMode;
|
||||
|
||||
// We cant copy this because we set it to 0 with ThirdPerson
|
||||
var cullingMask = inactiveCam.cullingMask;
|
||||
cullingMask &= -32769;
|
||||
cullingMask |= 256;
|
||||
cullingMask |= 512;
|
||||
cullingMask |= 32;
|
||||
cullingMask &= -4097;
|
||||
cullingMask |= 1024;
|
||||
cullingMask |= 8192;
|
||||
inactiveCam.cullingMask = cullingMask;
|
||||
|
||||
// Copy post processing if added
|
||||
PostProcessLayer ppLayerActiveCam = activeCam.GetComponent<PostProcessLayer>();
|
||||
PostProcessLayer ppLayerInactiveCam = inactiveCam.AddComponentIfMissing<PostProcessLayer>();
|
||||
if (ppLayerActiveCam != null && ppLayerInactiveCam != null)
|
||||
{
|
||||
ppLayerInactiveCam.enabled = ppLayerActiveCam.enabled;
|
||||
ppLayerInactiveCam.volumeLayer = ppLayerActiveCam.volumeLayer;
|
||||
}
|
||||
|
||||
// Copy Aura camera settings
|
||||
AuraCamera auraActiveCam = activeCam.GetComponent<AuraCamera>();
|
||||
AuraCamera auraInactiveCam = inactiveCam.AddComponentIfMissing<AuraCamera>();
|
||||
if (auraActiveCam != null && auraInactiveCam != null)
|
||||
{
|
||||
auraInactiveCam.enabled = auraActiveCam.enabled;
|
||||
auraInactiveCam.frustumSettings = auraActiveCam.frustumSettings;
|
||||
}
|
||||
else
|
||||
{
|
||||
auraInactiveCam.enabled = false;
|
||||
}
|
||||
|
||||
// Copy Flare layer settings
|
||||
FlareLayer flareActiveCam = activeCam.GetComponent<FlareLayer>();
|
||||
FlareLayer flareInactiveCam = inactiveCam.AddComponentIfMissing<FlareLayer>();
|
||||
if (flareActiveCam != null && flareInactiveCam != null)
|
||||
{
|
||||
flareInactiveCam.enabled = flareActiveCam.enabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
flareInactiveCam.enabled = false;
|
||||
}
|
||||
|
||||
// Copy Azure Fog Scattering settings
|
||||
AzureFogScattering azureFogActiveCam = activeCam.GetComponent<AzureFogScattering>();
|
||||
AzureFogScattering azureFogInactiveCam = inactiveCam.AddComponentIfMissing<AzureFogScattering>();
|
||||
if (azureFogActiveCam != null && azureFogInactiveCam != null)
|
||||
{
|
||||
azureFogInactiveCam.fogScatteringMaterial = azureFogActiveCam.fogScatteringMaterial;
|
||||
}
|
||||
else
|
||||
{
|
||||
UnityEngine.Object.Destroy(inactiveCam.GetComponent<AzureFogScattering>());
|
||||
}
|
||||
|
||||
// Copy Beautify settings
|
||||
Beautify beautifyActiveCam = activeCam.GetComponent<Beautify>();
|
||||
Beautify beautifyInactiveCam = inactiveCam.AddComponentIfMissing<Beautify>();
|
||||
if (beautifyActiveCam != null && beautifyInactiveCam != null)
|
||||
{
|
||||
beautifyInactiveCam.quality = beautifyActiveCam.quality;
|
||||
beautifyInactiveCam.profile = beautifyActiveCam.profile;
|
||||
}
|
||||
else
|
||||
{
|
||||
UnityEngine.Object.Destroy(inactiveCam.gameObject.GetComponent<Beautify>());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue