fix(server): Add back Rift S emulation profile

This commit is contained in:
Riccardo Zaglia 2023-09-10 05:27:14 +08:00
parent 365101ec3e
commit 65721956f4
3 changed files with 76 additions and 12 deletions

View File

@ -15,7 +15,9 @@ pub static REGISTERED_BUTTON_SET: Lazy<HashSet<u64>> = Lazy::new(|| {
};
let profile = match &controllers_config.emulation_mode {
ControllersEmulationMode::Quest2Touch => &QUEST_CONTROLLER_PROFILE_ID,
ControllersEmulationMode::RiftSTouch | ControllersEmulationMode::Quest2Touch => {
&QUEST_CONTROLLER_PROFILE_ID
}
ControllersEmulationMode::ValveIndex => &INDEX_CONTROLLER_PROFILE_ID,
ControllersEmulationMode::ViveWand => &VIVE_CONTROLLER_PROFILE_ID,
ControllersEmulationMode::ViveTracker => return HashSet::new(),

View File

@ -60,16 +60,17 @@ fn serial_number(device_id: u64) -> String {
if device_id == *HEAD_ID {
match &settings.headset.emulation_mode {
HeadsetEmulationMode::RiftS => "1WMGH000XX0000".into(),
HeadsetEmulationMode::Vive => "HTCVive-001".into(),
HeadsetEmulationMode::Quest2 => "1WMHH000X00000".into(),
HeadsetEmulationMode::Vive => "HTCVive-001".into(),
HeadsetEmulationMode::Custom { serial_number, .. } => serial_number.clone(),
}
} else if device_id == *LEFT_HAND_ID || device_id == *RIGHT_HAND_ID {
if let Switch::Enabled(controllers) = &settings.headset.controllers {
let serial_number = match &controllers.emulation_mode {
ControllersEmulationMode::RiftSTouch => "ALVR Remote Controller",
ControllersEmulationMode::Quest2Touch => "1WMHH000X00000_Controller",
ControllersEmulationMode::ValveIndex => "ALVR Remote Controller",
ControllersEmulationMode::ViveWand => "ALVR Remote Controller",
ControllersEmulationMode::Quest2Touch => "1WMHH000X00000_Controller",
ControllersEmulationMode::ViveTracker => "ALVR Remote Controller",
};
@ -125,14 +126,6 @@ pub extern "C" fn set_device_openvr_props(device_id: u64) {
set_prop(RegisteredDeviceType("oculus/1WMGH000XX0000".into()));
set_prop(DriverVersion("1.42.0".into()));
}
HeadsetEmulationMode::Vive => {
set_prop(TrackingSystemName("Vive Tracker".into()));
set_prop(ModelNumber("ALVR driver server".into()));
set_prop(ManufacturerName("HTC".into()));
set_prop(RenderModelName("generic_hmd".into()));
set_prop(RegisteredDeviceType("vive".into()));
set_prop(DriverVersion("".into()));
}
HeadsetEmulationMode::Quest2 => {
set_prop(TrackingSystemName("oculus".into()));
set_prop(ModelNumber("Miramar".into()));
@ -141,6 +134,14 @@ pub extern "C" fn set_device_openvr_props(device_id: u64) {
set_prop(RegisteredDeviceType("oculus/1WMHH000X00000".into()));
set_prop(DriverVersion("1.55.0".into()));
}
HeadsetEmulationMode::Vive => {
set_prop(TrackingSystemName("Vive Tracker".into()));
set_prop(ModelNumber("ALVR driver server".into()));
set_prop(ManufacturerName("HTC".into()));
set_prop(RenderModelName("generic_hmd".into()));
set_prop(RegisteredDeviceType("vive".into()));
set_prop(DriverVersion("".into()));
}
HeadsetEmulationMode::Custom { props, .. } => {
for prop in props {
set_prop(prop.clone());
@ -264,6 +265,65 @@ pub extern "C" fn set_device_openvr_props(device_id: u64) {
));
}
}
ControllersEmulationMode::RiftSTouch => {
set_prop(TrackingSystemName("oculus".into()));
set_prop(ManufacturerName("Oculus".into()));
if device_id == *LEFT_HAND_ID {
set_prop(ModelNumber("Oculus Rift S (Left Controller)".into()));
set_prop(RenderModelName("oculus_rifts_controller_left".into()));
set_prop(RegisteredDeviceType(
"oculus/1WMGH000XX0000_Controller_Left".into(),
));
} else if device_id == *RIGHT_HAND_ID {
set_prop(ModelNumber("Oculus Rift S (Right Controller)".into()));
set_prop(RenderModelName("oculus_rifts_controller_right".into()));
set_prop(RegisteredDeviceType(
"oculus/1WMGH000XX0000_Controller_Right".into(),
));
}
set_prop(ControllerType("oculus_touch".into()));
set_prop(InputProfilePath("{oculus}/input/touch_profile.json".into()));
if device_id == *LEFT_HAND_ID {
set_prop(NamedIconPathDeviceOff(
"{oculus}/icons/rifts_left_controller_off.png".into(),
));
set_prop(NamedIconPathDeviceSearching(
"{oculus}/icons/rifts_left_controller_searching.gif".into(),
));
set_prop(NamedIconPathDeviceSearchingAlert(
"{oculus}/icons/rifts_left_controller_searching_alert.gif".into(),
));
set_prop(NamedIconPathDeviceReady(
"{oculus}/icons/rifts_left_controller_ready.png".into(),
));
set_prop(NamedIconPathDeviceReadyAlert(
"{oculus}/icons/rifts_left_controller_ready_alert.png".into(),
));
set_prop(NamedIconPathDeviceAlertLow(
"{oculus}/icons/rifts_left_controller_ready_low.png".into(),
));
} else if device_id == *RIGHT_HAND_ID {
set_prop(NamedIconPathDeviceOff(
"{oculus}/icons/rifts_right_controller_off.png".into(),
));
set_prop(NamedIconPathDeviceSearching(
"{oculus}/icons/rifts_right_controller_searching.gif".into(),
));
set_prop(NamedIconPathDeviceSearchingAlert(
"{oculus}/icons/rifts_right_controller_searching_alert.gif".into(),
));
set_prop(NamedIconPathDeviceReady(
"{oculus}/icons/rifts_right_controller_ready.png".into(),
));
set_prop(NamedIconPathDeviceReadyAlert(
"{oculus}/icons/rifts_right_controller_ready_alert.png".into(),
));
set_prop(NamedIconPathDeviceAlertLow(
"{oculus}/icons/rifts_right_controller_ready_low.png".into(),
));
}
}
ControllersEmulationMode::ValveIndex => {
set_prop(TrackingSystemName("indexcontroller".into()));
set_prop(ManufacturerName("Valve".into()));

View File

@ -550,9 +550,9 @@ pub struct AudioConfig {
pub enum HeadsetEmulationMode {
#[schema(strings(display_name = "Rift S"))]
RiftS,
Vive,
#[schema(strings(display_name = "Quest 2"))]
Quest2,
Vive,
Custom {
serial_number: String,
props: Vec<OpenvrProperty>,
@ -583,6 +583,8 @@ pub struct FaceTrackingConfig {
#[derive(SettingsSchema, Serialize, Deserialize, Clone, PartialEq, Eq)]
pub enum ControllersEmulationMode {
#[schema(strings(display_name = "Rift S Touch"))]
RiftSTouch,
#[schema(strings(display_name = "Quest 2 Touch"))]
Quest2Touch,
#[schema(strings(display_name = "Valve Index"))]