Skip to content

Commit

Permalink
change external tracking to not use the oculus api at all
Browse files Browse the repository at this point in the history
change external tracking to not use the oculus api at all
  • Loading branch information
mm0zct committed Mar 31, 2024
1 parent 9431c8c commit 3f4273e
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 45 deletions.
Binary file modified CustomHMD/.vs/CustomHMD/v17/.suo
Binary file not shown.
66 changes: 34 additions & 32 deletions CustomHMD/.vs/CustomHMD/v17/DocumentLayout.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
"RelativeMoniker": "D:0:0:{A47C788B-1BDA-4057-87A9-FC35ED711B44}|CustomHMD.vcxproj|solutionrelative:OculusTouchLink.cpp||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{A47C788B-1BDA-4057-87A9-FC35ED711B44}|CustomHMD.vcxproj|C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\Common.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{A47C788B-1BDA-4057-87A9-FC35ED711B44}|CustomHMD.vcxproj|solutionrelative:Common.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{A47C788B-1BDA-4057-87A9-FC35ED711B44}|CustomHMD.vcxproj|C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\TouchTrackerDriver.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{A47C788B-1BDA-4057-87A9-FC35ED711B44}|CustomHMD.vcxproj|solutionrelative:TouchTrackerDriver.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
"AbsoluteMoniker": "D:0:0:{A47C788B-1BDA-4057-87A9-FC35ED711B44}|CustomHMD.vcxproj|C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\TouchControllerDriver.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{A47C788B-1BDA-4057-87A9-FC35ED711B44}|CustomHMD.vcxproj|solutionrelative:TouchControllerDriver.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{A47C788B-1BDA-4057-87A9-FC35ED711B44}|CustomHMD.vcxproj|C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\HeadsetTrackerDriver.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{A47C788B-1BDA-4057-87A9-FC35ED711B44}|CustomHMD.vcxproj|solutionrelative:HeadsetTrackerDriver.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{A47C788B-1BDA-4057-87A9-FC35ED711B44}|CustomHMD.vcxproj|C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\TouchControllerDriver.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{A47C788B-1BDA-4057-87A9-FC35ED711B44}|CustomHMD.vcxproj|solutionrelative:TouchControllerDriver.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
"AbsoluteMoniker": "D:0:0:{A47C788B-1BDA-4057-87A9-FC35ED711B44}|CustomHMD.vcxproj|C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\TouchTrackerDriver.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{A47C788B-1BDA-4057-87A9-FC35ED711B44}|CustomHMD.vcxproj|solutionrelative:TouchTrackerDriver.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{A47C788B-1BDA-4057-87A9-FC35ED711B44}|CustomHMD.vcxproj|C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\Common.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{A47C788B-1BDA-4057-87A9-FC35ED711B44}|CustomHMD.vcxproj|solutionrelative:Common.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
}
],
"DocumentGroupContainers": [
Expand All @@ -30,19 +30,31 @@
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": 5,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Document",
"DocumentIndex": 1,
"DocumentIndex": 4,
"Title": "Common.h",
"DocumentMoniker": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\Common.h",
"RelativeDocumentMoniker": "Common.h",
"ToolTip": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\Common.h",
"RelativeToolTip": "Common.h",
"ViewState": "AQIAAEcAAAAAAAAAAAAAAEwAAAAbAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-28T22:31:24.439Z",
"WhenOpened": "2024-03-28T22:31:24.439Z"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "OculusTouchLink.cpp",
"DocumentMoniker": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\OculusTouchLink.cpp",
"RelativeDocumentMoniker": "OculusTouchLink.cpp",
"ToolTip": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\OculusTouchLink.cpp",
"RelativeToolTip": "OculusTouchLink.cpp",
"ViewState": "AQIAALIBAAAAAAAAAAAUwLYBAAAHAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-28T22:31:24.728Z",
"EditorCaption": ""
},
{
Expand All @@ -51,51 +63,41 @@
},
{
"$type": "Document",
"DocumentIndex": 2,
"DocumentIndex": 3,
"Title": "TouchTrackerDriver.h",
"DocumentMoniker": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\TouchTrackerDriver.h",
"RelativeDocumentMoniker": "TouchTrackerDriver.h",
"ToolTip": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\TouchTrackerDriver.h",
"RelativeToolTip": "TouchTrackerDriver.h",
"ViewState": "AQIAAMkAAAAAAAAAAAAAANkAAABzAAAA",
"ViewState": "AQIAAHYAAAAAAAAAAAAUwIYAAAAjAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-28T22:31:24.214Z"
"WhenOpened": "2024-03-28T22:31:24.214Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 3,
"DocumentIndex": 2,
"Title": "HeadsetTrackerDriver.h",
"DocumentMoniker": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\HeadsetTrackerDriver.h",
"RelativeDocumentMoniker": "HeadsetTrackerDriver.h",
"ToolTip": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\HeadsetTrackerDriver.h",
"RelativeToolTip": "HeadsetTrackerDriver.h",
"ViewState": "AQIAAJwAAAAAAAAAAAAAALAAAAAJAAAA",
"ViewState": "AQIAAAAAAAAAAAAAAAAAABIAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-28T22:31:24.336Z"
"WhenOpened": "2024-03-28T22:31:24.336Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"DocumentIndex": 1,
"Title": "TouchControllerDriver.h",
"DocumentMoniker": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\TouchControllerDriver.h",
"RelativeDocumentMoniker": "TouchControllerDriver.h",
"ToolTip": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\TouchControllerDriver.h",
"RelativeToolTip": "TouchControllerDriver.h",
"ViewState": "AQIAAGwBAAAAAAAAAAAAwHsBAAAAAAAA",
"ViewState": "AQIAAGQAAAAAAAAAAAAUwHkAAAAiAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-28T22:31:24.725Z"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "OculusTouchLink.cpp",
"DocumentMoniker": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\OculusTouchLink.cpp",
"RelativeDocumentMoniker": "OculusTouchLink.cpp",
"ToolTip": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\OculusTouchLink.cpp",
"RelativeToolTip": "OculusTouchLink.cpp",
"ViewState": "AQIAADwBAAAAAAAAAAAAAEkBAAAGAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000677|",
"WhenOpened": "2024-03-28T22:31:24.728Z",
"WhenOpened": "2024-03-28T22:31:24.725Z",
"EditorCaption": ""
}
]
Expand Down
5 changes: 3 additions & 2 deletions CustomHMD/HeadsetTrackerDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@ class CTouchHeadsetTrackerDriver : public vr::ITrackedDeviceServerDriver
ovrTrackingState ss;
if (comm_buffer->config.external_tracking) {
ss = comm_buffer->tracking_state;
}
else {
} else if(mSession){
ss = ovr_GetTrackingState(mSession, (ovr_GetTimeInSeconds() + (comm_buffer->config.extra_prediction_ms * 0.001)),
ovrTrue);
} else {
// error, we switched from external tracking to in-driver tracking which is no longer possible
}
ovr_pose = ss.HeadPose;
DriverPose_t pose = { 0 };
Expand Down
8 changes: 5 additions & 3 deletions CustomHMD/OculusTouchLink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ EVRInitError CServerDriver_OVRTL::Init(vr::IVRDriverContext* pDriverContext)
#endif


if (!mSession) {
if ((!comm_buffer->config.external_tracking) && !mSession) {
#if DRAW_FRAME
ovrInitParams initParams = { ovrInit_RequestVersion, OVR_MINOR_VERSION, NULL, 0, 0 };

Expand Down Expand Up @@ -436,8 +436,10 @@ void CServerDriver_OVRTL::Cleanup()
for (CTouchTrackerDriver* t : trackers) delete t;
trackers.clear();
#endif
ovr_Destroy(mSession);
ovr_Shutdown();
if (mSession) {
ovr_Destroy(mSession);
ovr_Shutdown();
}
#if USE_SHARE_MEM_BUFFER
UnmapViewOfFile(comm_buffer);

Expand Down
2 changes: 1 addition & 1 deletion CustomHMD/Release/driver_OculusTouchLink.dll.recipe
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>C:\Users\the_c\Documents\GitHub\Oculus_Touch_Steam_Link\CustomHMD\Release\x64\driver_OculusTouchLink.dll</FullPath>
<FullPath>C:\Users\the_c\GitHub\Oculus_Touch_Steam_Link\CustomHMD\Release\x64\driver_OculusTouchLink.dll</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
Expand Down
Binary file modified CustomHMD/Release/x64/driver_OculusTouchLink.dll
Binary file not shown.
18 changes: 13 additions & 5 deletions CustomHMD/TouchControllerDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ class CTouchControllerDriver : public vr::ITrackedDeviceServerDriver
vr::VRProperties()->SetStringProperty(m_ulPropertyContainer, vr::Prop_NamedIconPathDeviceStandbyAlert_String, (!isRightHand) ? "{oculus}/icons/cv1_left_controller_standby.png" : "{oculus}/icons/cv1_right_controller_standby.png");


ovrHmdDesc hmd_desc = ovr_GetHmdDesc(mSession);
ovrHmdDesc hmd_desc;
if ((!comm_buffer->config.external_tracking) && mSession) {
hmd_desc = ovr_GetHmdDesc(mSession);
} else {
hmd_desc.Type = ovrHmd_CV1;
}
switch (hmd_desc.Type)
{
case ovrHmd_CV1:
Expand Down Expand Up @@ -301,14 +306,17 @@ class CTouchControllerDriver : public vr::ITrackedDeviceServerDriver
ovrTrackingState ss;
if (comm_buffer->config.external_tracking) {
ss = comm_buffer->tracking_state;
}
else {
} else if (mSession) {
ss = ovr_GetTrackingState(mSession,
(ovr_GetTimeInSeconds() + (comm_buffer->config.extra_prediction_ms * 0.001)),
ovrTrue);
} else {
// error, we switched from external tracking to in-drver tracking
ss.StatusFlags = 0;
}
m_time_of_last_pose = ovr_GetTimeInSeconds();// ss.HandPoses[isRightHand].TimeInSeconds;
float delta_t = (comm_buffer->config.extra_prediction_ms * 0.001f) + (ovr_GetTimeInSeconds() - ss.HandPoses[isRightHand].TimeInSeconds);

//m_time_of_last_pose = ovr_GetTimeInSeconds();// ss.HandPoses[isRightHand].TimeInSeconds;
//float delta_t = (comm_buffer->config.extra_prediction_ms * 0.001f) + (ovr_GetTimeInSeconds() - ss.HandPoses[isRightHand].TimeInSeconds);
DriverPose_t pose = { 0 };
pose.poseIsValid = true;
pose.result = TrackingResult_Running_OK;
Expand Down
Binary file modified ReleasePackage/OculusTouchLink.7z
Binary file not shown.
Binary file not shown.
54 changes: 52 additions & 2 deletions ovr_test/.vs/ovr_test/v17/DocumentLayout.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,66 @@
{
"Version": 1,
"WorkspaceRootPath": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\ovr_test\\",
"Documents": [],
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\ovr_dummy\\LibOVR\\Include\\OVR_Version.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{9A88E3BC-736C-4392-A864-AF691CC7334B}|ovr_test.vcxproj|C:\\USERS\\THE_C\\GITHUB\\OCULUS_TOUCH_STEAM_LINK\\OVR_TEST\\LIBOVR\\INCLUDE\\OVR_VERSION.H||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}",
"RelativeMoniker": "D:0:0:{9A88E3BC-736C-4392-A864-AF691CC7334B}|ovr_test.vcxproj|solutionrelative:LIBOVR\\INCLUDE\\OVR_VERSION.H||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\LibOVR\\Include\\OVR_Version.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}"
}
],
"DocumentGroupContainers": [
{
"Orientation": 0,
"VerticalTabListWidth": 256,
"DocumentGroups": [
{
"DockedWidth": 200,
"SelectedChildIndex": -1,
"SelectedChildIndex": 0,
"Children": [
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "OVR_Version.h",
"DocumentMoniker": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\ovr_dummy\\LibOVR\\Include\\OVR_Version.h",
"RelativeDocumentMoniker": "..\\ovr_dummy\\LibOVR\\Include\\OVR_Version.h",
"ToolTip": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\ovr_dummy\\LibOVR\\Include\\OVR_Version.h",
"RelativeToolTip": "..\\ovr_dummy\\LibOVR\\Include\\OVR_Version.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-28T22:43:23.544Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "OVR_Version.h",
"DocumentMoniker": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\ovr_test\\LibOVR\\Include\\OVR_Version.h",
"RelativeDocumentMoniker": "LibOVR\\Include\\OVR_Version.h",
"ToolTip": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\ovr_test\\LibOVR\\Include\\OVR_Version.h",
"RelativeToolTip": "LibOVR\\Include\\OVR_Version.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-28T22:43:13.211Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "OVR_Version.h",
"DocumentMoniker": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\LibOVR\\Include\\OVR_Version.h",
"RelativeDocumentMoniker": "..\\CustomHMD\\LibOVR\\Include\\OVR_Version.h",
"ToolTip": "C:\\Users\\the_c\\GitHub\\Oculus_Touch_Steam_Link\\CustomHMD\\LibOVR\\Include\\OVR_Version.h",
"RelativeToolTip": "..\\CustomHMD\\LibOVR\\Include\\OVR_Version.h",
"ViewState": "AQIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|",
"WhenOpened": "2024-03-28T22:42:55.891Z",
"EditorCaption": ""
},
{
"$type": "Bookmark",
"Name": "ST:0:0:{cce594b6-0c39-4442-ba28-10c64ac7e89f}"
Expand Down

0 comments on commit 3f4273e

Please sign in to comment.