mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 19:39:57 -04:00
Ship NVIDIA's DLSS library in the setup and the build kit, and put it beside the game.
The release carried AMD's FSR 3.1 library but not nvngx_dlss.dll, so DLSS ran only where the NVIDIA driver supplied the model itself; elsewhere players had to fetch the DLL by hand. tools/make_launcher.py and tools/make_kit.py now download NVIDIA's own build from the DLSS SDK repository at a pinned tag (tools/dlss_pin.py: 310.9.1, checked against its size and SHA-256, cached), and put it in the release's bin/ with a notice naming the NVIDIA RTX SDKs License that covers it. --dlss FILE takes a copy on disk instead, --no-dlss leaves it out. tools/make_game.py copies the DLL and its notice beside the game. A different nvngx_dlss.dll the player put there is kept; the one an earlier build placed (named by the notice's sha256 line) is replaced, so a newer release can bring a newer DLSS. The compile step's key covers make_game.py and the kit version, so existing installs get the DLL with their next update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -497,6 +497,39 @@ def copy_if_changed(src, dst):
|
||||
return True
|
||||
|
||||
|
||||
DLSS_DLL, DLSS_NOTICE = 'nvngx_dlss.dll', 'nvngx_dlss-NOTICE.txt' # tools/dlss_pin.py, in the kit's bin/
|
||||
|
||||
|
||||
def notice_sha256(path):
|
||||
"""The sha256 line of a DLSS notice: the DLL a kit placed beside the game."""
|
||||
try:
|
||||
for line in path.read_text(encoding='utf-8').splitlines():
|
||||
if line.startswith('sha256 '):
|
||||
return line.split()[1].lower()
|
||||
except (OSError, UnicodeDecodeError):
|
||||
pass
|
||||
return None
|
||||
|
||||
|
||||
def place_dlss(out):
|
||||
"""NVIDIA's DLSS library from the kit's bin/ beside the game, where NGX loads it (runtime/vk_dlaa.c), with its
|
||||
notice. A different nvngx_dlss.dll the player put there (another DLSS version) is kept; the one an earlier build
|
||||
placed, named by the notice beside it, is replaced. Returns a line for the build's log when it kept the player's."""
|
||||
src, dst, note = KIT / 'bin' / DLSS_DLL, out / DLSS_DLL, KIT / 'bin' / DLSS_NOTICE
|
||||
if not src.is_file():
|
||||
return None
|
||||
if dst.is_file():
|
||||
s, d = os.stat(src), os.stat(dst)
|
||||
if d.st_size != s.st_size or int(d.st_mtime) != int(s.st_mtime):
|
||||
have = sha256_file(dst)
|
||||
if have != notice_sha256(out / DLSS_NOTICE) and have != sha256_file(src):
|
||||
return f"{DLSS_DLL} kept: the one already beside the game is not the kit's (another DLSS version)"
|
||||
copy_if_changed(src, dst)
|
||||
if note.is_file() and (not (out / DLSS_NOTICE).is_file() or (out / DLSS_NOTICE).read_bytes() != note.read_bytes()):
|
||||
shutil.copy2(note, out / DLSS_NOTICE) # by content: two versions' notices can share size and second
|
||||
return None
|
||||
|
||||
|
||||
def copy_dlls(exe, msys_bin, out):
|
||||
seen, todo, copied = set(), [exe], []
|
||||
while todo:
|
||||
@@ -977,6 +1010,9 @@ def step_compile(out, cache_dir, msys, jobs, romfs_job=None):
|
||||
copy_if_changed(KIT / 'bin' / name, out / name)
|
||||
if (KIT / 'bin' / 'amd_fidelityfx_vk.dll').is_file(): # FSR 3.1 (runtime/vk_ffx.cpp)
|
||||
copy_if_changed(KIT / 'bin' / 'amd_fidelityfx_vk.dll', out / 'amd_fidelityfx_vk.dll')
|
||||
kept = place_dlss(out) # NVIDIA DLSS (runtime/vk_dlaa.c)
|
||||
if kept:
|
||||
say(f' {kept}')
|
||||
say(f' {EXE_NAME} {exe.stat().st_size / 1e6:.0f} MB; beside it: {", ".join(copy_dlls(exe, msys / "bin", out))}')
|
||||
(out / 'profile').mkdir(exist_ok=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user