Monado OpenXR Runtime
Loading...
Searching...
No Matches
oxr_binding.c File Reference

Holds binding related functions. More...

#include "util/u_misc.h"
#include "oxr_binding.h"
#include "oxr_subaction.h"
#include "oxr_generated_bindings.h"
#include "oxr_dpad_state.h"
#include "oxr_session_action_context.h"
#include "oxr_interaction_profile_array.h"
#include "../oxr_objects.h"
#include "../oxr_logger.h"
#include "../oxr_two_call.h"
#include <stdio.h>
Include dependency graph for oxr_binding.c:

Macros

#define OXR_PATH_MEMBER(lower, CAP, _)    case OXR_SUB_ACTION_PATH_##CAP: return action_context->lower;
 
#define IDENTIFY_TOP_LEVEL_PATH(X)
 

Functions

static bool get_subaction_path_from_path (const struct oxr_path_store *store, XrPath path, enum oxr_subaction_path *out_subaction_path)
 
static void setup_paths (struct oxr_path_store *store, const char **src_paths, XrPath **dest_paths, uint32_t *dest_path_count)
 
static bool get_profile_template_from_path (const struct oxr_instance_path_cache *cache, XrPath path, struct profile_template **out_templ)
 
static bool interaction_profile_find_or_create_in_instance (struct oxr_logger *log, struct oxr_path_store *store, const struct oxr_instance_path_cache *cache, struct oxr_instance_action_context *context, XrPath path, struct oxr_interaction_profile **out_p)
 
static void reset_binding_keys (struct oxr_binding *binding)
 
static void reset_all_keys (struct oxr_binding *bindings, size_t binding_count)
 
static bool ends_with (const char *str, const char *suffix)
 
static bool try_add_by_component (struct oxr_path_store *store, struct oxr_binding *bindings, size_t binding_count, XrPath path, struct oxr_action *act, const char **components, size_t component_count)
 
static bool add_direct (struct oxr_binding *bindings, size_t binding_count, XrPath path, struct oxr_action *act)
 
static void add_act_key_to_matching_bindings (struct oxr_path_store *store, struct oxr_binding *bindings, size_t binding_count, XrPath path, struct oxr_action *act)
 
static void add_string (char *temp, size_t max, ssize_t *current, const char *str)
 
static const char * get_subaction_path_str (enum oxr_subaction_path subaction_path)
 
static XrPath get_interaction_bound_to_sub_path (const struct oxr_session_action_context *action_context, enum oxr_subaction_path subaction_path)
 
static const char * get_identifier_localized_name (XrPath path, const struct oxr_interaction_profile *profile)
 
void oxr_interaction_profile_destroy (struct oxr_interaction_profile *profile)
 
struct oxr_interaction_profileoxr_interaction_profile_clone (const struct oxr_interaction_profile *src_profile)
 
void oxr_binding_find_bindings_from_act_key (struct oxr_logger *log, struct oxr_interaction_profile *profile, uint32_t key, size_t max_binding_count, struct oxr_binding **out_bindings, size_t *out_binding_count)
 
XrResult oxr_action_suggest_interaction_profile_bindings (struct oxr_logger *log, struct oxr_path_store *store, const struct oxr_instance_path_cache *cache, struct oxr_instance_action_context *inst_context, const XrInteractionProfileSuggestedBinding *suggestedBindings, struct oxr_dpad_state *dpad_state)
 
XrResult oxr_action_get_current_interaction_profile (struct oxr_logger *log, const struct oxr_instance_path_cache *cache, const struct oxr_session_action_context *action_context, XrPath topLevelUserPath, XrInteractionProfileState *interactionProfile)
 
XrResult oxr_action_get_input_source_localized_name (struct oxr_logger *log, const struct oxr_path_store *store, const struct oxr_session_action_context *action_context, const XrInputSourceLocalizedNameGetInfo *getInfo, uint32_t bufferCapacityInput, uint32_t *bufferCountOutput, char *buffer)
 

Detailed Description

Macro Definition Documentation

◆ IDENTIFY_TOP_LEVEL_PATH

#define IDENTIFY_TOP_LEVEL_PATH (   X)
Value:
if (topLevelUserPath == cache->X) { \
interactionProfile->interactionProfile = action_context->X; \
} else

Function Documentation

◆ oxr_action_get_input_source_localized_name()

XrResult oxr_action_get_input_source_localized_name ( struct oxr_logger log,
const struct oxr_path_store store,
const struct oxr_session_action_context action_context,
const XrInputSourceLocalizedNameGetInfo *  getInfo,
uint32_t  bufferCapacityInput,
uint32_t *  bufferCountOutput,
char *  buffer 
)
Todo:
: If we ever rebind a profile that has not been suggested by the client, it will not be found.
Todo:
This implementation is very very very inelegant.

Referenced by oxr_xrGetInputSourceLocalizedName().

◆ oxr_binding_find_bindings_from_act_key()

void oxr_binding_find_bindings_from_act_key ( struct oxr_logger log,
struct oxr_interaction_profile profile,
uint32_t  key,
size_t  max_binding_count,
struct oxr_binding **  out_bindings,
size_t out_binding_count 
)
Todo:
Should return total count instead of fixed max.

Referenced by get_binding().