Merge pull request #31 from FluffyJenkins/bug/BrokenAudioNoVR

Audio Failure Due to missing VR fix
This commit is contained in:
Thijs Wenker 2019-12-21 22:24:28 +01:00 committed by GitHub
commit b249f94528
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -108,9 +108,11 @@ QString getVrSettingString(const char* section, const char* setting) {
return result;
}
bool isHMDInErrorState = false;
vr::IVRSystem* acquireOpenVrSystem() {
bool hmdPresent = vr::VR_IsHmdPresent();
if (hmdPresent) {
if (hmdPresent && !isHMDInErrorState) {
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 == vr::VRInitError_Init_HmdNotFound) {
isHMDInErrorState = true;
activeHmd = nullptr;
#if DEV_BUILD
qCDebug(displayplugins) << "OpenVR: No HMD connected, setting nullptr!";
#endif
}
}
if (activeHmd) {
#if DEV_BUILD