mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-21 19:51:33 +00:00
Fix crash on quest firmware v53
This commit is contained in:
parent
1764c82c59
commit
bde413658b
1 changed files with 24 additions and 9 deletions
|
@ -17,7 +17,7 @@ XrResult CheckXrResult(XrResult res, const char* originator) {
|
||||||
#define SIDE_COUNT 2
|
#define SIDE_COUNT 2
|
||||||
|
|
||||||
|
|
||||||
XrActionSet actionSet;
|
XrActionSet actionSet = nullptr;
|
||||||
XrAction grabAction;
|
XrAction grabAction;
|
||||||
XrAction poseAction;
|
XrAction poseAction;
|
||||||
XrAction vibrateAction;
|
XrAction vibrateAction;
|
||||||
|
@ -64,11 +64,13 @@ XrActionStateBoolean GetActionStateBoolean(XrAction action, int hand) {
|
||||||
XrActionStateGetInfo getInfo = {};
|
XrActionStateGetInfo getInfo = {};
|
||||||
getInfo.type = XR_TYPE_ACTION_STATE_GET_INFO;
|
getInfo.type = XR_TYPE_ACTION_STATE_GET_INFO;
|
||||||
getInfo.action = action;
|
getInfo.action = action;
|
||||||
|
getInfo.next = NULL;
|
||||||
if (hand >= 0)
|
if (hand >= 0)
|
||||||
getInfo.subactionPath = handSubactionPath[hand];
|
getInfo.subactionPath = handSubactionPath[hand];
|
||||||
|
|
||||||
XrActionStateBoolean state = {};
|
XrActionStateBoolean state = {};
|
||||||
state.type = XR_TYPE_ACTION_STATE_BOOLEAN;
|
state.type = XR_TYPE_ACTION_STATE_BOOLEAN;
|
||||||
|
state.next = NULL;
|
||||||
CHECK_XRCMD(xrGetActionStateBoolean(gAppState.Session, &getInfo, &state));
|
CHECK_XRCMD(xrGetActionStateBoolean(gAppState.Session, &getInfo, &state));
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -77,11 +79,13 @@ XrActionStateFloat GetActionStateFloat(XrAction action, int hand) {
|
||||||
XrActionStateGetInfo getInfo = {};
|
XrActionStateGetInfo getInfo = {};
|
||||||
getInfo.type = XR_TYPE_ACTION_STATE_GET_INFO;
|
getInfo.type = XR_TYPE_ACTION_STATE_GET_INFO;
|
||||||
getInfo.action = action;
|
getInfo.action = action;
|
||||||
|
getInfo.next = NULL;
|
||||||
if (hand >= 0)
|
if (hand >= 0)
|
||||||
getInfo.subactionPath = handSubactionPath[hand];
|
getInfo.subactionPath = handSubactionPath[hand];
|
||||||
|
|
||||||
XrActionStateFloat state = {};
|
XrActionStateFloat state = {};
|
||||||
state.type = XR_TYPE_ACTION_STATE_FLOAT;
|
state.type = XR_TYPE_ACTION_STATE_FLOAT;
|
||||||
|
state.next = NULL;
|
||||||
CHECK_XRCMD(xrGetActionStateFloat(gAppState.Session, &getInfo, &state));
|
CHECK_XRCMD(xrGetActionStateFloat(gAppState.Session, &getInfo, &state));
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -90,11 +94,13 @@ XrActionStateVector2f GetActionStateVector2(XrAction action, int hand) {
|
||||||
XrActionStateGetInfo getInfo = {};
|
XrActionStateGetInfo getInfo = {};
|
||||||
getInfo.type = XR_TYPE_ACTION_STATE_GET_INFO;
|
getInfo.type = XR_TYPE_ACTION_STATE_GET_INFO;
|
||||||
getInfo.action = action;
|
getInfo.action = action;
|
||||||
|
getInfo.next = NULL;
|
||||||
if (hand >= 0)
|
if (hand >= 0)
|
||||||
getInfo.subactionPath = handSubactionPath[hand];
|
getInfo.subactionPath = handSubactionPath[hand];
|
||||||
|
|
||||||
XrActionStateVector2f state = {};
|
XrActionStateVector2f state = {};
|
||||||
state.type = XR_TYPE_ACTION_STATE_VECTOR2F;
|
state.type = XR_TYPE_ACTION_STATE_VECTOR2F;
|
||||||
|
state.next = NULL;
|
||||||
CHECK_XRCMD(xrGetActionStateVector2f(gAppState.Session, &getInfo, &state));
|
CHECK_XRCMD(xrGetActionStateVector2f(gAppState.Session, &getInfo, &state));
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -132,6 +138,7 @@ void TBXR_InitActions( void )
|
||||||
strcpy(actionSetInfo.actionSetName, "gameplay");
|
strcpy(actionSetInfo.actionSetName, "gameplay");
|
||||||
strcpy(actionSetInfo.localizedActionSetName, "Gameplay");
|
strcpy(actionSetInfo.localizedActionSetName, "Gameplay");
|
||||||
actionSetInfo.priority = 0;
|
actionSetInfo.priority = 0;
|
||||||
|
actionSetInfo.next = NULL;
|
||||||
CHECK_XRCMD(xrCreateActionSet(gAppState.Instance, &actionSetInfo, &actionSet));
|
CHECK_XRCMD(xrCreateActionSet(gAppState.Instance, &actionSetInfo, &actionSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,6 +332,7 @@ void TBXR_InitActions( void )
|
||||||
suggestedBindings.interactionProfile = picoMixedRealityInteractionProfilePath;
|
suggestedBindings.interactionProfile = picoMixedRealityInteractionProfilePath;
|
||||||
suggestedBindings.suggestedBindings = bindings;
|
suggestedBindings.suggestedBindings = bindings;
|
||||||
suggestedBindings.countSuggestedBindings = currBinding;
|
suggestedBindings.countSuggestedBindings = currBinding;
|
||||||
|
suggestedBindings.next = NULL;
|
||||||
result = xrSuggestInteractionProfileBindings(gAppState.Instance, &suggestedBindings);
|
result = xrSuggestInteractionProfileBindings(gAppState.Instance, &suggestedBindings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,6 +384,7 @@ void TBXR_InitActions( void )
|
||||||
suggestedBindings.interactionProfile = touchControllerInteractionProfilePath;
|
suggestedBindings.interactionProfile = touchControllerInteractionProfilePath;
|
||||||
suggestedBindings.suggestedBindings = bindings;
|
suggestedBindings.suggestedBindings = bindings;
|
||||||
suggestedBindings.countSuggestedBindings = currBinding;
|
suggestedBindings.countSuggestedBindings = currBinding;
|
||||||
|
suggestedBindings.next = NULL;
|
||||||
result = xrSuggestInteractionProfileBindings(gAppState.Instance, &suggestedBindings);
|
result = xrSuggestInteractionProfileBindings(gAppState.Instance, &suggestedBindings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,25 +401,31 @@ void TBXR_InitActions( void )
|
||||||
actionSpaceInfo.subactionPath = handSubactionPath[SIDE_LEFT];
|
actionSpaceInfo.subactionPath = handSubactionPath[SIDE_LEFT];
|
||||||
CHECK_XRCMD(xrCreateActionSpace(gAppState.Session, &actionSpaceInfo, &aimSpace[SIDE_LEFT]));
|
CHECK_XRCMD(xrCreateActionSpace(gAppState.Session, &actionSpaceInfo, &aimSpace[SIDE_LEFT]));
|
||||||
actionSpaceInfo.subactionPath = handSubactionPath[SIDE_RIGHT];
|
actionSpaceInfo.subactionPath = handSubactionPath[SIDE_RIGHT];
|
||||||
|
actionSpaceInfo.next = NULL;
|
||||||
CHECK_XRCMD(xrCreateActionSpace(gAppState.Session, &actionSpaceInfo, &aimSpace[SIDE_RIGHT]));
|
CHECK_XRCMD(xrCreateActionSpace(gAppState.Session, &actionSpaceInfo, &aimSpace[SIDE_RIGHT]));
|
||||||
|
|
||||||
XrSessionActionSetsAttachInfo attachInfo = {};
|
XrSessionActionSetsAttachInfo attachInfo = {};
|
||||||
attachInfo.type = XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO;
|
attachInfo.type = XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO;
|
||||||
attachInfo.countActionSets = 1;
|
attachInfo.countActionSets = 1;
|
||||||
attachInfo.actionSets = &actionSet;
|
attachInfo.actionSets = &actionSet;
|
||||||
|
attachInfo.next = NULL;
|
||||||
CHECK_XRCMD(xrAttachSessionActionSets(gAppState.Session, &attachInfo));
|
CHECK_XRCMD(xrAttachSessionActionSets(gAppState.Session, &attachInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TBXR_SyncActions( void )
|
void TBXR_SyncActions( void )
|
||||||
{
|
{
|
||||||
XrActiveActionSet activeActionSet = {};
|
if (actionSet)
|
||||||
activeActionSet.actionSet = actionSet;
|
{
|
||||||
activeActionSet.subactionPath = XR_NULL_PATH;
|
XrActiveActionSet activeActionSet = {};
|
||||||
XrActionsSyncInfo syncInfo;
|
activeActionSet.actionSet = actionSet;
|
||||||
syncInfo.type = XR_TYPE_ACTIONS_SYNC_INFO;
|
activeActionSet.subactionPath = XR_NULL_PATH;
|
||||||
syncInfo.countActiveActionSets = 1;
|
XrActionsSyncInfo syncInfo;
|
||||||
syncInfo.activeActionSets = &activeActionSet;
|
syncInfo.type = XR_TYPE_ACTIONS_SYNC_INFO;
|
||||||
CHECK_XRCMD(xrSyncActions(gAppState.Session, &syncInfo));
|
syncInfo.countActiveActionSets = 1;
|
||||||
|
syncInfo.activeActionSets = &activeActionSet;
|
||||||
|
syncInfo.next = NULL;
|
||||||
|
CHECK_XRCMD(xrSyncActions(gAppState.Session, &syncInfo));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TBXR_UpdateControllers( )
|
void TBXR_UpdateControllers( )
|
||||||
|
|
Loading…
Reference in a new issue