diff --git a/DesktopVRSwitch/DesktopVRSwitch.cs b/DesktopVRSwitch/DesktopVRSwitch.cs index 736bf0d..36ba8d9 100644 --- a/DesktopVRSwitch/DesktopVRSwitch.cs +++ b/DesktopVRSwitch/DesktopVRSwitch.cs @@ -8,7 +8,7 @@ namespace NAK.Melons.DesktopVRSwitch; public class DesktopVRSwitch : MonoBehaviour { - //Settings + //Debug Setting public bool _reloadLocalAvatar = true; //Internal Stuff @@ -120,6 +120,7 @@ public class DesktopVRSwitch : MonoBehaviour TryCatchHell.ResetCVRInputManager(); TryCatchHell.UpdateRichPresence(); TryCatchHell.UpdateGestureReconizerCam(); + TryCatchHell.UpdateMenuCoreData(isVR); //let tracked objects know we switched VRModeSwitchTracker.PostVRModeSwitch(isVR); diff --git a/DesktopVRSwitch/HarmonyPatches.cs b/DesktopVRSwitch/HarmonyPatches.cs index 93dad81..0b7b1e0 100644 --- a/DesktopVRSwitch/HarmonyPatches.cs +++ b/DesktopVRSwitch/HarmonyPatches.cs @@ -89,6 +89,13 @@ internal class IKSystemPatches { __instance.gameObject.AddComponent(); } + + [HarmonyPostfix] //lazy fix so i dont need to wait few frames + [HarmonyPatch(typeof(TrackingPoint), "Initialize")] + private static void Postfix_TrackingPoint_Initialize(ref TrackingPoint __instance) + { + __instance.referenceTransform.localScale = Vector3.one; + } } internal class VRTrackerManagerPatches diff --git a/DesktopVRSwitch/Main.cs b/DesktopVRSwitch/Main.cs index 5bf1280..d61ac90 100644 --- a/DesktopVRSwitch/Main.cs +++ b/DesktopVRSwitch/Main.cs @@ -18,13 +18,17 @@ namespace NAK.Melons.DesktopVRSwitch; public class DesktopVRSwitchMod : MelonMod { internal const string SettingsCategory = "DesktopVRSwitch"; - internal static MelonPreferences_Category m_categoryDesktopVRSwitch; + internal static MelonPreferences_Category mCategory; internal static MelonLogger.Instance Logger; + internal static MelonPreferences_Entry + mSetting_EnterCalibrationOnSwitch; + public override void OnInitializeMelon() { Logger = LoggerInstance; - m_categoryDesktopVRSwitch = MelonPreferences.CreateCategory(SettingsCategory); + mCategory = MelonPreferences.CreateCategory(SettingsCategory); + mSetting_EnterCalibrationOnSwitch = mCategory.CreateEntry("Enter Calibration on Switch", true, description: "Should you automatically be placed into calibration after switch if FBT is available? Overridden by Save Calibration IK setting."); ApplyPatches(typeof(HarmonyPatches.PlayerSetupPatches)); ApplyPatches(typeof(HarmonyPatches.CVRPickupObjectPatches)); diff --git a/DesktopVRSwitch/Patches/IKSystemTracker.cs b/DesktopVRSwitch/Patches/IKSystemTracker.cs index a8b9a22..583aa9b 100644 --- a/DesktopVRSwitch/Patches/IKSystemTracker.cs +++ b/DesktopVRSwitch/Patches/IKSystemTracker.cs @@ -45,7 +45,7 @@ public class IKSystemTracker : MonoBehaviour } //make it so you dont instantly end up in FBT from Desktop - IKSystem.firstAvatarLoaded = false; + IKSystem.firstAvatarLoaded = DesktopVRSwitchMod.mSetting_EnterCalibrationOnSwitch.Value; //turn of finger tracking just in case user switched controllers ikSystem.FingerSystem.controlActive = false; } diff --git a/DesktopVRSwitch/Patches/MovementSystemTracker.cs b/DesktopVRSwitch/Patches/MovementSystemTracker.cs index b20e249..cab5666 100644 --- a/DesktopVRSwitch/Patches/MovementSystemTracker.cs +++ b/DesktopVRSwitch/Patches/MovementSystemTracker.cs @@ -38,6 +38,8 @@ public class MovementSystemTracker : MonoBehaviour public void PostVRModeSwitch(bool isVR, Camera activeCamera) { + //immediatly update camera to new camera transform + movementSystem.rotationPivot = activeCamera.transform; //lazy way of correcting Desktop & VR offset issue (game does the maths) movementSystem.TeleportToPosRot(preSwitchWorldPosition, preSwitchWorldRotation, false); //recenter desktop collision to player object diff --git a/DesktopVRSwitch/Properties/AssemblyInfo.cs b/DesktopVRSwitch/Properties/AssemblyInfo.cs index 85baf86..bd527e7 100644 --- a/DesktopVRSwitch/Properties/AssemblyInfo.cs +++ b/DesktopVRSwitch/Properties/AssemblyInfo.cs @@ -20,11 +20,12 @@ using System.Reflection; [assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")] [assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)] +[assembly: MelonColor(ConsoleColor.DarkCyan)] [assembly: HarmonyDontPatchAll] namespace NAK.Melons.DesktopVRSwitch.Properties; internal static class AssemblyInfoParams { - public const string Version = "4.3.4"; + public const string Version = "4.3.5"; public const string Author = "NotAKidoS"; } \ No newline at end of file diff --git a/DesktopVRSwitch/TryCatchHell.cs b/DesktopVRSwitch/TryCatchHell.cs index effaf29..78f3f90 100644 --- a/DesktopVRSwitch/TryCatchHell.cs +++ b/DesktopVRSwitch/TryCatchHell.cs @@ -176,4 +176,14 @@ internal class TryCatchHell }, "Failed to update CVRGestureRecognizer camera."); } + + internal static void UpdateMenuCoreData(bool isVR) + { + TryCatchWrapper(() => + { + DesktopVRSwitchMod.Logger.Msg("Updating CVR_Menu_Data core data."); + CVR_MenuManager.Instance.coreData.core.inVr = isVR; + }, + "Failed to update CVR_Menu_Data core data."); + } } diff --git a/DesktopVRSwitch/format.json b/DesktopVRSwitch/format.json index 9d9566a..0373abd 100644 --- a/DesktopVRSwitch/format.json +++ b/DesktopVRSwitch/format.json @@ -1,7 +1,7 @@ { "_id": 103, "name": "DesktopVRSwitch", - "modversion": "4.3.4", + "modversion": "4.3.5", "gameversion": "2022r170", "loaderversion": "0.5.7", "modtype": "Mod", @@ -16,8 +16,8 @@ "requirements": [ "None" ], - "downloadlink": "https://github.com/NotAKidOnSteam/DesktopVRSwitch/releases/download/v4.3.4/DesktopVRSwitch.dll", + "downloadlink": "https://github.com/NotAKidOnSteam/DesktopVRSwitch/releases/download/v4.3.5/DesktopVRSwitch.dll", "sourcelink": "https://github.com/NotAKidOnSteam/DesktopVRSwitch/", - "changelog": "- Backported rewrite from Experimental & patched up to handle OpenVR.\n- Reinitialize SteamVR input on switch incase user restarted SteamVR or changed controllers. Correct fixedDeltaTime when entering Desktop.\n- Many tweaks to ensure everything in-game functions as expected.\n- Tweak to initial switch position for correcting offsets.", + "changelog": "- Reinitialize SteamVR input on switch. Correct fixedDeltaTime when entering Desktop.\n- Tweak to initial switch position for correcting offsets.\n- Fixed FBT tracking point initial size.\n- Update core menu data so QM Recalibrate/SeatedPlay button works.", "embedcolor": "3498db" } \ No newline at end of file