-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdllmain.cpp
34 lines (28 loc) · 1020 Bytes
/
dllmain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// dllmain.cpp : Defines the entry point for the DLL application.
#include "pch.h"
#include "CServerDriver.h"
extern "C" __declspec(dllexport) unsigned long NvOptimusEnablement = 1;
char g_modulePath[2048U];
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID /* lpReserved */)
{
switch(ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
GetModuleFileNameA(hModule, g_modulePath, 2048U);
break;
case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
CServerDriver g_serverDriver;
extern "C" __declspec(dllexport) void *HmdDriverFactory(const char *pInterfaceName, int *pReturnCode)
{
void *l_result = nullptr;
if(!strcmp(vr::IServerTrackedDeviceProvider_Version, pInterfaceName)) l_result = dynamic_cast<vr::IServerTrackedDeviceProvider *>(&g_serverDriver);
else
{
if(pReturnCode) *pReturnCode = vr::VRInitError_Init_InterfaceNotFound;
}
return l_result;
}