diff --git a/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env b/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env index a9cf573839..780a5c075d 100755 --- a/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env +++ b/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-env @@ -1190,12 +1190,15 @@ def time_now(): return time.time() -def upscale_link(source, target): - """target = source's bytes: a hard link when both are on one file system, else a copy. Kept when equal.""" +def upscale_xess(prefix, data): + """Intel's XeSS runtime beside the bridge: libxess.dll loads wl_xess_official.dll from system32. A hard link + when the prefix is on the same file system as the data, else a copy.""" + source = os.path.join(data, "xess", UPSCALE_XESS) + if not os.path.isfile(source): + return "XeSS runtime not downloaded" + target = os.path.join(prefix, "pfx", "drive_c", "windows", "system32", UPSCALE_XESS) if os.path.isfile(target) and os.path.getsize(target) == os.path.getsize(source): - with open(source, "rb") as a, open(target, "rb") as b: - if a.read() == b.read(): - return + return None staged = target + ".droiddeck-tmp" if os.path.lexists(staged): os.unlink(staged) @@ -1209,32 +1212,6 @@ def upscale_link(source, target): break dst.write(chunk) os.replace(staged, target) - - -# NGX loads its core by full path from the registry's NGXCore FullPath (C:\windows\system32), which the bridge -# folder on WINEDLLPATH does not answer (Bright Memory: Infinite, "failed to load C:\windows\system32\_nvngx.dll"). -UPSCALE_NGX_CORE = ("_nvngx.dll", "nvngx.dll") - - -def upscale_ngx_core(prefix, bridges): - """The bridge's NGX core DLLs as files in the prefix's system32 (DLSS mode).""" - system32 = os.path.join(prefix, "pfx", "drive_c", "windows", "system32") - if not os.path.isdir(system32): - return False - for name in UPSCALE_NGX_CORE: - source = os.path.join(bridges, "x86_64-windows", name) - if os.path.isfile(source): - upscale_link(source, os.path.join(system32, name)) - return True - - -def upscale_xess(prefix, data): - """Intel's XeSS runtime beside the bridge: libxess.dll loads wl_xess_official.dll from system32. A hard link - when the prefix is on the same file system as the data, else a copy.""" - source = os.path.join(data, "xess", UPSCALE_XESS) - if not os.path.isfile(source): - return "XeSS runtime not downloaded" - upscale_link(source, os.path.join(prefix, "pfx", "drive_c", "windows", "system32", UPSCALE_XESS)) return None @@ -1303,11 +1280,6 @@ def upscale_settings(env, prefix): notes.append("NVIDIA NGX registry entries added to the prefix (DLSS mode)") except OSError as error: notes.append("NGX registry entries not written (%s)" % error) - try: - if prefix: - upscale_ngx_core(prefix, bridges) - except OSError as error: - notes.append("NGX core DLLs not placed in system32 (%s)" % error) elif mode == "native": result["DROIDDECK_UPSCALE_SPOOF_DLSS"] = "0" result["DROIDDECK_UPSCALE_GPU_SPOOF"] = "rdna4" diff --git a/tools/tests/test_game_environment.py b/tools/tests/test_game_environment.py index 6eca5f1c17..dc593c8aaf 100644 --- a/tools/tests/test_game_environment.py +++ b/tools/tests/test_game_environment.py @@ -101,25 +101,6 @@ class UpscalerSettingsTest(unittest.TestCase): self.assertEqual(b"MZ-xess", target.read_bytes()) self.assertEqual(source.stat().st_ino, target.stat().st_ino) - def test_dlss_mode_puts_the_ngx_core_in_system32_and_refreshes_it(self): - prefix = tempfile.mkdtemp() - self.addCleanup(shutil.rmtree, prefix, True) - Path(prefix, "pfx/drive_c/windows/system32").mkdir(parents=True) - for name in ("_nvngx.dll", "nvngx.dll"): - Path(self.root, "bridges/x86_64-windows", name).write_bytes(b"MZ-v1") - MODULE["upscale_settings"]({"DROIDDECK_UPSCALE_MODE": "dlss"}, prefix) - core = Path(prefix, "pfx/drive_c/windows/system32/_nvngx.dll") - self.assertEqual(b"MZ-v1", core.read_bytes()) - Path(self.root, "bridges/x86_64-windows/_nvngx.dll").unlink() - Path(self.root, "bridges/x86_64-windows/_nvngx.dll").write_bytes(b"MZ-v2") - MODULE["upscale_settings"]({"DROIDDECK_UPSCALE_MODE": "dlss"}, prefix) - self.assertEqual(b"MZ-v2", core.read_bytes()) - other = tempfile.mkdtemp() - self.addCleanup(shutil.rmtree, other, True) - Path(other, "pfx/drive_c/windows/system32").mkdir(parents=True) - MODULE["upscale_settings"]({"DROIDDECK_UPSCALE_MODE": "fsr"}, other) - self.assertFalse(Path(other, "pfx/drive_c/windows/system32/_nvngx.dll").exists()) - def test_a_game_started_on_xess_without_the_runtime_says_so(self): prefix = tempfile.mkdtemp() self.addCleanup(shutil.rmtree, prefix, True)