From 841b16bfc4f83d6e944b1f57658b7d968daa5e03 Mon Sep 17 00:00:00 2001 From: Tyson Whitehead Date: Wed, 4 Jun 2025 12:05:38 -0400 Subject: [PATCH 1/2] Revert "vrclient: Mark VRClientCoreFactory, HmdSystemFactory as stdcall." This reverts commit 454533f7e3964a25e787ef8910a81244a686d0f0. This had no effect on x64 as stdcall and cdecl are both ignored by the compiler. On x86 it was caused a crash due to the OpenVR SDK implicitly declaring the factory function as cdecl (the default). Closes issue #8749. --- vrclient_x64/vrclient_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vrclient_x64/vrclient_main.c b/vrclient_x64/vrclient_main.c index 9dec1c6431..f946053c8a 100644 --- a/vrclient_x64/vrclient_main.c +++ b/vrclient_x64/vrclient_main.c @@ -180,7 +180,7 @@ static int load_vrclient(void) return vrclient_loaded; } -void * __stdcall HmdSystemFactory(const char *name, int *return_code) +void *CDECL HmdSystemFactory(const char *name, int *return_code) { struct vrclient_HmdSystemFactory_params params = {.name = name, .return_code = return_code}; TRACE("name: %s, return_code: %p\n", name, return_code); @@ -189,7 +189,7 @@ void * __stdcall HmdSystemFactory(const char *name, int *return_code) return create_win_interface( name, params._ret ); } -void * __stdcall VRClientCoreFactory(const char *name, int *return_code) +void *CDECL VRClientCoreFactory(const char *name, int *return_code) { struct vrclient_VRClientCoreFactory_params params = {.name = name, .return_code = return_code}; TRACE("name: %s, return_code: %p\n", name, return_code); From 297fe2af637961e960c4662553b4f01a26279a7d Mon Sep 17 00:00:00 2001 From: Tyson Whitehead Date: Wed, 4 Jun 2025 12:12:39 -0400 Subject: [PATCH 2/2] vrclient: HmdSystemFactory and VRClientCoreFactory are cdecl Resolves the following linker warnings ld: warning: resolving _HmdSystemFactory@8 by linking to _HmdSystemFactory ld: warning: resolving _VRClientCoreFactory@8 by linking to _VRClientCoreFactory --- vrclient_x64/vrclient.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vrclient_x64/vrclient.spec b/vrclient_x64/vrclient.spec index db5cdd6bc5..051038ecf6 100644 --- a/vrclient_x64/vrclient.spec +++ b/vrclient_x64/vrclient.spec @@ -1,6 +1,6 @@ # Generated from vrclient.dll by winedump -1 stdcall HmdSystemFactory(ptr ptr) -2 stdcall VRClientCoreFactory(ptr ptr) +1 cdecl HmdSystemFactory(ptr ptr) +2 cdecl VRClientCoreFactory(ptr ptr) @ cdecl -private vrclient_init_registry()