mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
[DesktopVRSwitch] WIP TEST set desktop graphic settings
This commit is contained in:
parent
0c6d2cabc9
commit
03514305be
3 changed files with 82 additions and 32 deletions
|
@ -11,39 +11,34 @@ using UnityEngine;
|
|||
|
||||
namespace NAK.DesktopVRSwitch.HarmonyPatches;
|
||||
|
||||
internal class PlayerSetupPatches
|
||||
class CheckVRPatches
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(PlayerSetup), "Start")]
|
||||
private static void Postfix_PlayerSetup_Start(ref PlayerSetup __instance)
|
||||
[HarmonyPatch(typeof(CheckVR), nameof(CheckVR.Start))]
|
||||
private static void Postfix_CheckVR_Start(ref CheckVR __instance)
|
||||
{
|
||||
if (CheckVR.Instance != null)
|
||||
{
|
||||
CheckVR.Instance.gameObject.AddComponent<DesktopVRSwitcher>();
|
||||
return;
|
||||
}
|
||||
__instance.gameObject.AddComponent<DesktopVRSwitcher>();
|
||||
DesktopVRSwitch.Logger.Error("CheckVR not found. Reverting to fallback method. This should never happen!");
|
||||
}
|
||||
}
|
||||
|
||||
internal class MovementSystemPatches
|
||||
class MovementSystemPatches
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(MovementSystem), "Start")]
|
||||
[HarmonyPatch(typeof(MovementSystem), nameof(MovementSystem.Start))]
|
||||
private static void Postfix_MovementSystem_Start(ref MovementSystem __instance)
|
||||
{
|
||||
__instance.gameObject.AddComponent<MovementSystemTracker>();
|
||||
}
|
||||
}
|
||||
|
||||
internal class CVRPickupObjectPatches
|
||||
class CVRPickupObjectPatches
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(CVRPickupObject), "Start")]
|
||||
[HarmonyPatch(typeof(CVRPickupObject), nameof(CVRPickupObject.Start))]
|
||||
private static void Prefix_CVRPickupObject_Start(ref CVRPickupObject __instance)
|
||||
{
|
||||
if (__instance.gripType == CVRPickupObject.GripType.Free) return;
|
||||
|
||||
Transform vrOrigin = __instance.gripOrigin;
|
||||
Transform desktopOrigin = __instance.gripOrigin.Find("[Desktop]");
|
||||
if (vrOrigin != null && desktopOrigin != null)
|
||||
|
@ -55,50 +50,51 @@ internal class CVRPickupObjectPatches
|
|||
}
|
||||
}
|
||||
|
||||
internal class CVRWorldPatches
|
||||
class CVRWorldPatches
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(CVRWorld), "SetDefaultCamValues")]
|
||||
private static void CVRWorld_SetDefaultCamValues_Postfix()
|
||||
[HarmonyPatch(typeof(CVRWorld), nameof(CVRWorld.SetDefaultCamValues))]
|
||||
private static void Postfix_CVRWorld_SetDefaultCamValues()
|
||||
{
|
||||
ReferenceCameraPatch.OnWorldLoad();
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(CVRWorld), "CopyRefCamValues")]
|
||||
private static void CVRWorld_CopyRefCamValues_Postfix()
|
||||
[HarmonyPatch(typeof(CVRWorld), nameof(CVRWorld.CopyRefCamValues))]
|
||||
private static void Postfix_CVRWorld_CopyRefCamValues()
|
||||
{
|
||||
ReferenceCameraPatch.OnWorldLoad();
|
||||
}
|
||||
}
|
||||
|
||||
internal class CameraFacingObjectPatches
|
||||
class CameraFacingObjectPatches
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(CameraFacingObject), "Start")]
|
||||
[HarmonyPatch(typeof(CameraFacingObject), nameof(CameraFacingObject.Start))]
|
||||
private static void Postfix_CameraFacingObject_Start(ref CameraFacingObject __instance)
|
||||
{
|
||||
__instance.gameObject.AddComponent<CameraFacingObjectTracker>();
|
||||
}
|
||||
}
|
||||
|
||||
internal class IKSystemPatches
|
||||
class IKSystemPatches
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(IKSystem), "Start")]
|
||||
[HarmonyPatch(typeof(IKSystem), nameof(IKSystem.Start))]
|
||||
private static void Postfix_IKSystem_Start(ref IKSystem __instance)
|
||||
{
|
||||
__instance.gameObject.AddComponent<IKSystemTracker>();
|
||||
}
|
||||
|
||||
[HarmonyPostfix] //lazy fix so i dont need to wait few frames
|
||||
[HarmonyPatch(typeof(TrackingPoint), "Initialize")]
|
||||
[HarmonyPatch(typeof(TrackingPoint), nameof(TrackingPoint.Initialize))]
|
||||
private static void Postfix_TrackingPoint_Initialize(ref TrackingPoint __instance)
|
||||
{
|
||||
__instance.referenceTransform.localScale = Vector3.one;
|
||||
}
|
||||
|
||||
[HarmonyPostfix] //lazy fix so device indecies can change properly
|
||||
[HarmonyPatch(typeof(SteamVRTrackingModule), "ModuleDestroy")]
|
||||
[HarmonyPatch(typeof(SteamVRTrackingModule), nameof(SteamVRTrackingModule.ModuleDestroy))]
|
||||
private static void Postfix_SteamVRTrackingModule_ModuleDestroy(ref SteamVRTrackingModule __instance)
|
||||
{
|
||||
for (int i = 0; i < __instance.TrackingPoints.Count; i++)
|
||||
|
@ -109,10 +105,10 @@ internal class IKSystemPatches
|
|||
}
|
||||
}
|
||||
|
||||
internal class VRTrackerManagerPatches
|
||||
class VRTrackerManagerPatches
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(VRTrackerManager), "Start")]
|
||||
[HarmonyPatch(typeof(VRTrackerManager), nameof(VRTrackerManager.Start))]
|
||||
private static void Postfix_VRTrackerManager_Start(ref VRTrackerManager __instance)
|
||||
{
|
||||
__instance.gameObject.AddComponent<VRTrackerManagerTracker>();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue