EXT_dpad_binding bindings, odyssey ext

This commit is contained in:
galister 2026-07-02 18:01:49 +09:00
parent 34bd920f3b
commit a9986e6b67
5 changed files with 101 additions and 11 deletions

View File

@ -41,6 +41,11 @@ pub(super) fn init_xr() -> Result<(xr::Instance, xr::SystemId), anyhow::Error> {
} else { } else {
log::warn!("Missing EXT_dpad_binding extension."); log::warn!("Missing EXT_dpad_binding extension.");
} }
if available_extensions.ext_samsung_odyssey_controller {
enabled_extensions.ext_samsung_odyssey_controller = true;
} else {
log::warn!("Missing XR_EXT_samsung_odyssey_controller extension.");
}
if available_extensions.ext_hp_mixed_reality_controller { if available_extensions.ext_hp_mixed_reality_controller {
enabled_extensions.ext_hp_mixed_reality_controller = true; enabled_extensions.ext_hp_mixed_reality_controller = true;
} else { } else {

View File

@ -656,7 +656,7 @@ fn suggest_bindings(instance: &xr::Instance, hands: &mut [&mut OpenXrHandSource;
let profiles = load_xr_input_profiles(); let profiles = load_xr_input_profiles();
for profile in profiles { for profile in profiles {
log::warn!("Loading profile {}", &profile.profile); log::debug!("Loading profile {}", &profile.profile);
let Ok(profile_path) = instance.string_to_path(&profile.profile) else { let Ok(profile_path) = instance.string_to_path(&profile.profile) else {
log::warn!("Profile not supported: {}", profile.profile); log::warn!("Profile not supported: {}", profile.profile);
@ -720,8 +720,7 @@ fn suggest_bindings(instance: &xr::Instance, hands: &mut [&mut OpenXrHandSource;
.suggest_interaction_profile_bindings(profile_path, &bindings) .suggest_interaction_profile_bindings(profile_path, &bindings)
.is_err() .is_err()
{ {
log::error!("Bad bindings for {}", &profile.profile[22..]); log::warn!("Could not apply bindings for {}", &profile.profile[22..]);
log::error!("Verify config: ~/.config/wayvr/openxr_actions.json5");
} else { } else {
log::debug!( log::debug!(
"Bindings for {} bound successfully.", "Bindings for {} bound successfully.",

View File

@ -380,11 +380,11 @@
right: "/user/hand/right/input/thumbstick/x" right: "/user/hand/right/input/thumbstick/x"
}, },
show_hide: { show_hide: {
left: "/user/hand/left/input/system/click", left: "/user/hand/left/input/menu/click",
}, },
space_drag: { space_drag: {
double_click: true, double_click: true,
right: "/user/hand/left/input/system/click", right: "/user/hand/left/input/menu/click",
}, },
move_mouse: { move_mouse: {
left: "/user/hand/left/input/trigger/value", left: "/user/hand/left/input/trigger/value",

View File

@ -106,6 +106,16 @@ pub enum XrInputComponent {
#[strum(props(Translation = "APP_SETTINGS.BINDINGS.COMP.Y_AXIS"))] #[strum(props(Translation = "APP_SETTINGS.BINDINGS.COMP.Y_AXIS"))]
Y, Y,
// thumbstick/trackpad d-pad bindings via EXT_dpad_binding
#[strum(props(Translation = "APP_SETTINGS.BINDINGS.TYPE.DPAD_UP"))]
DpadUp,
#[strum(props(Translation = "APP_SETTINGS.BINDINGS.TYPE.DPAD_DOWN"))]
DpadDown,
#[strum(props(Translation = "APP_SETTINGS.BINDINGS.TYPE.DPAD_LEFT"))]
DpadLeft,
#[strum(props(Translation = "APP_SETTINGS.BINDINGS.TYPE.DPAD_RIGHT"))]
DpadRight,
// below are hidden // below are hidden
Pose, Pose,
} }

View File

@ -61,6 +61,10 @@ const VALVE_INDEX_USER_PATHS: &[XrInputSubpath] = &[
XrInputComponent::Touch, XrInputComponent::Touch,
XrInputComponent::X, XrInputComponent::X,
XrInputComponent::Y, XrInputComponent::Y,
XrInputComponent::DpadUp,
XrInputComponent::DpadDown,
XrInputComponent::DpadLeft,
XrInputComponent::DpadRight,
], ],
}, },
XrInputSubpath { XrInputSubpath {
@ -70,6 +74,10 @@ const VALVE_INDEX_USER_PATHS: &[XrInputSubpath] = &[
XrInputComponent::Touch, XrInputComponent::Touch,
XrInputComponent::X, XrInputComponent::X,
XrInputComponent::Y, XrInputComponent::Y,
XrInputComponent::DpadUp,
XrInputComponent::DpadDown,
XrInputComponent::DpadLeft,
XrInputComponent::DpadRight,
], ],
}, },
XrInputSubpath { XrInputSubpath {
@ -154,6 +162,10 @@ static VALVE_FRAME_CONTROLLER_VALVE_RIGHT_USER_PATHS: &[XrInputSubpath] = &[
XrInputComponent::Touch, XrInputComponent::Touch,
XrInputComponent::X, XrInputComponent::X,
XrInputComponent::Y, XrInputComponent::Y,
XrInputComponent::DpadUp,
XrInputComponent::DpadDown,
XrInputComponent::DpadLeft,
XrInputComponent::DpadRight,
], ],
}, },
XrInputSubpath { XrInputSubpath {
@ -222,6 +234,10 @@ static VALVE_FRAME_CONTROLLER_VALVE_LEFT_USER_PATHS: &[XrInputSubpath] = &[
XrInputComponent::Touch, XrInputComponent::Touch,
XrInputComponent::X, XrInputComponent::X,
XrInputComponent::Y, XrInputComponent::Y,
XrInputComponent::DpadUp,
XrInputComponent::DpadDown,
XrInputComponent::DpadLeft,
XrInputComponent::DpadRight,
], ],
}, },
XrInputSubpath { XrInputSubpath {
@ -282,6 +298,10 @@ const OCULUS_TOUCH_LEFT_USER_PATHS: &[XrInputSubpath] = &[
XrInputComponent::Touch, XrInputComponent::Touch,
XrInputComponent::X, XrInputComponent::X,
XrInputComponent::Y, XrInputComponent::Y,
XrInputComponent::DpadUp,
XrInputComponent::DpadDown,
XrInputComponent::DpadLeft,
XrInputComponent::DpadRight,
], ],
}, },
XrInputSubpath { XrInputSubpath {
@ -330,6 +350,10 @@ const OCULUS_TOUCH_RIGHT_USER_PATHS: &[XrInputSubpath] = &[
XrInputComponent::Touch, XrInputComponent::Touch,
XrInputComponent::X, XrInputComponent::X,
XrInputComponent::Y, XrInputComponent::Y,
XrInputComponent::DpadUp,
XrInputComponent::DpadDown,
XrInputComponent::DpadLeft,
XrInputComponent::DpadRight,
], ],
}, },
XrInputSubpath { XrInputSubpath {
@ -389,7 +413,15 @@ const HP_MIXED_REALITY_LEFT_USER_PATHS: &[XrInputSubpath] = &[
}, },
XrInputSubpath { XrInputSubpath {
kind: XrInputSubpathKind::Thumbstick, kind: XrInputSubpathKind::Thumbstick,
components: &[XrInputComponent::Click, XrInputComponent::X, XrInputComponent::Y], components: &[
XrInputComponent::Click,
XrInputComponent::X,
XrInputComponent::Y,
XrInputComponent::DpadUp,
XrInputComponent::DpadDown,
XrInputComponent::DpadLeft,
XrInputComponent::DpadRight,
],
}, },
XrInputSubpath { XrInputSubpath {
kind: XrInputSubpathKind::Grip, kind: XrInputSubpathKind::Grip,
@ -428,7 +460,15 @@ const HP_MIXED_REALITY_RIGHT_USER_PATHS: &[XrInputSubpath] = &[
}, },
XrInputSubpath { XrInputSubpath {
kind: XrInputSubpathKind::Thumbstick, kind: XrInputSubpathKind::Thumbstick,
components: &[XrInputComponent::Click, XrInputComponent::X, XrInputComponent::Y], components: &[
XrInputComponent::Click,
XrInputComponent::X,
XrInputComponent::Y,
XrInputComponent::DpadUp,
XrInputComponent::DpadDown,
XrInputComponent::DpadLeft,
XrInputComponent::DpadRight,
],
}, },
XrInputSubpath { XrInputSubpath {
kind: XrInputSubpathKind::Grip, kind: XrInputSubpathKind::Grip,
@ -446,7 +486,7 @@ const HP_MIXED_REALITY_RIGHT_USER_PATHS: &[XrInputSubpath] = &[
pub const SAMSUNG_ODYSSEY_CONTROLLER_PROFILE: XrControllerProfile = XrControllerProfile { pub const SAMSUNG_ODYSSEY_CONTROLLER_PROFILE: XrControllerProfile = XrControllerProfile {
display_name: "Samsung Odyssey Controller", display_name: "Samsung Odyssey Controller",
extension: None, extension: Some("XR_EXT_samsung_odyssey_controller"),
profile_id: "/interaction_profiles/samsung/odyssey_controller", profile_id: "/interaction_profiles/samsung/odyssey_controller",
user_paths: &[ user_paths: &[
XrControllerUserPath { XrControllerUserPath {
@ -475,7 +515,15 @@ const SAMSUNG_ODYSSEY_USER_PATHS: &[XrInputSubpath] = &[
}, },
XrInputSubpath { XrInputSubpath {
kind: XrInputSubpathKind::Thumbstick, kind: XrInputSubpathKind::Thumbstick,
components: &[XrInputComponent::Click, XrInputComponent::X, XrInputComponent::Y], components: &[
XrInputComponent::Click,
XrInputComponent::X,
XrInputComponent::Y,
XrInputComponent::DpadUp,
XrInputComponent::DpadDown,
XrInputComponent::DpadLeft,
XrInputComponent::DpadRight,
],
}, },
XrInputSubpath { XrInputSubpath {
kind: XrInputSubpathKind::Trackpad, kind: XrInputSubpathKind::Trackpad,
@ -484,6 +532,10 @@ const SAMSUNG_ODYSSEY_USER_PATHS: &[XrInputSubpath] = &[
XrInputComponent::Touch, XrInputComponent::Touch,
XrInputComponent::X, XrInputComponent::X,
XrInputComponent::Y, XrInputComponent::Y,
XrInputComponent::DpadUp,
XrInputComponent::DpadDown,
XrInputComponent::DpadLeft,
XrInputComponent::DpadRight,
], ],
}, },
XrInputSubpath { XrInputSubpath {
@ -540,6 +592,10 @@ const HTC_VIVE_USER_PATHS: &[XrInputSubpath] = &[
XrInputComponent::Touch, XrInputComponent::Touch,
XrInputComponent::X, XrInputComponent::X,
XrInputComponent::Y, XrInputComponent::Y,
XrInputComponent::DpadUp,
XrInputComponent::DpadDown,
XrInputComponent::DpadLeft,
XrInputComponent::DpadRight,
], ],
}, },
XrInputSubpath { XrInputSubpath {
@ -587,7 +643,15 @@ const MICROSOFT_MOTION_CONTROLLER_USER_PATHS: &[XrInputSubpath] = &[
}, },
XrInputSubpath { XrInputSubpath {
kind: XrInputSubpathKind::Thumbstick, kind: XrInputSubpathKind::Thumbstick,
components: &[XrInputComponent::Click, XrInputComponent::X, XrInputComponent::Y], components: &[
XrInputComponent::Click,
XrInputComponent::X,
XrInputComponent::Y,
XrInputComponent::DpadUp,
XrInputComponent::DpadDown,
XrInputComponent::DpadLeft,
XrInputComponent::DpadRight,
],
}, },
XrInputSubpath { XrInputSubpath {
kind: XrInputSubpathKind::Trackpad, kind: XrInputSubpathKind::Trackpad,
@ -596,6 +660,10 @@ const MICROSOFT_MOTION_CONTROLLER_USER_PATHS: &[XrInputSubpath] = &[
XrInputComponent::Touch, XrInputComponent::Touch,
XrInputComponent::X, XrInputComponent::X,
XrInputComponent::Y, XrInputComponent::Y,
XrInputComponent::DpadUp,
XrInputComponent::DpadDown,
XrInputComponent::DpadLeft,
XrInputComponent::DpadRight,
], ],
}, },
XrInputSubpath { XrInputSubpath {
@ -639,7 +707,15 @@ const KHR_GENERIC_CONTROLLER_USER_PATHS: &[XrInputSubpath] = &[
}, },
XrInputSubpath { XrInputSubpath {
kind: XrInputSubpathKind::Thumbstick, kind: XrInputSubpathKind::Thumbstick,
components: &[XrInputComponent::Click, XrInputComponent::X, XrInputComponent::Y], components: &[
XrInputComponent::Click,
XrInputComponent::X,
XrInputComponent::Y,
XrInputComponent::DpadUp,
XrInputComponent::DpadDown,
XrInputComponent::DpadLeft,
XrInputComponent::DpadRight,
],
}, },
XrInputSubpath { XrInputSubpath {
kind: XrInputSubpathKind::Squeeze, kind: XrInputSubpathKind::Squeeze,