From ea3e5f702a26e80c3653d70a39a7c7853a8a3ef2 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Fri, 16 Dec 2016 13:44:06 -0800 Subject: [PATCH] add popping of messages for entitlement check --- plugins/oculus/src/OculusHelpers.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/plugins/oculus/src/OculusHelpers.cpp b/plugins/oculus/src/OculusHelpers.cpp index 8a160b67ff..7cdf5cfeef 100644 --- a/plugins/oculus/src/OculusHelpers.cpp +++ b/plugins/oculus/src/OculusHelpers.cpp @@ -15,6 +15,9 @@ #include #include +#define OVRPL_DISABLED +#include + #include #include #include @@ -27,6 +30,7 @@ static ovrSession session { nullptr }; static bool _quitRequested { false }; static bool _reorientRequested { false }; +static bool _entitlementCheckFailed { false }; inline ovrErrorInfo getError() { ovrErrorInfo error; @@ -125,6 +129,20 @@ void handleOVREvents() { return; } + // pop messages to see if we got a return for an entitlement check + while ((message = ovr_PopMessage()) != nullptr) { + switch (ovr_Message_GetType(message)) { + case ovrMessage_Entitlement_GetIsViewerEntitled: { + if (!ovr_Message_IsError(message)) { + // this viewer is entitled, no need to flag anything + } else { + // we failed the entitlement check, set our flag so the app can stop + _entitlementCheckFailed = true; + } + } + } + } + _quitRequested = status.ShouldQuit; _reorientRequested = status.ShouldRecenter; } @@ -217,4 +235,4 @@ controller::Pose ovrControllerPoseToHandPose( pose.velocity = toGlm(handPose.LinearVelocity); pose.valid = true; return pose; -} \ No newline at end of file +}