diff --git a/src/xrt/state_trackers/oxr/oxr_binding.c b/src/xrt/state_trackers/oxr/oxr_binding.c index 40ebd6e9b..f8831607c 100644 --- a/src/xrt/state_trackers/oxr/oxr_binding.c +++ b/src/xrt/state_trackers/oxr/oxr_binding.c @@ -426,18 +426,22 @@ void oxr_binding_find_bindings_from_key(struct oxr_logger *log, struct oxr_interaction_profile *p, uint32_t key, - struct oxr_binding *bindings[OXR_MAX_BINDINGS_PER_ACTION], - size_t *binding_count) + size_t max_bounding_count, + struct oxr_binding **bindings, + size_t *out_binding_count) { if (p == NULL) { - *binding_count = 0; + *out_binding_count = 0; return; } - //! @todo This function should be a two call function, or handle more - //! then 32 bindings. + // How many bindings are we returning? size_t num = 0; + /* + * Loop over all app provided bindings for this profile + * and return those matching the action. + */ for (size_t y = 0; y < p->binding_count; y++) { struct oxr_binding *b = &p->bindings[y]; @@ -448,13 +452,16 @@ oxr_binding_find_bindings_from_key(struct oxr_logger *log, } } - if (num >= 32) { - *binding_count = num; - return; + //! @todo Should return total count instead of fixed max. + if (num >= max_bounding_count) { + oxr_warn(log, "Internal limit reached, action has too many bindings!"); + break; } } - *binding_count = num; + assert(num <= max_bounding_count); + + *out_binding_count = num; } struct oxr_interaction_profile * diff --git a/src/xrt/state_trackers/oxr/oxr_input.c b/src/xrt/state_trackers/oxr/oxr_input.c index 0a416264f..b69880bf4 100644 --- a/src/xrt/state_trackers/oxr/oxr_input.c +++ b/src/xrt/state_trackers/oxr/oxr_input.c @@ -684,7 +684,13 @@ get_binding(struct oxr_logger *log, } size_t num = 0; - oxr_binding_find_bindings_from_key(log, profile, act_ref->act_key, binding_points, &num); + oxr_binding_find_bindings_from_key( // + log, // log + profile, // p + act_ref->act_key, // key + ARRAY_SIZE(binding_points), // max_bounding_count + binding_points, // bindings + &num); // out_binding_count if (num == 0) { oxr_slog(slog, "\t\t\tNo bindings!\n"); return; diff --git a/src/xrt/state_trackers/oxr/oxr_objects.h b/src/xrt/state_trackers/oxr/oxr_objects.h index 6921d45a6..f78ba692d 100644 --- a/src/xrt/state_trackers/oxr/oxr_objects.h +++ b/src/xrt/state_trackers/oxr/oxr_objects.h @@ -589,10 +589,11 @@ oxr_session_binding_destroy_all(struct oxr_logger *log, struct oxr_session *sess */ void oxr_binding_find_bindings_from_key(struct oxr_logger *log, - struct oxr_interaction_profile *profile, + struct oxr_interaction_profile *p, uint32_t key, - struct oxr_binding *bindings[OXR_MAX_BINDINGS_PER_ACTION], - size_t *binding_count); + size_t max_bounding_count, + struct oxr_binding **bindings, + size_t *out_binding_count); /*! * @public @memberof oxr_instance