This commit is contained in:
NotAKidoS 2023-02-18 23:02:26 -06:00
parent 25c0b7cffe
commit 94abe14f0c
8 changed files with 33 additions and 8 deletions

View file

@ -8,7 +8,7 @@ namespace NAK.Melons.DesktopVRSwitch;
public class DesktopVRSwitch : MonoBehaviour public class DesktopVRSwitch : MonoBehaviour
{ {
//Settings //Debug Setting
public bool _reloadLocalAvatar = true; public bool _reloadLocalAvatar = true;
//Internal Stuff //Internal Stuff
@ -120,6 +120,7 @@ public class DesktopVRSwitch : MonoBehaviour
TryCatchHell.ResetCVRInputManager(); TryCatchHell.ResetCVRInputManager();
TryCatchHell.UpdateRichPresence(); TryCatchHell.UpdateRichPresence();
TryCatchHell.UpdateGestureReconizerCam(); TryCatchHell.UpdateGestureReconizerCam();
TryCatchHell.UpdateMenuCoreData(isVR);
//let tracked objects know we switched //let tracked objects know we switched
VRModeSwitchTracker.PostVRModeSwitch(isVR); VRModeSwitchTracker.PostVRModeSwitch(isVR);

View file

@ -89,6 +89,13 @@ internal class IKSystemPatches
{ {
__instance.gameObject.AddComponent<IKSystemTracker>(); __instance.gameObject.AddComponent<IKSystemTracker>();
} }
[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 internal class VRTrackerManagerPatches

View file

@ -18,13 +18,17 @@ namespace NAK.Melons.DesktopVRSwitch;
public class DesktopVRSwitchMod : MelonMod public class DesktopVRSwitchMod : MelonMod
{ {
internal const string SettingsCategory = "DesktopVRSwitch"; internal const string SettingsCategory = "DesktopVRSwitch";
internal static MelonPreferences_Category m_categoryDesktopVRSwitch; internal static MelonPreferences_Category mCategory;
internal static MelonLogger.Instance Logger; internal static MelonLogger.Instance Logger;
internal static MelonPreferences_Entry<bool>
mSetting_EnterCalibrationOnSwitch;
public override void OnInitializeMelon() public override void OnInitializeMelon()
{ {
Logger = LoggerInstance; Logger = LoggerInstance;
m_categoryDesktopVRSwitch = MelonPreferences.CreateCategory(SettingsCategory); mCategory = MelonPreferences.CreateCategory(SettingsCategory);
mSetting_EnterCalibrationOnSwitch = mCategory.CreateEntry<bool>("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.PlayerSetupPatches));
ApplyPatches(typeof(HarmonyPatches.CVRPickupObjectPatches)); ApplyPatches(typeof(HarmonyPatches.CVRPickupObjectPatches));

View file

@ -45,7 +45,7 @@ public class IKSystemTracker : MonoBehaviour
} }
//make it so you dont instantly end up in FBT from Desktop //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 //turn of finger tracking just in case user switched controllers
ikSystem.FingerSystem.controlActive = false; ikSystem.FingerSystem.controlActive = false;
} }

View file

@ -38,6 +38,8 @@ public class MovementSystemTracker : MonoBehaviour
public void PostVRModeSwitch(bool isVR, Camera activeCamera) 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) //lazy way of correcting Desktop & VR offset issue (game does the maths)
movementSystem.TeleportToPosRot(preSwitchWorldPosition, preSwitchWorldRotation, false); movementSystem.TeleportToPosRot(preSwitchWorldPosition, preSwitchWorldRotation, false);
//recenter desktop collision to player object //recenter desktop collision to player object

View file

@ -20,11 +20,12 @@ using System.Reflection;
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")] [assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)] [assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
[assembly: MelonColor(ConsoleColor.DarkCyan)]
[assembly: HarmonyDontPatchAll] [assembly: HarmonyDontPatchAll]
namespace NAK.Melons.DesktopVRSwitch.Properties; namespace NAK.Melons.DesktopVRSwitch.Properties;
internal static class AssemblyInfoParams internal static class AssemblyInfoParams
{ {
public const string Version = "4.3.4"; public const string Version = "4.3.5";
public const string Author = "NotAKidoS"; public const string Author = "NotAKidoS";
} }

View file

@ -176,4 +176,14 @@ internal class TryCatchHell
}, },
"Failed to update CVRGestureRecognizer camera."); "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.");
}
} }

View file

@ -1,7 +1,7 @@
{ {
"_id": 103, "_id": 103,
"name": "DesktopVRSwitch", "name": "DesktopVRSwitch",
"modversion": "4.3.4", "modversion": "4.3.5",
"gameversion": "2022r170", "gameversion": "2022r170",
"loaderversion": "0.5.7", "loaderversion": "0.5.7",
"modtype": "Mod", "modtype": "Mod",
@ -16,8 +16,8 @@
"requirements": [ "requirements": [
"None" "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/", "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" "embedcolor": "3498db"
} }