diff --git a/assets/controllers/pico-4s/left.glb b/assets/controllers/pico-4s/left.glb new file mode 100644 index 00000000..e98215f0 Binary files /dev/null and b/assets/controllers/pico-4s/left.glb differ diff --git a/assets/controllers/pico-4s/profile.json b/assets/controllers/pico-4s/profile.json new file mode 100644 index 00000000..99cd1067 --- /dev/null +++ b/assets/controllers/pico-4s/profile.json @@ -0,0 +1,286 @@ +{ + "profileId": "pico-4s", + "fallbackProfileIds": [ + "generic-trigger-squeeze-thumbstick" + ], + "layouts": { + "left": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "x-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "x_button", + "visualResponses": { + "x_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "x_button_pressed_value", + "minNodeName": "x_button_pressed_min", + "maxNodeName": "x_button_pressed_max" + } + } + }, + "y-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "y_button", + "visualResponses": { + "y_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "y_button_pressed_value", + "minNodeName": "y_button_pressed_min", + "maxNodeName": "y_button_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "pico-4s-left", + "assetPath": "left.glb" + }, + "right": { + "selectComponentId": "xr-standard-trigger", + "components": { + "xr-standard-trigger": { + "type": "trigger", + "gamepadIndices": { + "button": 0 + }, + "rootNodeName": "xr_standard_trigger", + "visualResponses": { + "xr_standard_trigger_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_trigger_pressed_value", + "minNodeName": "xr_standard_trigger_pressed_min", + "maxNodeName": "xr_standard_trigger_pressed_max" + } + } + }, + "xr-standard-squeeze": { + "type": "squeeze", + "gamepadIndices": { + "button": 1 + }, + "rootNodeName": "xr_standard_squeeze", + "visualResponses": { + "xr_standard_squeeze_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_squeeze_pressed_value", + "minNodeName": "xr_standard_squeeze_pressed_min", + "maxNodeName": "xr_standard_squeeze_pressed_max" + } + } + }, + "xr-standard-thumbstick": { + "type": "thumbstick", + "gamepadIndices": { + "button": 3, + "xAxis": 2, + "yAxis": 3 + }, + "rootNodeName": "xr_standard_thumbstick", + "visualResponses": { + "xr_standard_thumbstick_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_pressed_value", + "minNodeName": "xr_standard_thumbstick_pressed_min", + "maxNodeName": "xr_standard_thumbstick_pressed_max" + }, + "xr_standard_thumbstick_xaxis_pressed": { + "componentProperty": "xAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_xaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_xaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_xaxis_pressed_max" + }, + "xr_standard_thumbstick_yaxis_pressed": { + "componentProperty": "yAxis", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "xr_standard_thumbstick_yaxis_pressed_value", + "minNodeName": "xr_standard_thumbstick_yaxis_pressed_min", + "maxNodeName": "xr_standard_thumbstick_yaxis_pressed_max" + } + } + }, + "a-button": { + "type": "button", + "gamepadIndices": { + "button": 4 + }, + "rootNodeName": "a_button", + "visualResponses": { + "a_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "a_button_pressed_value", + "minNodeName": "a_button_pressed_min", + "maxNodeName": "a_button_pressed_max" + } + } + }, + "b-button": { + "type": "button", + "gamepadIndices": { + "button": 5 + }, + "rootNodeName": "b_button", + "visualResponses": { + "b_button_pressed": { + "componentProperty": "button", + "states": [ + "default", + "touched", + "pressed" + ], + "valueNodeProperty": "transform", + "valueNodeName": "b_button_pressed_value", + "minNodeName": "b_button_pressed_min", + "maxNodeName": "b_button_pressed_max" + } + } + } + }, + "gamepadMapping": "xr-standard", + "rootNodeName": "pico-4s-right", + "assetPath": "right.glb" + } + } +} \ No newline at end of file diff --git a/assets/controllers/pico-4s/right.glb b/assets/controllers/pico-4s/right.glb new file mode 100644 index 00000000..2ba9a967 Binary files /dev/null and b/assets/controllers/pico-4s/right.glb differ diff --git a/client/application.cpp b/client/application.cpp index 08f369b9..a80f4e9e 100644 --- a/client/application.cpp +++ b/client/application.cpp @@ -421,6 +421,48 @@ static std::vector interaction_profiles{ "/user/hand/right/input/squeeze/value", }}, interaction_profile{ + "/interaction_profiles/bytedance/pico4s_controller", + {"XR_BD_controller_interaction"}, + { + "/user/hand/left/output/haptic", + "/user/hand/right/output/haptic", + + "/user/hand/left/input/grip/pose", + "/user/hand/left/input/aim/pose", + + "/user/hand/right/input/grip/pose", + "/user/hand/right/input/aim/pose", + + "/user/hand/left/input/x/click", + "/user/hand/left/input/x/touch", + "/user/hand/left/input/y/click", + "/user/hand/left/input/y/touch", + "/user/hand/left/input/menu/click", + "/user/hand/left/input/system/click", + "/user/hand/left/input/trigger/click", + "/user/hand/left/input/trigger/value", + "/user/hand/left/input/trigger/touch", + "/user/hand/left/input/thumbstick", + "/user/hand/left/input/thumbstick/click", + "/user/hand/left/input/thumbstick/touch", + "/user/hand/left/input/squeeze/click", + "/user/hand/left/input/squeeze/value", + + "/user/hand/right/input/a/click", + "/user/hand/right/input/a/touch", + "/user/hand/right/input/b/click", + "/user/hand/right/input/b/touch", + "/user/hand/right/input/system/click", + "/user/hand/right/input/trigger/click", + "/user/hand/right/input/trigger/value", + "/user/hand/right/input/trigger/touch", + "/user/hand/right/input/thumbstick", + "/user/hand/right/input/thumbstick/click", + "/user/hand/right/input/thumbstick/touch", + "/user/hand/right/input/squeeze/click", + "/user/hand/right/input/squeeze/value", + }}, + interaction_profile{ "/interaction_profiles/htc/vive_focus3_controller", {"XR_HTC_vive_focus3_controller_interaction"}, { diff --git a/client/hardware.cpp b/client/hardware.cpp index 82b0e793..0d32be57 100644 --- a/client/hardware.cpp +++ b/client/hardware.cpp @@ -74,6 +74,9 @@ static model guess_model_() if (model == "Pico Neo 3") return model::pico_neo_3; + if (model == "A9210") + return model::pico_4s; + spdlog::info("manufacturer={}, model={}, device={} assuming Pico 4", manufacturer, model, device); return model::pico_4; } @@ -141,6 +144,7 @@ XrViewConfigurationView override_view(XrViewConfigurationView view, model m) case model::pico_neo_3: return scale_view(view, 1832); case model::pico_4: + case model::pico_4s: return scale_view(view, 2160); case model::htc_vive_focus_3: case model::htc_vive_focus_vision: @@ -167,6 +171,7 @@ bool need_srgb_conversion(model m) case model::meta_quest_3s: case model::pico_neo_3: case model::pico_4: + case model::pico_4s: case model::htc_vive_focus_3: case model::htc_vive_focus_vision: case model::htc_vive_xr_elite: @@ -195,6 +200,7 @@ const char * permission_name(feature f) return "com.oculus.permission.EYE_TRACKING"; case model::pico_neo_3: case model::pico_4: + case model::pico_4s: return "com.picovr.permission.EYE_TRACKING"; case model::htc_vive_focus_3: case model::htc_vive_focus_vision: @@ -215,6 +221,7 @@ const char * permission_name(feature f) return "com.oculus.permission.FACE_TRACKING"; case model::pico_neo_3: case model::pico_4: + case model::pico_4s: case model::htc_vive_focus_3: case model::htc_vive_focus_vision: case model::htc_vive_xr_elite: @@ -250,6 +257,8 @@ std::string controller_name() return "pico-neo3"; case model::pico_4: return "pico-4"; + case model::pico_4s: + return "pico-4s"; case model::htc_vive_focus_3: case model::htc_vive_focus_vision: case model::htc_vive_xr_elite: @@ -322,7 +331,7 @@ std::pair controller_offset(std::string_view profile, xr:: default: break; } - else if (profile == "pico-4") + else if (profile == "pico-4" || profile == "pico-4s") switch (space) { case xr::spaces::grip_left: diff --git a/client/hardware.h b/client/hardware.h index 2f2346fa..e74cb1cf 100644 --- a/client/hardware.h +++ b/client/hardware.h @@ -34,6 +34,7 @@ enum class model meta_quest_3s, pico_neo_3, pico_4, + pico_4s, htc_vive_focus_3, htc_vive_xr_elite, htc_vive_focus_vision, diff --git a/client/scenes/lobby.cpp b/client/scenes/lobby.cpp index e3994429..91e4170c 100644 --- a/client/scenes/lobby.cpp +++ b/client/scenes/lobby.cpp @@ -1307,6 +1307,24 @@ scene::meta & scenes::lobby::get_meta_scene() {"recenter_right", "/user/hand/right/input/a/click"}, }, }, + suggested_binding{ + "/interaction_profiles/bytedance/pico4s_controller", + { + {"left_aim", "/user/hand/left/input/aim/pose"}, + {"left_trigger", "/user/hand/left/input/trigger/value"}, + {"left_squeeze", "/user/hand/left/input/squeeze/value"}, + {"left_scroll", "/user/hand/left/input/thumbstick"}, + {"left_haptic", "/user/hand/left/output/haptic"}, + {"right_aim", "/user/hand/right/input/aim/pose"}, + {"right_trigger", "/user/hand/right/input/trigger/value"}, + {"right_squeeze", "/user/hand/right/input/squeeze/value"}, + {"right_scroll", "/user/hand/right/input/thumbstick"}, + {"right_haptic", "/user/hand/right/output/haptic"}, + + {"recenter_left", "/user/hand/left/input/x/click"}, + {"recenter_right", "/user/hand/right/input/a/click"}, + }, + }, suggested_binding{ "/interaction_profiles/htc/vive_focus3_controller", { diff --git a/client/scenes/stream_tracking.cpp b/client/scenes/stream_tracking.cpp index be979f8c..e3f70bc9 100644 --- a/client/scenes/stream_tracking.cpp +++ b/client/scenes/stream_tracking.cpp @@ -490,6 +490,7 @@ void scenes::stream::on_interaction_profile_changed(const XrEventDataInteraction DO_PROFILE(khr, simple_controller) DO_PROFILE(bd, pico_neo3_controller) DO_PROFILE(bd, pico4_controller) + DO_PROFILE(bd, pico4s_controller) DO_PROFILE(bd, pico_g3_controller) DO_PROFILE(google, daydream_controller) DO_PROFILE(hp, mixed_reality_controller) diff --git a/common/wivrn_packets.h b/common/wivrn_packets.h index 9c106148..060a0619 100644 --- a/common/wivrn_packets.h +++ b/common/wivrn_packets.h @@ -142,6 +142,13 @@ enum class interaction_profile : uint8_t meta_touch_controller_quest_2, samsung_odyssey_controller, valve_index_controller, + // out-of-order to preserve enum ordinals + // otherwise this will force non-p4u users + // to update both their client and server + // for a feature they won't use + // + // TODO: order this correctly when the next major update comes around + bd_pico4s_controller, }; enum video_codec diff --git a/server/driver/wivrn_session.cpp b/server/driver/wivrn_session.cpp index 01a911c9..b13136c8 100644 --- a/server/driver/wivrn_session.cpp +++ b/server/driver/wivrn_session.cpp @@ -322,6 +322,7 @@ static xrt_device_name get_name(interaction_profile profile) case interaction_profile::bd_pico_neo3_controller: return XRT_DEVICE_PICO_NEO3_CONTROLLER; case interaction_profile::bd_pico4_controller: + case interaction_profile::bd_pico4s_controller: return XRT_DEVICE_PICO4_CONTROLLER; case interaction_profile::bd_pico_g3_controller: return XRT_DEVICE_PICO_G3_CONTROLLER;