diff --git a/OpenVR-SpaceCalibrator/UserInterface.cpp b/OpenVR-SpaceCalibrator/UserInterface.cpp index 4e5f24d..6981651 100644 --- a/OpenVR-SpaceCalibrator/UserInterface.cpp +++ b/OpenVR-SpaceCalibrator/UserInterface.cpp @@ -9,7 +9,7 @@ #include #include -#define VERSION_STRING "1.0" +#define VERSION_STRING "1.1" struct VRDevice { diff --git a/OpenVR-SpaceCalibratorDriver/InterfaceHookInjector.cpp b/OpenVR-SpaceCalibratorDriver/InterfaceHookInjector.cpp index 5053502..6211746 100644 --- a/OpenVR-SpaceCalibratorDriver/InterfaceHookInjector.cpp +++ b/OpenVR-SpaceCalibratorDriver/InterfaceHookInjector.cpp @@ -9,15 +9,28 @@ static Hook GetGenericInterfaceHook("IVRDriverContext::GetGenericInterface"); static Hook - TrackedDevicePoseUpdatedHook("IVRServerDriverHost005::TrackedDevicePoseUpdated"); + TrackedDevicePoseUpdatedHook005("IVRServerDriverHost005::TrackedDevicePoseUpdated"); -static void DetourTrackedDevicePoseUpdated(vr::IVRServerDriverHost *_this, uint32_t unWhichDevice, const vr::DriverPose_t &newPose, uint32_t unPoseStructSize) +static Hook + TrackedDevicePoseUpdatedHook006("IVRServerDriverHost006::TrackedDevicePoseUpdated"); + +static void DetourTrackedDevicePoseUpdated005(vr::IVRServerDriverHost *_this, uint32_t unWhichDevice, const vr::DriverPose_t &newPose, uint32_t unPoseStructSize) +{ + //TRACE("ServerTrackedDeviceProvider::DetourTrackedDevicePoseUpdated(%d)", unWhichDevice); + auto pose = newPose; + if (Driver->HandleDevicePoseUpdated(unWhichDevice, pose)) + { + TrackedDevicePoseUpdatedHook005.originalFunc(_this, unWhichDevice, pose, unPoseStructSize); + } +} + +static void DetourTrackedDevicePoseUpdated006(vr::IVRServerDriverHost *_this, uint32_t unWhichDevice, const vr::DriverPose_t &newPose, uint32_t unPoseStructSize) { //TRACE("ServerTrackedDeviceProvider::DetourTrackedDevicePoseUpdated(%d)", unWhichDevice); auto pose = newPose; if (Driver->HandleDevicePoseUpdated(unWhichDevice, pose)) { - TrackedDevicePoseUpdatedHook.originalFunc(_this, unWhichDevice, pose, unPoseStructSize); + TrackedDevicePoseUpdatedHook006.originalFunc(_this, unWhichDevice, pose, unPoseStructSize); } } @@ -29,10 +42,18 @@ static void *DetourGetGenericInterface(vr::IVRDriverContext *_this, const char * std::string iface(pchInterfaceVersion); if (iface == "IVRServerDriverHost_005") { - if (!IHook::Exists(TrackedDevicePoseUpdatedHook.name)) + if (!IHook::Exists(TrackedDevicePoseUpdatedHook005.name)) + { + TrackedDevicePoseUpdatedHook005.CreateHookInObjectVTable(originalInterface, 1, &DetourTrackedDevicePoseUpdated005); + IHook::Register(&TrackedDevicePoseUpdatedHook005); + } + } + else if (iface == "IVRServerDriverHost_006") + { + if (!IHook::Exists(TrackedDevicePoseUpdatedHook006.name)) { - TrackedDevicePoseUpdatedHook.CreateHookInObjectVTable(originalInterface, 1, &DetourTrackedDevicePoseUpdated); - IHook::Register(&TrackedDevicePoseUpdatedHook); + TrackedDevicePoseUpdatedHook006.CreateHookInObjectVTable(originalInterface, 1, &DetourTrackedDevicePoseUpdated006); + IHook::Register(&TrackedDevicePoseUpdatedHook006); } }