mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 14:59:23 +00:00
[DesktopVRSwitch] Add TryCatch to patches to appease Kafe.
This commit is contained in:
parent
900c6646af
commit
730a085850
1 changed files with 64 additions and 16 deletions
|
@ -17,9 +17,17 @@ class CheckVRPatches
|
|||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(CheckVR), nameof(CheckVR.Start))]
|
||||
static void Postfix_CheckVR_Start(ref CheckVR __instance)
|
||||
{
|
||||
try
|
||||
{
|
||||
__instance.gameObject.AddComponent<VRModeSwitchManager>();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DesktopVRSwitch.Logger.Error($"Error during the patched method {nameof(Postfix_CheckVR_Start)}");
|
||||
DesktopVRSwitch.Logger.Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class IKSystemPatches
|
||||
|
@ -27,13 +35,23 @@ class IKSystemPatches
|
|||
[HarmonyPostfix] //lazy fix so i dont need to wait few frames
|
||||
[HarmonyPatch(typeof(TrackingPoint), nameof(TrackingPoint.Initialize))]
|
||||
static void Postfix_TrackingPoint_Initialize(ref TrackingPoint __instance)
|
||||
{
|
||||
try
|
||||
{
|
||||
__instance.referenceTransform.localScale = Vector3.one;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DesktopVRSwitch.Logger.Error($"Error during the patched method {nameof(Postfix_TrackingPoint_Initialize)}");
|
||||
DesktopVRSwitch.Logger.Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPostfix] //lazy fix so device indecies can change properly
|
||||
[HarmonyPatch(typeof(SteamVRTrackingModule), nameof(SteamVRTrackingModule.ModuleDestroy))]
|
||||
static void Postfix_SteamVRTrackingModule_ModuleDestroy(ref SteamVRTrackingModule __instance)
|
||||
{
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < __instance.TrackingPoints.Count; i++)
|
||||
{
|
||||
|
@ -41,6 +59,12 @@ class IKSystemPatches
|
|||
}
|
||||
__instance.TrackingPoints.Clear();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DesktopVRSwitch.Logger.Error($"Error during the patched method {nameof(Postfix_SteamVRTrackingModule_ModuleDestroy)}");
|
||||
DesktopVRSwitch.Logger.Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CVRWorldPatches
|
||||
|
@ -49,9 +73,17 @@ class CVRWorldPatches
|
|||
[HarmonyPatch(typeof(CVRWorld), nameof(CVRWorld.SetDefaultCamValues))]
|
||||
[HarmonyPatch(typeof(CVRWorld), nameof(CVRWorld.CopyRefCamValues))]
|
||||
static void Postfix_CVRWorld_HandleCamValues()
|
||||
{
|
||||
try
|
||||
{
|
||||
ReferenceCameraPatch.OnWorldLoad();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DesktopVRSwitch.Logger.Error($"Error during the patched method {nameof(Postfix_CVRWorld_HandleCamValues)}");
|
||||
DesktopVRSwitch.Logger.Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CameraFacingObjectPatches
|
||||
|
@ -59,9 +91,17 @@ class CameraFacingObjectPatches
|
|||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(CameraFacingObject), nameof(CameraFacingObject.Start))]
|
||||
static void Postfix_CameraFacingObject_Start(ref CameraFacingObject __instance)
|
||||
{
|
||||
try
|
||||
{
|
||||
__instance.gameObject.AddComponent<CameraFacingObjectTracker>();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DesktopVRSwitch.Logger.Error($"Error during the patched method {nameof(Postfix_CameraFacingObject_Start)}");
|
||||
DesktopVRSwitch.Logger.Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CVRPickupObjectPatches
|
||||
|
@ -69,6 +109,8 @@ class CVRPickupObjectPatches
|
|||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(CVRPickupObject), nameof(CVRPickupObject.Start))]
|
||||
static void Prefix_CVRPickupObject_Start(ref CVRPickupObject __instance)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (__instance.gripType == CVRPickupObject.GripType.Free)
|
||||
return;
|
||||
|
@ -82,6 +124,12 @@ class CVRPickupObjectPatches
|
|||
tracker._storedGripOrigin = (!MetaPort.Instance.isUsingVr ? vrOrigin : desktopOrigin);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DesktopVRSwitch.Logger.Error($"Error during the patched method {nameof(Prefix_CVRPickupObject_Start)}");
|
||||
DesktopVRSwitch.Logger.Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CohtmlUISystemPatches
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue