mirror of
https://github.com/lubosz/overte.git
synced 2025-04-16 09:29:16 +02:00
only fire the entitlement check if OCULUS_APP_ID is set
This commit is contained in:
parent
ea3e5f702a
commit
b87a1b2b2b
2 changed files with 34 additions and 7 deletions
|
@ -11,6 +11,11 @@ if (WIN32)
|
|||
# we're using static GLEW, so define GLEW_STATIC
|
||||
add_definitions(-DGLEW_STATIC)
|
||||
|
||||
# if we were passed an Oculus App ID for entitlement checks, send that along
|
||||
if (DEFINED ENV{OCULUS_APP_ID})
|
||||
add_definitions(-DOCULUS_APP_ID="\\"$ENV{OCULUS_APP_ID}\\"")
|
||||
endif ()
|
||||
|
||||
set(TARGET_NAME oculus)
|
||||
setup_hifi_plugin(Multimedia)
|
||||
link_hifi_libraries(
|
||||
|
@ -18,7 +23,6 @@ if (WIN32)
|
|||
plugins ui-plugins display-plugins input-plugins
|
||||
audio-client networking render-utils
|
||||
)
|
||||
|
||||
include_hifi_library_headers(octree)
|
||||
|
||||
add_dependency_external_projects(LibOVR)
|
||||
|
|
|
@ -30,7 +30,6 @@ static ovrSession session { nullptr };
|
|||
|
||||
static bool _quitRequested { false };
|
||||
static bool _reorientRequested { false };
|
||||
static bool _entitlementCheckFailed { false };
|
||||
|
||||
inline ovrErrorInfo getError() {
|
||||
ovrErrorInfo error;
|
||||
|
@ -92,6 +91,18 @@ ovrSession acquireOculusSession() {
|
|||
logWarning("Failed to initialize Oculus SDK");
|
||||
return session;
|
||||
}
|
||||
|
||||
#ifdef OCULUS_APP_ID
|
||||
if (true) {
|
||||
if (ovr_PlatformInitializeWindows(OCULUS_APP_ID) != ovrPlatformInitialize_Success) {
|
||||
// we were unable to initialize the platform for entitlement check - fail the check
|
||||
_quitRequested = true;
|
||||
} else {
|
||||
qCDebug(oculus) << "Performing Oculus Platform entitlement check";
|
||||
ovr_Entitlement_GetIsViewerEntitled();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Q_ASSERT(0 == refCount);
|
||||
ovrGraphicsLuid luid;
|
||||
|
@ -129,22 +140,34 @@ void handleOVREvents() {
|
|||
return;
|
||||
}
|
||||
|
||||
_quitRequested = status.ShouldQuit;
|
||||
_reorientRequested = status.ShouldRecenter;
|
||||
|
||||
#ifdef OCULUS_APP_ID
|
||||
// pop messages to see if we got a return for an entitlement check
|
||||
while ((message = ovr_PopMessage()) != nullptr) {
|
||||
ovrMessageHandle message = ovr_PopMessage();
|
||||
|
||||
while (message) {
|
||||
switch (ovr_Message_GetType(message)) {
|
||||
case ovrMessage_Entitlement_GetIsViewerEntitled: {
|
||||
if (!ovr_Message_IsError(message)) {
|
||||
// this viewer is entitled, no need to flag anything
|
||||
qCDebug(oculus) << "Oculus Platform entitlement check succeeded, proceeding normally";
|
||||
} else {
|
||||
// we failed the entitlement check, set our flag so the app can stop
|
||||
_entitlementCheckFailed = true;
|
||||
qCDebug(oculus) << "Oculus Platform entitlement check failed, app will now quit" << OCULUS_APP_ID;
|
||||
_quitRequested = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_quitRequested = status.ShouldQuit;
|
||||
_reorientRequested = status.ShouldRecenter;
|
||||
// free the message handle to cleanup and not leak
|
||||
ovr_FreeMessage(message);
|
||||
|
||||
// pop the next message to check, if there is one
|
||||
message = ovr_PopMessage();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool quitRequested() {
|
||||
|
|
Loading…
Reference in a new issue