steam_helper: Store OpenXR vulkan extensions in registry.

CW-Bug-ID: #19504
This commit is contained in:
Paul Gofman 2021-10-05 20:36:30 +03:00 committed by Arkadiusz Hiler
parent 034ff27cf3
commit daf8263323

View File

@ -548,6 +548,7 @@ extern "C"
static DWORD WINAPI initialize_vr_data(void *arg)
{
int (WINAPI *p__wineopenxr_get_extensions_internal)(char **instance_extensions, char **device_extensions);
vr::IVRClientCore* (*vrclient_VRClientCoreFactory)(const char *name, int *return_code);
uint32_t instance_extensions_count, device_count;
VkPhysicalDevice *phys_devices = NULL;
@ -557,6 +558,7 @@ static DWORD WINAPI initialize_vr_data(void *arg)
VkApplicationInfo app_info = {};
char *buffer = NULL, *new_buffer;
vr::IVRClientCore* client_core;
char *xr_inst_ext, *xr_dev_ext;
vr::IVRCompositor* compositor;
VkInstance vk_instance = NULL;
BOOL vr_initialized = FALSE;
@ -567,6 +569,7 @@ static DWORD WINAPI initialize_vr_data(void *arg)
const char *env_str;
unsigned int app_id;
unsigned int length;
HMODULE hwineopenxr;
void *lib_vrclient;
DWORD hmd_present;
int return_code;
@ -721,6 +724,40 @@ static DWORD WINAPI initialize_vr_data(void *arg)
}
}
if ((hwineopenxr = LoadLibraryA("wineopenxr.dll")))
{
p__wineopenxr_get_extensions_internal = reinterpret_cast<decltype(p__wineopenxr_get_extensions_internal)>
(GetProcAddress(hwineopenxr, "__wineopenxr_get_extensions_internal"));
if (p__wineopenxr_get_extensions_internal)
{
if (!p__wineopenxr_get_extensions_internal(&xr_inst_ext, &xr_dev_ext))
{
WINE_TRACE("Got XR extensions.\n");
if ((status = RegSetValueExA(vr_key, "openxr_vulkan_instance_extensions", 0, REG_SZ,
(BYTE *)xr_inst_ext, strlen(xr_inst_ext) + 1)))
{
WINE_ERR("Could not set openxr_vulkan_instance_extensions value, status %#x.\n", status);
return FALSE;
}
if ((status = RegSetValueExA(vr_key, "openxr_vulkan_device_extensions", 0, REG_SZ,
(BYTE *)xr_dev_ext, strlen(xr_dev_ext) + 1)))
{
WINE_ERR("Could not set openxr_vulkan_device_extensions value, status %#x.\n", status);
return FALSE;
}
}
}
else
{
WINE_ERR("__wineopenxr_get_extensions_internal not found in wineopenxr.dll.\n");
}
FreeLibrary(hwineopenxr);
}
else
{
WINE_WARN("Could not load wineopenxr.dll, err %u.\n", GetLastError());
}
vr_status = 1;
done: