Skip to content

Commit 233bfce

Browse files
committed
Fixes
1 parent b07da19 commit 233bfce

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

TOVR/C++/TOVR/TOVR.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
//========== https://github.com/TrueOpenVR ==========
33

44
#include "stdafx.h"
5+
#include <atlstr.h>
56
//#include <Windows.h>
6-
#include <atlstr.h>
77

88
#define DLLEXPORT extern "C" __declspec(dllexport)
99

@@ -41,11 +41,6 @@ _GetControllersData DriverGetControllersData;
4141
_SetControllerData DriverSetControllerData;
4242
_SetCentering DriverSetCentering;
4343

44-
DLLEXPORT DWORD __stdcall GetHMDData(__out THMD *myHMD);
45-
DLLEXPORT DWORD __stdcall GetControllersData(__out TController *myController, __out TController *myController2);
46-
DLLEXPORT DWORD __stdcall SetControllerData(__in int dwIndex, __in WORD MotorSpeed);
47-
DLLEXPORT DWORD __stdcall SetCentering(__in int dwIndex);
48-
4944
HMODULE hDll;
5045

5146
void Init() {
@@ -86,6 +81,10 @@ void Init() {
8681
DriverGetControllersData = (_GetControllersData)GetProcAddress(hDll, "GetControllersData");
8782
DriverSetControllerData = (_SetControllerData)GetProcAddress(hDll, "SetControllerData");
8883
DriverSetCentering = (_SetCentering)GetProcAddress(hDll, "SetCentering");
84+
85+
if (DriverGetHMDData == NULL || DriverGetControllersData == NULL || DriverSetControllerData == NULL || DriverSetCentering == NULL)
86+
hDll = NULL;
87+
8988
}
9089
}
9190
}
@@ -108,7 +107,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReser
108107
break;
109108
}
110109
}
111-
return TRUE;
110+
return true;
112111
}
113112

114113
DLLEXPORT DWORD __stdcall GetHMDData(__out THMD *myHMD)

TOVR/Delphi/TOVR.dpr

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ uses
77
SysUtils, Windows, Registry;
88

99
type
10-
//HMD
1110
PHMD = ^THMD;
1211
_HMDData = record
1312
X: double;
@@ -20,7 +19,6 @@ type
2019
HMD = _HMDData;
2120
THMD = HMD;
2221

23-
//Controllers
2422
PController = ^TController;
2523
_Controller = record
2624
X: double;
@@ -110,6 +108,9 @@ begin
110108
@DriverGetControllersData:=GetProcAddress(DllHandle, 'GetControllersData');
111109
@DriverSetControllerData:=GetProcAddress(DllHandle, 'SetControllerData');
112110
@DriverSetCentering:=GetProcAddress(DllHandle, 'SetCentering');
111+
112+
if (addr(DriverGetHMDData) = nil) or (addr(DriverGetControllersData) = nil) or (addr(DriverSetControllerData) = nil) or (addr(DriverSetCentering) = nil) then
113+
DllHandle:=0;
113114
end;
114115
end;
115116

0 commit comments

Comments
 (0)