From b3154602cb0850f72071ee03637c22cc33a03f5e Mon Sep 17 00:00:00 2001 From: Beyley Cardellio Date: Tue, 28 Oct 2025 23:26:36 -0700 Subject: [PATCH] a/bindings + a/util + d/psvr2: Add PS VR2 interaction profile Function button (path called "system" for consistency, but named "function button" by Sony's documentation) is fully implemented, output haptics are exposed but unimplemented, pending getting them working on post-PC firmwares. Part-of: --- scripts/generate_oxr_ext_support.py | 1 + .../openxr/XR_MNDX_psvr2_interaction.h | 26 ++++++++++++++++ src/xrt/auxiliary/bindings/bindings.json | 31 +++++++++++++++++++ src/xrt/auxiliary/util/u_pretty_print.c | 2 ++ src/xrt/include/xrt/xrt_defines.h | 10 ++++-- src/xrt/include/xrt/xrt_openxr_includes.h | 9 +++--- .../oxr/oxr_extension_support.h | 12 +++++++ 7 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 src/external/openxr_includes/openxr/XR_MNDX_psvr2_interaction.h diff --git a/scripts/generate_oxr_ext_support.py b/scripts/generate_oxr_ext_support.py index 28d4c434d..8d5cbdc5a 100755 --- a/scripts/generate_oxr_ext_support.py +++ b/scripts/generate_oxr_ext_support.py @@ -109,6 +109,7 @@ EXTENSIONS = ( ['XR_MNDX_egl_enable', 'XR_USE_PLATFORM_EGL'], ['XR_MNDX_force_feedback_curl', 'XRT_FEATURE_OPENXR_FORCE_FEEDBACK_CURL'], ['XR_MNDX_hydra', 'XRT_FEATURE_OPENXR_INTERACTION_MNDX'], + ['XR_MNDX_psvr2_interaction', 'XRT_FEATURE_OPENXR_INTERACTION_MNDX'], ['XR_MNDX_system_buttons', 'XRT_FEATURE_OPENXR_INTERACTION_MNDX'], ['XR_MNDX_xdev_space', 'XRT_FEATURE_OPENXR_XDEV_SPACE'], ) diff --git a/src/external/openxr_includes/openxr/XR_MNDX_psvr2_interaction.h b/src/external/openxr_includes/openxr/XR_MNDX_psvr2_interaction.h new file mode 100644 index 000000000..1d0888165 --- /dev/null +++ b/src/external/openxr_includes/openxr/XR_MNDX_psvr2_interaction.h @@ -0,0 +1,26 @@ +// Copyright 2025, Beyley Cardellio +// SPDX-License-Identifier: BSL-1.0 +/*! + * @file + * @brief Preview header for XR_MNDX_psvr2_interaction extension + * @author Beyley Cardellio + * @ingroup external_openxr + */ +#ifndef XR_MNDX_PSVR2_INTERACTION_H +#define XR_MNDX_PSVR2_INTERACTION_H 1 + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define XR_MNDX_psvr2_interaction 1 +#define XR_MNDX_psvr2_interaction_SPEC_VERSION 1 +#define XR_MNDX_PSVR2_INTERACTION_EXTENSION_NAME "XR_MNDX_psvr2_interaction" + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/xrt/auxiliary/bindings/bindings.json b/src/xrt/auxiliary/bindings/bindings.json index 4e1dccc48..4d9679bc7 100644 --- a/src/xrt/auxiliary/bindings/bindings.json +++ b/src/xrt/auxiliary/bindings/bindings.json @@ -3762,6 +3762,37 @@ } } } + }, + + "/interaction_profiles/mndx/psvr2_mndx": { + "title": "PlayStation VR2", + "type": "tracked_hmd", + "monado_device": "XRT_DEVICE_PSVR2", + "extension": "MNDX_psvr2_interaction", + "extended_by": [], + "subaction_paths": [ + "/user/head" + ], + "subpaths": { + "/input/system": { + "type": "button", + "localized_name": "Function", + "components": ["click"], + "monado_bindings": { + "click": "XRT_INPUT_PSVR2_SYSTEM_CLICK" + } + }, + "/output/haptic": { + "type": "vibration", + "localized_name": "Haptic", + "components": [ + "haptic" + ], + "monado_bindings": { + "haptic": "XRT_OUTPUT_NAME_PSVR2_HAPTIC" + } + } + } } } diff --git a/src/xrt/auxiliary/util/u_pretty_print.c b/src/xrt/auxiliary/util/u_pretty_print.c index 5bb4d084c..05a98c1da 100644 --- a/src/xrt/auxiliary/util/u_pretty_print.c +++ b/src/xrt/auxiliary/util/u_pretty_print.c @@ -177,6 +177,8 @@ u_pp_xrt_output_name(struct u_pp_delegate dg, enum xrt_output_name name) XRT_OUTPUT_CASE(XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_TRIGGER); XRT_OUTPUT_CASE(XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_THUMB); XRT_OUTPUT_CASE(XRT_OUTPUT_NAME_TOUCH_PLUS_HAPTIC); + + XRT_OUTPUT_CASE(XRT_OUTPUT_NAME_PSVR2_HAPTIC); } #undef XRT_OUTPUT_CASE diff --git a/src/xrt/include/xrt/xrt_defines.h b/src/xrt/include/xrt/xrt_defines.h index 87b2ecf8c..143ba5332 100644 --- a/src/xrt/include/xrt/xrt_defines.h +++ b/src/xrt/include/xrt/xrt_defines.h @@ -743,6 +743,7 @@ enum xrt_device_name XRT_DEVICE_HYDRA, XRT_DEVICE_RIFT_REMOTE, XRT_DEVICE_BLUBUR_S1, + XRT_DEVICE_PSVR2, // Other misc stuff. XRT_DEVICE_HAND_TRACKER, @@ -1301,7 +1302,10 @@ enum xrt_input_type _(XRT_INPUT_RIFT_REMOTE_DPAD_UP_CLICK , XRT_INPUT_NAME(0x0F07, BOOLEAN)) \ _(XRT_INPUT_RIFT_REMOTE_DPAD_LEFT_CLICK , XRT_INPUT_NAME(0x0F08, BOOLEAN)) \ \ - _(XRT_INPUT_BLUBUR_S1_MENU_CLICK , XRT_INPUT_NAME(0x1000, BOOLEAN)) + _(XRT_INPUT_BLUBUR_S1_MENU_CLICK , XRT_INPUT_NAME(0x1000, BOOLEAN)) \ +\ + _(XRT_INPUT_PSVR2_SYSTEM_CLICK , XRT_INPUT_NAME(0x1100, BOOLEAN)) + // clang-format on @@ -1984,7 +1988,9 @@ enum xrt_output_name XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC = XRT_OUTPUT_NAME(0x0400, VIBRATION), XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_TRIGGER = XRT_OUTPUT_NAME(0x0500, VIBRATION), XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_THUMB = XRT_OUTPUT_NAME(0x0600, VIBRATION), - XRT_OUTPUT_NAME_TOUCH_PLUS_HAPTIC = XRT_OUTPUT_NAME(0x0700, VIBRATION) + XRT_OUTPUT_NAME_TOUCH_PLUS_HAPTIC = XRT_OUTPUT_NAME(0x0700, VIBRATION), + + XRT_OUTPUT_NAME_PSVR2_HAPTIC = XRT_OUTPUT_NAME(0x0800, VIBRATION), // clang-format on }; diff --git a/src/xrt/include/xrt/xrt_openxr_includes.h b/src/xrt/include/xrt/xrt_openxr_includes.h index 035403e32..5a59f19ed 100644 --- a/src/xrt/include/xrt/xrt_openxr_includes.h +++ b/src/xrt/include/xrt/xrt_openxr_includes.h @@ -64,9 +64,10 @@ typedef __eglMustCastToProperFunctionPointerType (*PFNEGLGETPROCADDRESSPROC)(con #include "openxr/openxr_loader_negotiation.h" // IWYU pragma: export #include "openxr/openxr_reflection.h" // IWYU pragma: export -#include "openxr/XR_MNDX_hydra.h" -#include "openxr/XR_MNDX_xdev_space.h" -#include "openxr/XR_MNDX_system_buttons.h" #include "openxr/XR_MNDX_ball_on_a_stick_controller.h" -#include "openxr/XR_MNDX_oculus_remote.h" #include "openxr/XR_MNDX_blubur_s1.h" +#include "openxr/XR_MNDX_oculus_remote.h" +#include "openxr/XR_MNDX_hydra.h" +#include "openxr/XR_MNDX_psvr2_interaction.h" +#include "openxr/XR_MNDX_system_buttons.h" +#include "openxr/XR_MNDX_xdev_space.h" diff --git a/src/xrt/state_trackers/oxr/oxr_extension_support.h b/src/xrt/state_trackers/oxr/oxr_extension_support.h index f1b0b3882..34be945ec 100644 --- a/src/xrt/state_trackers/oxr/oxr_extension_support.h +++ b/src/xrt/state_trackers/oxr/oxr_extension_support.h @@ -840,6 +840,17 @@ #endif +/* + * XR_MNDX_psvr2_interaction + */ +#if defined(XR_MNDX_psvr2_interaction) && defined(XRT_FEATURE_OPENXR_INTERACTION_MNDX) +#define OXR_HAVE_MNDX_psvr2_interaction +#define OXR_EXTENSION_SUPPORT_MNDX_psvr2_interaction(_) _(MNDX_psvr2_interaction, MNDX_PSVR2_INTERACTION) +#else +#define OXR_EXTENSION_SUPPORT_MNDX_psvr2_interaction(_) +#endif + + /* * XR_MNDX_system_buttons */ @@ -957,6 +968,7 @@ OXR_EXTENSION_SUPPORT_MNDX_egl_enable(_) \ OXR_EXTENSION_SUPPORT_MNDX_force_feedback_curl(_) \ OXR_EXTENSION_SUPPORT_MNDX_hydra(_) \ + OXR_EXTENSION_SUPPORT_MNDX_psvr2_interaction(_) \ OXR_EXTENSION_SUPPORT_MNDX_system_buttons(_) \ OXR_EXTENSION_SUPPORT_MNDX_xdev_space(_) // clang-format on -- 2.51.2