mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 12:35:42 +00:00
Revert "game-env: put the NGX core DLLs into system32 in DLSS mode"
Tested on the Red Magic 12 Pro with both DLLs in Bright Memory: Infinite's system32: NGX still logs
"failed to load C:\windows\system32\_nvngx.dll" and D3D12_Init returns FeatureNotSupported. The
missing files were not the cause; the game never loads the bridge's nvapi64.dll ("Failed to
initialize NVAPI"), so the signature-fix hooks do not run. Open.
This commit is contained in:
1 parent
73442ad3e0
commit
bb5c53a793
2 files changed
+8
-55
No files matched your search
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user