Skip to content

Commit

Permalink
SessionDetails: Add a product name hack for Ultrawings.
Browse files Browse the repository at this point in the history
  • Loading branch information
CrossVR committed Feb 22, 2017
1 parent 79b6a4b commit 36251ea
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Revive/REV_CAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ OVR_PUBLIC_FUNCTION(ovrHmdDesc) ovr_GetHmdDesc(ovrSession session)
vr::VRSystem()->GetStringTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_ModelNumber_String, desc.ProductName, 64);
vr::VRSystem()->GetStringTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_ManufacturerName_String, desc.Manufacturer, 64);

// Some games require a fake product name
if (session && session->Details->UseHack(SessionDetails::HACK_FAKE_PRODUCT_NAME))
strncpy(desc.ProductName, "Oculus Rift", 64);

// TODO: Get HID information
desc.VendorId = 0;
desc.ProductId = 0;
Expand Down
5 changes: 3 additions & 2 deletions Revive/SessionDetails.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#include <Shlwapi.h>

SessionDetails::HackInfo SessionDetails::m_known_hacks[] = {
{"drt.exe", HACK_WAIT_IN_TRACKING_STATE, true},
{ "drt.exe", HACK_WAIT_IN_TRACKING_STATE, true },
{ "ultrawings.exe", HACK_FAKE_PRODUCT_NAME, true },
};

SessionDetails::SessionDetails()
Expand All @@ -15,7 +16,7 @@ SessionDetails::SessionDetails()

for (auto& hack : m_known_hacks)
{
if (strcmp(filename, hack.m_filename) == 0)
if (_stricmp(filename, hack.m_filename) == 0)
m_hacks.emplace(hack.m_hack, hack);
}
}
Expand Down
5 changes: 5 additions & 0 deletions Revive/SessionDetails.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ class SessionDetails
// Calling WaitGetPoses() in ovr_GetTrackingState() allows Dirt Rally to do that work before
// we block waiting for running state.
HACK_WAIT_IN_TRACKING_STATE,

// Hack: Use a fake product name.
// 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,
};

SessionDetails();
Expand Down

0 comments on commit 36251ea

Please sign in to comment.