Only enable the Oculus plugin in the presence of the 1.x runtime

This commit is contained in:
Brad Davis 2016-03-28 12:00:40 -07:00
parent d056c41e25
commit bd9813bbf5
3 changed files with 16 additions and 3 deletions

View file

@ -28,7 +28,7 @@ protected:
void internalDeactivate() override;
protected:
ovrSession _session;
ovrSession _session { nullptr };
ovrGraphicsLuid _luid;
ovrEyeRenderDesc _eyeRenderDescs[2];
ovrFovPort _eyeFovs[2];

View file

@ -42,7 +42,6 @@ private:
friend class OculusControllerManager;
};
// Waiting on touch API
class RemoteDevice : public OculusInputDevice {
public:
using Pointer = std::shared_ptr<RemoteDevice>;

View file

@ -9,7 +9,9 @@
#include "OculusHelpers.h"
#include <atomic>
#include <QtCore/QLoggingCategory>
#include <QtCore/QFile>
using Mutex = std::mutex;
using Lock = std::unique_lock<Mutex>;
@ -38,9 +40,21 @@ void logFatal(const char* what) {
qFatal(error.c_str());
}
static const QString GOOD_OCULUS_RUNTIME_FILE { "C:\\Program Files(x86)\\Oculus\\Support\\oculus - runtime\\LibOVRRT64_1.dll" };
bool oculusAvailable() {
ovrDetectResult detect = ovr_Detect(0);
return (detect.IsOculusServiceRunning && detect.IsOculusHMDConnected);
if (!detect.IsOculusServiceRunning || !detect.IsOculusHMDConnected) {
return false;
}
// HACK Explicitly check for the presence of the 1.0 runtime DLL, and fail if it
// doesn't exist
if (!QFile(GOOD_OCULUS_RUNTIME_FILE).exists()) {
return false;
}
return true;
}
ovrSession acquireOculusSession() {