Skip to content
Permalink
Browse files

Hotfix for Windows Mixed Reality sensors errors.

  • Loading branch information
CrossVR committed Dec 3, 2017
1 parent b21d053 commit a38bf704bab9887b25204b51cbc6c2fdc49bc1c3
Showing with 31 additions and 5 deletions.
  1. +11 −0 Revive/REV_CAPI.cpp
  2. +12 −3 Revive/SessionDetails.cpp
  3. +6 −0 Revive/SessionDetails.h
  4. +2 −2 ReviveOverlay/ReviveOverlay_resource.rc
@@ -145,6 +145,9 @@ OVR_PUBLIC_FUNCTION(unsigned int) ovr_GetTrackerCount(ovrSession session)
if (!session)
return ovrError_InvalidSession;

if (session->Details->UseHack(SessionDetails::HACK_SPOOF_SENSORS))
return 2;

return (unsigned int)session->Details->TrackerCount;
}

@@ -340,6 +343,14 @@ OVR_PUBLIC_FUNCTION(ovrTrackerPose) ovr_GetTrackerPose(ovrSession session, unsig
if (!session)
return tracker;

if (session->Details->UseHack(SessionDetails::HACK_SPOOF_SENSORS))
{
tracker.LeveledPose = OVR::Posef::Identity();
tracker.Pose = OVR::Posef::Identity();
tracker.TrackerFlags = ovrTracker_Connected;
return tracker;
}

// Get the index for this tracker.
vr::TrackedDeviceIndex_t trackers[vr::k_unMaxTrackedDeviceCount] = { vr::k_unTrackedDeviceIndexInvalid };
vr::VRSystem()->GetSortedTrackedDeviceIndicesOfClass(vr::TrackedDeviceClass_TrackingReference, trackers, vr::k_unMaxTrackedDeviceCount);
@@ -4,10 +4,12 @@
#include <Windows.h>
#include <Shlwapi.h>
#include <openvr.h>
#include <vector>

SessionDetails::HackInfo SessionDetails::m_known_hacks[] = {
{ "drt.exe", HACK_WAIT_IN_TRACKING_STATE, true },
{ "ultrawings.exe", HACK_FAKE_PRODUCT_NAME, true },
{ "drt.exe", nullptr, HACK_WAIT_IN_TRACKING_STATE, false }, // TODO: Fix this hack
{ "ultrawings.exe", nullptr, HACK_FAKE_PRODUCT_NAME, true },
{ nullptr, "holographic", HACK_SPOOF_SENSORS, true }
};

SessionDetails::SessionDetails()
@@ -19,9 +21,16 @@ SessionDetails::SessionDetails()
GetModuleFileNameA(NULL, filepath, MAX_PATH);
char* filename = PathFindFileNameA(filepath);

uint32_t size = vr::VRSystem()->GetStringTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd,
vr::Prop_TrackingSystemName_String, nullptr, 0);
std::vector<char> driver(size);
vr::VRSystem()->GetStringTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd,
vr::Prop_TrackingSystemName_String, driver.data(), size);

for (auto& hack : m_known_hacks)
{
if (_stricmp(filename, hack.m_filename) == 0)
if ((!hack.m_filename || _stricmp(filename, hack.m_filename) == 0) &&
(!hack.m_driver || strcmp(driver.data(), hack.m_driver) == 0))
m_hacks.emplace(hack.m_hack, hack);
}

@@ -22,6 +22,11 @@ class SessionDetails
// Games like Ultrawings will actually check whether the product name contains the string
// "Oculus", so we use a fake name for the HMD to work around this issue.
HACK_FAKE_PRODUCT_NAME,

// Hack: Spoof the number of connected sensors.
// Some headsets don't have external trackers, so we have to spoof the number of connected
// sensors.
HACK_SPOOF_SENSORS,
};

SessionDetails();
@@ -41,6 +46,7 @@ class SessionDetails
struct HackInfo
{
const char* m_filename; // The filename of the main executable
const char* m_driver; // The name of the driver
Hack m_hack; // Which hack is it?
bool m_usehack; // Should it use the hack?
};
@@ -7,8 +7,8 @@
IDI_ICON1 ICON DISCARDABLE "revive.ico"

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,2,0,2
PRODUCTVERSION 1,2,0,2
FILEVERSION 1,2,0,3
PRODUCTVERSION 1,2,0,3
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG

0 comments on commit a38bf70

Please sign in to comment.
You can’t perform that action at this time.