From 7d402f4baeafa1ec1ee67858c53bec5b712bc6ca Mon Sep 17 00:00:00 2001 From: Fluffy Jenkins Date: Thu, 19 Dec 2019 23:19:05 +0000 Subject: [PATCH] Changed so it will fail to load VR straight away instead of trying so much it causes audio failures --- plugins/openvr/src/OpenVrHelpers.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/openvr/src/OpenVrHelpers.cpp b/plugins/openvr/src/OpenVrHelpers.cpp index 108431a8ac..f00b5d184f 100644 --- a/plugins/openvr/src/OpenVrHelpers.cpp +++ b/plugins/openvr/src/OpenVrHelpers.cpp @@ -108,9 +108,11 @@ QString getVrSettingString(const char* section, const char* setting) { return result; } +int headsetNotConnected = -1; + vr::IVRSystem* acquireOpenVrSystem() { bool hmdPresent = vr::VR_IsHmdPresent(); - if (hmdPresent) { + if (hmdPresent && (headsetNotConnected <= 0)) { Lock lock(mutex); if (!activeHmd) { #if DEV_BUILD @@ -122,6 +124,14 @@ vr::IVRSystem* acquireOpenVrSystem() { #if DEV_BUILD qCDebug(displayplugins) << "OpenVR display: HMD is " << activeHmd << " error is " << eError; #endif + + if (eError == 108) { // vr::HmdError_Init_HmdNotFound + headsetNotConnected = 1; + activeHmd = nullptr; + #if DEV_BUILD + qCDebug(displayplugins) << "OpenVR: No HMD connected, setting nullptr!"; + #endif + } } if (activeHmd) { #if DEV_BUILD