Skip to content

Commit d380d66

Browse files
proton: Populate NVIDIA_WINE_DLL_DIR when available
NVIDIA-software may check the environment variable `NVIDIA_WINE_DLL_DIR` for a path where DLLs provided by the NVIDIA Linux driver can be found. This is done as a fallback for when the "DriverStore" cannot be detected via the D3DDDI functions for querying an adapter-specific registry key. Tested with an application that reads `NVIDIA_WINE_DLL_DIR` from the environment and tries to load a known DLL from it. As expected manually setting the environment variable to the on-disk location did not work, as the path is not accurate within the pressure-vessel environment.
1 parent f205ee9 commit d380d66

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

proton

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -997,11 +997,14 @@ class CompatData:
997997

998998
# Try to detect known DLLs that ship with the NVIDIA Linux Driver
999999
# and add them into the prefix
1000-
nvidia_wine_dll_dir = find_nvidia_wine_dll_dir()
1001-
if nvidia_wine_dll_dir:
1000+
if g_session.nvidia_wine_dll_dir:
10021001
for dll in ["_nvngx.dll", "nvngx.dll"]:
1003-
try_copy(nvidia_wine_dll_dir + "/" + dll, "drive_c/windows/system32", optional=True,
1004-
prefix=self.prefix_dir, track_file=tracked_files, link_debug=True)
1002+
try_copy(g_session.nvidia_wine_dll_dir + "/" + dll,
1003+
"drive_c/windows/system32",
1004+
optional=True,
1005+
prefix=self.prefix_dir,
1006+
track_file=tracked_files,
1007+
link_debug=True)
10051008

10061009
setup_game_dir_drive()
10071010
setup_steam_dir_drive()
@@ -1461,6 +1464,17 @@ class Session:
14611464
if "PROTON_CRASH_REPORT_DIR" in self.env:
14621465
self.env["WINE_CRASH_REPORT_DIR"] = self.env["PROTON_CRASH_REPORT_DIR"]
14631466

1467+
# NVIDIA software may check for the "DriverStore" by querying the
1468+
# NGXCore\NGXPath registry key via `D3DDDI_QUERYREGISTRY_SERVICEKEY` for
1469+
# a given adapter. In the case where this path cannot be found, the
1470+
# `NVIDIA_WINE_DLL_DIR` environment variable is read as a fallback.
1471+
#
1472+
# TODO: Add support for populating NGXCore\NGXPath so we can remove the
1473+
# NGX copies done in setup_prefix(), and this environment variable.
1474+
self.nvidia_wine_dll_dir = find_nvidia_wine_dll_dir()
1475+
if self.nvidia_wine_dll_dir:
1476+
self.env["NVIDIA_WINE_DLL_DIR"] = self.nvidia_wine_dll_dir
1477+
14641478
if "PROTON_LOG" in self.env and nonzero(self.env["PROTON_LOG"]):
14651479
if self.setup_logging(append_forever=False):
14661480
self.log_file.write("======================\n")

0 commit comments

Comments
 (0)