diff --git a/steam_helper/steam.cpp b/steam_helper/steam.cpp index 0c1d95fd..94c20faa 100644 --- a/steam_helper/steam.cpp +++ b/steam_helper/steam.cpp @@ -545,6 +545,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; @@ -554,6 +555,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; @@ -564,6 +566,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; @@ -718,6 +721,40 @@ static DWORD WINAPI initialize_vr_data(void *arg) } } + if ((hwineopenxr = LoadLibraryA("wineopenxr.dll"))) + { + p__wineopenxr_get_extensions_internal = reinterpret_cast + (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: