From c3c36571b6f94bfb298ff4c2c49b0927beeb5a03 Mon Sep 17 00:00:00 2001 From: r57zone Date: Fri, 6 Oct 2023 16:27:54 +0400 Subject: [PATCH] Fixes: Button codes and OpenXR, Unity movement by HadesVR --- .../driver_arduinohmd/driver_arduinohmd.cpp | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/OpenVR/samples/driver_arduinohmd/driver_arduinohmd.cpp b/OpenVR/samples/driver_arduinohmd/driver_arduinohmd.cpp index 752d388..f9c28f2 100644 --- a/OpenVR/samples/driver_arduinohmd/driver_arduinohmd.cpp +++ b/OpenVR/samples/driver_arduinohmd/driver_arduinohmd.cpp @@ -271,8 +271,8 @@ int KeyNameToKeyCode(std::string KeyName) { else if (KeyName == "I") return 'I'; else if (KeyName == "O") return 'O'; else if (KeyName == "P") return 'P'; - else if (KeyName == "[") return '['; - else if (KeyName == "]") return ']'; + else if (KeyName == "[") return 219; + else if (KeyName == "]") return 221; else if (KeyName == "A") return 'A'; else if (KeyName == "S") return 'S'; else if (KeyName == "D") return 'D'; @@ -282,8 +282,8 @@ int KeyNameToKeyCode(std::string KeyName) { else if (KeyName == "J") return 'J'; else if (KeyName == "K") return 'K'; else if (KeyName == "L") return 'L'; - else if (KeyName == ";") return 186; - else if (KeyName == "'") return 222; + else if (KeyName == ":") return 186; + else if (KeyName == "APOSTROPHE") return 222; else if (KeyName == "\\") return 220; else if (KeyName == "Z") return 'Z'; else if (KeyName == "X") return 'X'; @@ -410,6 +410,24 @@ class CDeviceDriver : public vr::ITrackedDeviceServerDriver, public vr::IVRDispl vr::VRProperties()->SetStringProperty( m_ulPropertyContainer, Prop_ModelNumber_String, m_sModelNumber.c_str() ); vr::VRProperties()->SetStringProperty( m_ulPropertyContainer, Prop_RenderModelName_String, m_sModelNumber.c_str() ); + + vr::VRProperties()->SetStringProperty(m_ulPropertyContainer, Prop_SerialNumber_String, m_sSerialNumber.c_str()); + vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_WillDriftInYaw_Bool, false); + vr::VRProperties()->SetStringProperty(m_ulPropertyContainer, Prop_ManufacturerName_String, "OpenVR-ArduinoHMD"); + vr::VRProperties()->SetStringProperty(m_ulPropertyContainer, Prop_TrackingFirmwareVersion_String, "1.0"); + vr::VRProperties()->SetStringProperty(m_ulPropertyContainer, Prop_HardwareRevision_String, "1.0"); + vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_DeviceIsWireless_Bool, false); + vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_DeviceIsCharging_Bool, false); + vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_CanUnifyCoordinateSystemWithHmd_Bool, true); + vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_ContainsProximitySensor_Bool, false); + vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, Prop_DeviceCanPowerOff_Bool, false); + vr::VRProperties()->SetInt32Property(m_ulPropertyContainer, vr::Prop_DeviceClass_Int32, vr::TrackedDeviceClass_HMD); + vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, vr::Prop_HasCamera_Bool, false); + vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, vr::Prop_Firmware_ForceUpdateRequired_Bool, false); + vr::VRProperties()->SetStringProperty(m_ulPropertyContainer, vr::Prop_RegisteredDeviceType_String, "HMD"); + vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, vr::Prop_NeverTracked_Bool, false); + vr::VRProperties()->SetBoolProperty(m_ulPropertyContainer, vr::Prop_Identifiable_Bool, false); + vr::VRProperties()->SetFloatProperty( m_ulPropertyContainer, Prop_UserIpdMeters_Float, m_flIPD ); vr::VRProperties()->SetFloatProperty( m_ulPropertyContainer, Prop_UserHeadToEyeDepthMeters_Float, 0.f ); vr::VRProperties()->SetFloatProperty( m_ulPropertyContainer, Prop_DisplayFrequency_Float, m_flDisplayFrequency ); @@ -607,6 +625,9 @@ class CDeviceDriver : public vr::ITrackedDeviceServerDriver, public vr::IVRDispl pose.qWorldFromDriverRotation = HmdQuaternion_Init(1, 0, 0, 0); pose.qDriverFromHeadRotation = HmdQuaternion_Init(1, 0, 0, 0); + pose.shouldApplyHeadModel = true; + pose.poseTimeOffset = 0; + pose.willDriftInYaw = false; if (HMDConnected || ArduinoNotRequire) {