mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
st/oxr: Return identifier name for bindings
This commit is contained in:
parent
b6786f5bfc
commit
4a62e88f09
|
@ -147,6 +147,7 @@ interaction_profile_find_or_create(struct oxr_logger *log,
|
|||
struct oxr_binding *b = &p->bindings[x];
|
||||
|
||||
b->sub_path = t->sub_path;
|
||||
b->localized_name = t->localized_name;
|
||||
setup_paths(log, inst, t, b);
|
||||
setup_inputs(log, inst, t, b);
|
||||
setup_outputs(log, inst, t, b);
|
||||
|
@ -226,26 +227,6 @@ add_string(char *temp, size_t max, ssize_t *current, const char *str)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
add_path_string(struct oxr_logger *log,
|
||||
struct oxr_instance *inst,
|
||||
XrPath path,
|
||||
char *temp,
|
||||
size_t max,
|
||||
ssize_t *current)
|
||||
{
|
||||
const char *str = NULL;
|
||||
size_t length = 0;
|
||||
XrResult ret;
|
||||
|
||||
ret = oxr_path_get_string(log, inst, path, &str, &length);
|
||||
if (ret != XR_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_string(temp, max, current, str);
|
||||
}
|
||||
|
||||
static bool
|
||||
get_sub_path_from_path(struct oxr_logger *log,
|
||||
struct oxr_instance *inst,
|
||||
|
@ -307,6 +288,38 @@ get_interaction_bound_to_sub_path(struct oxr_session *sess,
|
|||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_identifier_str_in_profile(struct oxr_logger *log,
|
||||
struct oxr_instance *inst,
|
||||
XrPath path,
|
||||
struct oxr_interaction_profile *oip)
|
||||
{
|
||||
const char *str = NULL;
|
||||
size_t length = 0;
|
||||
XrResult ret;
|
||||
|
||||
ret = oxr_path_get_string(log, inst, path, &str, &length);
|
||||
if (ret != XR_SUCCESS) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < oip->num_bindings; i++) {
|
||||
struct oxr_binding *binding = &oip->bindings[i];
|
||||
|
||||
for (size_t k = 0; k < binding->num_paths; k++) {
|
||||
if (binding->paths[k] != path) {
|
||||
continue;
|
||||
}
|
||||
str = binding->localized_name;
|
||||
i = oip->num_bindings; // Break the outer loop as well.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* 'Exported' functions.
|
||||
|
@ -551,8 +564,13 @@ oxr_action_get_input_source_localized_name(
|
|||
//! @todo This implementation is very very very ugly.
|
||||
if ((getInfo->whichComponents &
|
||||
XR_INPUT_SOURCE_LOCALIZED_NAME_COMPONENT_BIT) != 0) {
|
||||
add_path_string(log, sess->sys->inst, getInfo->sourcePath, temp,
|
||||
ARRAY_SIZE(temp), ¤t);
|
||||
/*
|
||||
* The above enum is miss-named it should be called identifier
|
||||
* instead of component.
|
||||
*/
|
||||
add_string(temp, sizeof(temp), ¤t,
|
||||
get_identifier_str_in_profile(
|
||||
log, sess->sys->inst, getInfo->sourcePath, oip));
|
||||
}
|
||||
|
||||
OXR_TWO_CALL_HELPER(log, bufferCapacityInput, bufferCountOutput, buffer,
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
struct binding_template
|
||||
{
|
||||
enum oxr_sub_action_path sub_path;
|
||||
|
||||
const char *localized_name;
|
||||
|
||||
const char *paths[8];
|
||||
enum xrt_input_name inputs[8];
|
||||
enum xrt_output_name outputs[8];
|
||||
|
@ -49,6 +52,7 @@ struct profile_template
|
|||
static struct binding_template khr_simple_controller_bindings[10] = {
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Select",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/select/click",
|
||||
|
@ -67,6 +71,7 @@ static struct binding_template khr_simple_controller_bindings[10] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Menu",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/menu/click",
|
||||
|
@ -85,6 +90,7 @@ static struct binding_template khr_simple_controller_bindings[10] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Grip",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/grip/pose",
|
||||
|
@ -103,6 +109,7 @@ static struct binding_template khr_simple_controller_bindings[10] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Aim",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/aim/pose",
|
||||
|
@ -121,6 +128,7 @@ static struct binding_template khr_simple_controller_bindings[10] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Haptic",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/output/haptic",
|
||||
|
@ -136,6 +144,7 @@ static struct binding_template khr_simple_controller_bindings[10] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Select",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/select/click",
|
||||
|
@ -154,6 +163,7 @@ static struct binding_template khr_simple_controller_bindings[10] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Menu",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/menu/click",
|
||||
|
@ -172,6 +182,7 @@ static struct binding_template khr_simple_controller_bindings[10] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Grip",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/grip/pose",
|
||||
|
@ -190,6 +201,7 @@ static struct binding_template khr_simple_controller_bindings[10] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Aim",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/aim/pose",
|
||||
|
@ -208,6 +220,7 @@ static struct binding_template khr_simple_controller_bindings[10] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Haptic",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/output/haptic",
|
||||
|
@ -237,6 +250,7 @@ static struct binding_template khr_simple_controller_bindings[10] = {
|
|||
static struct binding_template google_daydream_controller_bindings[12] = {
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Select",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/select/click",
|
||||
|
@ -255,6 +269,7 @@ static struct binding_template google_daydream_controller_bindings[12] = {
|
|||
{
|
||||
//! @todo Flag that this is a trackpad
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Trackpad",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/trackpad",
|
||||
|
@ -269,6 +284,7 @@ static struct binding_template google_daydream_controller_bindings[12] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Trackpad Click",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/trackpad/click",
|
||||
|
@ -282,6 +298,7 @@ static struct binding_template google_daydream_controller_bindings[12] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Trackpad Touch",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/trackpad/touch",
|
||||
|
@ -294,6 +311,7 @@ static struct binding_template google_daydream_controller_bindings[12] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Grip",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/grip/pose",
|
||||
|
@ -311,6 +329,7 @@ static struct binding_template google_daydream_controller_bindings[12] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Aim",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/aim/pose",
|
||||
|
@ -328,6 +347,7 @@ static struct binding_template google_daydream_controller_bindings[12] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Select",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/select/click",
|
||||
|
@ -345,7 +365,7 @@ static struct binding_template google_daydream_controller_bindings[12] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
//! @todo Flag that this is a trackpad
|
||||
.localized_name = "Trackpad",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/trackpad",
|
||||
|
@ -360,6 +380,7 @@ static struct binding_template google_daydream_controller_bindings[12] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Trackpad Click",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/trackpad/click",
|
||||
|
@ -373,6 +394,7 @@ static struct binding_template google_daydream_controller_bindings[12] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Trackpad Touch",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/trackpad/touch",
|
||||
|
@ -385,6 +407,7 @@ static struct binding_template google_daydream_controller_bindings[12] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Grip",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/grip/pose",
|
||||
|
@ -402,6 +425,7 @@ static struct binding_template google_daydream_controller_bindings[12] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Aim",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/aim/pose",
|
||||
|
@ -433,6 +457,7 @@ static struct binding_template google_daydream_controller_bindings[12] = {
|
|||
static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "PS™ Logo",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/system/click",
|
||||
|
@ -447,6 +472,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Move™ Logo",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/menu/click",
|
||||
|
@ -461,6 +487,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Start/Options",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/start/click",
|
||||
|
@ -475,6 +502,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Select",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/select/click",
|
||||
|
@ -489,6 +517,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Square™",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/square_mndx/click",
|
||||
|
@ -503,6 +532,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Cross™",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/cross_mndx/click",
|
||||
|
@ -517,6 +547,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Circle™",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/circle_mndx/click",
|
||||
|
@ -531,6 +562,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Trinangle™",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/triangle_mndx/click",
|
||||
|
@ -545,6 +577,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Trigger",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/trigger/value",
|
||||
|
@ -559,6 +592,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Grip",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/grip/pose",
|
||||
|
@ -573,6 +607,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Ball",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/ball_mndx/pose",
|
||||
|
@ -587,6 +622,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Aim",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/input/aim/pose",
|
||||
|
@ -601,6 +637,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT,
|
||||
.localized_name = "Haptic",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/left/output/haptic",
|
||||
|
@ -614,6 +651,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "PS™ Logo",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/system/click",
|
||||
|
@ -628,6 +666,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Move™ Logo",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/menu/click",
|
||||
|
@ -642,6 +681,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Start/Options",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/start/click",
|
||||
|
@ -656,6 +696,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Select",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/select/click",
|
||||
|
@ -670,6 +711,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Square™",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/square_mndx/click",
|
||||
|
@ -684,6 +726,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Cross™",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/cross_mndx/click",
|
||||
|
@ -698,6 +741,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Circle™",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/circle_mndx/click",
|
||||
|
@ -712,6 +756,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Triangle™",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/triangle_mndx/click",
|
||||
|
@ -726,6 +771,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Trigger",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/trigger/value",
|
||||
|
@ -740,6 +786,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Grip",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/grip/pose",
|
||||
|
@ -754,6 +801,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Ball",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/ball_mndx/pose",
|
||||
|
@ -768,6 +816,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Aim",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/input/aim/pose",
|
||||
|
@ -782,6 +831,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
{
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT,
|
||||
.localized_name = "Haptic",
|
||||
.paths =
|
||||
{
|
||||
"/user/hand/right/output/haptic",
|
||||
|
@ -796,9 +846,10 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
};
|
||||
|
||||
|
||||
#define MAKE_INPUT(COMPONENT, SUFFIX, INPUT) \
|
||||
#define MAKE_INPUT(COMPONENT, NAME, SUFFIX, INPUT) \
|
||||
{ \
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT, \
|
||||
.localized_name = NAME, \
|
||||
.paths = \
|
||||
{ \
|
||||
"/user/hand/left/input/" #COMPONENT "/" #SUFFIX, \
|
||||
|
@ -813,6 +864,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
}, \
|
||||
{ \
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT, \
|
||||
.localized_name = NAME, \
|
||||
.paths = \
|
||||
{ \
|
||||
"/user/hand/right/input/" #COMPONENT "/" #SUFFIX, \
|
||||
|
@ -828,9 +880,10 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
|
||||
// creates an input that can not be "downgraded" to the top level path.
|
||||
// e.g. don't bind ../trackpad/click, ../trackpad/touch with just ../trackpad
|
||||
#define MAKE_INPUT_SUFFIX_ONLY(COMPONENT, SUFFIX, INPUT) \
|
||||
#define MAKE_INPUT_SUFFIX_ONLY(COMPONENT, NAME, SUFFIX, INPUT) \
|
||||
{ \
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT, \
|
||||
.localized_name = NAME, \
|
||||
.paths = \
|
||||
{ \
|
||||
"/user/hand/left/input/" #COMPONENT "/" #SUFFIX, \
|
||||
|
@ -844,6 +897,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
}, \
|
||||
{ \
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT, \
|
||||
.localized_name = NAME, \
|
||||
.paths = \
|
||||
{ \
|
||||
"/user/hand/right/input/" #COMPONENT "/" #SUFFIX, \
|
||||
|
@ -857,9 +911,10 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
},
|
||||
|
||||
// creates an input with a top level path and /x and /y sub paths
|
||||
#define MAKE_INPUT_VEC2F(COMPONENT, INPUT) \
|
||||
#define MAKE_INPUT_VEC2F(COMPONENT, NAME, INPUT) \
|
||||
{ \
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT, \
|
||||
.localized_name = NAME, \
|
||||
.paths = \
|
||||
{ \
|
||||
"/user/hand/left/input/" #COMPONENT, \
|
||||
|
@ -875,6 +930,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
}, \
|
||||
{ \
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT, \
|
||||
.localized_name = NAME, \
|
||||
.paths = \
|
||||
{ \
|
||||
"/user/hand/right/input/" #COMPONENT, \
|
||||
|
@ -889,9 +945,10 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
}, \
|
||||
},
|
||||
|
||||
#define MAKE_OUTPUT(COMPONENT, OUTPUT) \
|
||||
#define MAKE_OUTPUT(COMPONENT, NAME, OUTPUT) \
|
||||
{ \
|
||||
.sub_path = OXR_SUB_ACTION_PATH_LEFT, \
|
||||
.localized_name = NAME, \
|
||||
.paths = \
|
||||
{ \
|
||||
"/user/hand/left/output/" #COMPONENT, \
|
||||
|
@ -905,6 +962,7 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
}, \
|
||||
{ \
|
||||
.sub_path = OXR_SUB_ACTION_PATH_RIGHT, \
|
||||
.localized_name = NAME, \
|
||||
.paths = \
|
||||
{ \
|
||||
"/user/hand/right/output/" #COMPONENT, \
|
||||
|
@ -919,44 +977,44 @@ static struct binding_template mndx_ball_on_a_stick_controller_bindings[26] = {
|
|||
|
||||
static struct binding_template valve_index_controller_bindings[44] = {
|
||||
// clang-format off
|
||||
MAKE_INPUT(system, click, XRT_INPUT_INDEX_SYSTEM_CLICK)
|
||||
MAKE_INPUT(system, touch, XRT_INPUT_INDEX_SYSTEM_TOUCH)
|
||||
MAKE_INPUT(a, click, XRT_INPUT_INDEX_A_CLICK)
|
||||
MAKE_INPUT(a, touch, XRT_INPUT_INDEX_A_TOUCH)
|
||||
MAKE_INPUT(b, click, XRT_INPUT_INDEX_B_CLICK)
|
||||
MAKE_INPUT(b, touch, XRT_INPUT_INDEX_B_TOUCH)
|
||||
MAKE_INPUT(squeeze, value, XRT_INPUT_INDEX_SQUEEZE_VALUE)
|
||||
MAKE_INPUT(squeeze, force, XRT_INPUT_INDEX_SQUEEZE_FORCE)
|
||||
MAKE_INPUT(trigger, click, XRT_INPUT_INDEX_TRIGGER_CLICK)
|
||||
MAKE_INPUT(trigger, value, XRT_INPUT_INDEX_TRIGGER_VALUE)
|
||||
MAKE_INPUT(trigger, touch, XRT_INPUT_INDEX_TRIGGER_TOUCH)
|
||||
MAKE_INPUT_VEC2F(thumbstick, XRT_INPUT_INDEX_THUMBSTICK)
|
||||
MAKE_INPUT_SUFFIX_ONLY(thumbstick, click, XRT_INPUT_INDEX_THUMBSTICK_CLICK)
|
||||
MAKE_INPUT_SUFFIX_ONLY(thumbstick, touch, XRT_INPUT_INDEX_THUMBSTICK_TOUCH)
|
||||
MAKE_INPUT_VEC2F(trackpad, XRT_INPUT_INDEX_TRACKPAD)
|
||||
MAKE_INPUT_SUFFIX_ONLY(trackpad, force, XRT_INPUT_INDEX_TRACKPAD_FORCE)
|
||||
MAKE_INPUT_SUFFIX_ONLY(trackpad, touch, XRT_INPUT_INDEX_TRACKPAD_TOUCH)
|
||||
MAKE_INPUT(grip, pose, XRT_INPUT_INDEX_GRIP_POSE)
|
||||
MAKE_INPUT(aim, pose, XRT_INPUT_INDEX_AIM_POSE)
|
||||
MAKE_INPUT(system, "System", click, XRT_INPUT_INDEX_SYSTEM_CLICK)
|
||||
MAKE_INPUT(system, "System Touch", touch, XRT_INPUT_INDEX_SYSTEM_TOUCH)
|
||||
MAKE_INPUT(a, "A", click, XRT_INPUT_INDEX_A_CLICK)
|
||||
MAKE_INPUT(a, "A Touch", touch, XRT_INPUT_INDEX_A_TOUCH)
|
||||
MAKE_INPUT(b, "B", click, XRT_INPUT_INDEX_B_CLICK)
|
||||
MAKE_INPUT(b, "B Touch", touch, XRT_INPUT_INDEX_B_TOUCH)
|
||||
MAKE_INPUT(squeeze, "Side-Squeeze", value, XRT_INPUT_INDEX_SQUEEZE_VALUE)
|
||||
MAKE_INPUT(squeeze, "Side-Squeeze Force", force, XRT_INPUT_INDEX_SQUEEZE_FORCE)
|
||||
MAKE_INPUT(trigger, "Trigger Click", click, XRT_INPUT_INDEX_TRIGGER_CLICK)
|
||||
MAKE_INPUT(trigger, "Trigger", value, XRT_INPUT_INDEX_TRIGGER_VALUE)
|
||||
MAKE_INPUT(trigger, "Trigger Touch", touch, XRT_INPUT_INDEX_TRIGGER_TOUCH)
|
||||
MAKE_INPUT_VEC2F(thumbstick, "Thumbstick", XRT_INPUT_INDEX_THUMBSTICK)
|
||||
MAKE_INPUT_SUFFIX_ONLY(thumbstick, "Thumbstick Click", click, XRT_INPUT_INDEX_THUMBSTICK_CLICK)
|
||||
MAKE_INPUT_SUFFIX_ONLY(thumbstick, "Thumbstick Touch", touch, XRT_INPUT_INDEX_THUMBSTICK_TOUCH)
|
||||
MAKE_INPUT_VEC2F(trackpad, "Trackpad", XRT_INPUT_INDEX_TRACKPAD)
|
||||
MAKE_INPUT_SUFFIX_ONLY(trackpad, "Trackpad Force", force, XRT_INPUT_INDEX_TRACKPAD_FORCE)
|
||||
MAKE_INPUT_SUFFIX_ONLY(trackpad, "Trackpad Touch", touch, XRT_INPUT_INDEX_TRACKPAD_TOUCH)
|
||||
MAKE_INPUT(grip, "Grip", pose, XRT_INPUT_INDEX_GRIP_POSE)
|
||||
MAKE_INPUT(aim, "Aim", pose, XRT_INPUT_INDEX_AIM_POSE)
|
||||
|
||||
MAKE_OUTPUT(haptic, XRT_OUTPUT_NAME_INDEX_HAPTIC)
|
||||
MAKE_OUTPUT(haptic, "Haptic", XRT_OUTPUT_NAME_INDEX_HAPTIC)
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
static struct binding_template htc_vive_controller_bindings[24] = {
|
||||
// clang-format off
|
||||
MAKE_INPUT(system, click, XRT_INPUT_VIVE_SYSTEM_CLICK)
|
||||
MAKE_INPUT(squeeze, click, XRT_INPUT_VIVE_SQUEEZE_CLICK)
|
||||
MAKE_INPUT(menu, click, XRT_INPUT_VIVE_MENU_CLICK)
|
||||
MAKE_INPUT(trigger, click, XRT_INPUT_VIVE_TRIGGER_CLICK)
|
||||
MAKE_INPUT(trigger, value, XRT_INPUT_VIVE_TRIGGER_VALUE)
|
||||
MAKE_INPUT_VEC2F(trackpad, XRT_INPUT_VIVE_TRACKPAD)
|
||||
MAKE_INPUT_SUFFIX_ONLY(trackpad, click, XRT_INPUT_VIVE_TRACKPAD_CLICK)
|
||||
MAKE_INPUT_SUFFIX_ONLY(trackpad, touch, XRT_INPUT_VIVE_TRACKPAD_TOUCH)
|
||||
MAKE_INPUT(grip, pose, XRT_INPUT_VIVE_GRIP_POSE)
|
||||
MAKE_INPUT(aim, pose, XRT_INPUT_VIVE_AIM_POSE)
|
||||
MAKE_INPUT(system, "System", click, XRT_INPUT_VIVE_SYSTEM_CLICK)
|
||||
MAKE_INPUT(squeeze, "Side-Squeeze", click, XRT_INPUT_VIVE_SQUEEZE_CLICK)
|
||||
MAKE_INPUT(menu, "Menu", click, XRT_INPUT_VIVE_MENU_CLICK)
|
||||
MAKE_INPUT(trigger, "Trigger Click", click, XRT_INPUT_VIVE_TRIGGER_CLICK)
|
||||
MAKE_INPUT(trigger, "Trigger", value, XRT_INPUT_VIVE_TRIGGER_VALUE)
|
||||
MAKE_INPUT_VEC2F(trackpad, "Trackpad", XRT_INPUT_VIVE_TRACKPAD)
|
||||
MAKE_INPUT_SUFFIX_ONLY(trackpad, "Trackpad Click", click, XRT_INPUT_VIVE_TRACKPAD_CLICK)
|
||||
MAKE_INPUT_SUFFIX_ONLY(trackpad, "Trackpad Touch", touch, XRT_INPUT_VIVE_TRACKPAD_TOUCH)
|
||||
MAKE_INPUT(grip, "Grip", pose, XRT_INPUT_VIVE_GRIP_POSE)
|
||||
MAKE_INPUT(aim, "Aim", pose, XRT_INPUT_VIVE_AIM_POSE)
|
||||
|
||||
MAKE_OUTPUT(haptic, XRT_OUTPUT_NAME_VIVE_HAPTIC)
|
||||
MAKE_OUTPUT(haptic, "Haptic", XRT_OUTPUT_NAME_VIVE_HAPTIC)
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
|
|
|
@ -1342,6 +1342,9 @@ struct oxr_binding
|
|||
XrPath *paths;
|
||||
size_t num_paths;
|
||||
|
||||
//! Name presented to the user.
|
||||
const char *localized_name;
|
||||
|
||||
enum oxr_sub_action_path sub_path;
|
||||
|
||||
size_t num_keys;
|
||||
|
|
Loading…
Reference in a new issue