mirror of
https://github.com/hyblocker/OpenVR-SpaceCalibrator.git
synced 2026-10-07 18:00:21 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8323d64b2d |
No files matched your search
@@ -9,7 +9,7 @@
|
||||
#include <algorithm>
|
||||
#include <imgui/imgui.h>
|
||||
|
||||
#define VERSION_STRING "1.0"
|
||||
#define VERSION_STRING "1.1"
|
||||
|
||||
struct VRDevice
|
||||
{
|
||||
|
||||
@@ -9,15 +9,28 @@ static Hook<void*(*)(vr::IVRDriverContext *, const char *, vr::EVRInitError *)>
|
||||
GetGenericInterfaceHook("IVRDriverContext::GetGenericInterface");
|
||||
|
||||
static Hook<void(*)(vr::IVRServerDriverHost *, uint32_t, const vr::DriverPose_t &, uint32_t)>
|
||||
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<void(*)(vr::IVRServerDriverHost *, uint32_t, const vr::DriverPose_t &, uint32_t)>
|
||||
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))
|
||||
{
|
||||
TrackedDevicePoseUpdatedHook.originalFunc(_this, unWhichDevice, pose, unPoseStructSize);
|
||||
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))
|
||||
{
|
||||
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))
|
||||
{
|
||||
TrackedDevicePoseUpdatedHook.CreateHookInObjectVTable(originalInterface, 1, &DetourTrackedDevicePoseUpdated);
|
||||
IHook::Register(&TrackedDevicePoseUpdatedHook);
|
||||
TrackedDevicePoseUpdatedHook005.CreateHookInObjectVTable(originalInterface, 1, &DetourTrackedDevicePoseUpdated005);
|
||||
IHook::Register(&TrackedDevicePoseUpdatedHook005);
|
||||
}
|
||||
}
|
||||
else if (iface == "IVRServerDriverHost_006")
|
||||
{
|
||||
if (!IHook::Exists(TrackedDevicePoseUpdatedHook006.name))
|
||||
{
|
||||
TrackedDevicePoseUpdatedHook006.CreateHookInObjectVTable(originalInterface, 1, &DetourTrackedDevicePoseUpdated006);
|
||||
IHook::Register(&TrackedDevicePoseUpdatedHook006);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user