vrclient: Support for HmdSystemFactory export

Fixes a crash in Half-Life 2 in settings, and other legacy VR titles
This commit is contained in:
Joshua Ashton 2019-08-06 10:18:50 +01:00 committed by Andrew Eikum
parent 53b24d7188
commit 948aeac50d
2 changed files with 18 additions and 1 deletions

View file

@ -204,6 +204,7 @@ static pfn_dtor get_win_destructor(const char *name)
}
static void *vrclient_lib;
static void *(*vrclient_HmdSystemFactory)(const char *name, int *return_code);
static void *(*vrclient_VRClientCoreFactory)(const char *name, int *return_code);
static int load_vrclient(void)
@ -232,6 +233,12 @@ static int load_vrclient(void)
return 0;
}
vrclient_HmdSystemFactory = wine_dlsym(vrclient_lib, "HmdSystemFactory", NULL, 0);
if(!vrclient_HmdSystemFactory){
ERR("unable to load HmdSystemFactory method\n");
return 0;
}
vrclient_VRClientCoreFactory = wine_dlsym(vrclient_lib, "VRClientCoreFactory", NULL, 0);
if(!vrclient_VRClientCoreFactory){
ERR("unable to load VRClientCoreFactory method\n");
@ -241,6 +248,16 @@ static int load_vrclient(void)
return 1;
}
void *CDECL HmdSystemFactory(const char *name, int *return_code)
{
TRACE("name: %s, return_code: %p\n", name, return_code);
if(!load_vrclient())
return NULL;
return create_win_interface(name, vrclient_HmdSystemFactory(name, return_code));
}
void *CDECL VRClientCoreFactory(const char *name, int *return_code)
{
TRACE("name: %s, return_code: %p\n", name, return_code);

View file

@ -1,4 +1,4 @@
# Generated from vrclient.dll by winedump
1 stub HmdSystemFactory
1 stdcall HmdSystemFactory(ptr ptr)
2 stdcall VRClientCoreFactory(ptr ptr)