Download the pinned Streamline runtime for DLSS Frame Generation, and let the build kit carry it too.

make_launcher.py --dlssg needed --streamline, a Streamline SDK folder unpacked by hand, and make_kit.py could not
carry DLSS Frame Generation at all, so a game built from the kit always left it off. tools/streamline_pin.py now pins
the Streamline 2.14.16 SDK release (its archive's size and SHA-256, and the SHA-256 of each file the game loads):
without --streamline the scripts download the archive once, check it, keep only sl.interposer.dll, sl.common.dll,
sl.dlss_g.dll, sl.pcl.dll, sl.reflex.dll, nvngx_dlssg.dll and the two licence texts, each checked, and delete the
archive. A folder given with --streamline must hold the pinned files.

The bin/dlssg/ assembly moves from make_launcher.py into streamline_pin.place, so the release and the kit write the
same set and the same dlssg-NOTICE.txt: a kit made with --dlssg and the 0.6.0 release's nx2navi_dlssg.dll has a
bin/dlssg/ identical to the 0.6.0 release's, byte for byte. make_kit.py takes --dlssg [--streamline] like the
launcher. nx2navi_dlssg.dll itself still comes from tools/build_dlssg.py.

tests/launcher_test.py test_streamline_pin covers the extraction, the cache, refused archives and folders, and the
notice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
itaskaev2
2026-11-09 16:32:32 +01:00
committed by chrg6
parent 417d1a3740
commit 7341eec727
8 changed files with 215 additions and 61 deletions

View File

@@ -1657,13 +1657,13 @@ class MakeGameTest(Tmp):
def test_dlssg_beside_the_game(self):
"""DLSS Frame Generation's files go beside the game only as a whole set, with the licence texts; the release
script (tools/make_launcher.py) and the build agree on the set."""
import make_launcher
import streamline_pin
from unittest import mock
kit, out = self.tmp / 'kit', self.tmp / 'game'
src = kit / 'bin' / 'dlssg'
src.mkdir(parents=True)
out.mkdir()
self.assertEqual(make_launcher.DLSSG_FILES, self.mg.DLSSG_FILES)
self.assertEqual(streamline_pin.FILES, self.mg.DLSSG_FILES)
with mock.patch.object(self.mg, 'KIT', kit):
for n in self.mg.DLSSG_FILES[:-1]:
(src / n).write_bytes(n.encode())
@@ -1676,6 +1676,58 @@ class MakeGameTest(Tmp):
self.assertEqual((out / n).read_bytes(), (src / n).read_bytes())
self.assertEqual((out / 'streamline-LICENSE.txt').read_text(), 'MIT')
def test_streamline_pin(self):
"""The Streamline files come out of the SDK archive checked one by one; the archive goes once they are out and
a filled cache needs no download; an SDK folder on disk must hold the pinned files; bin/dlssg/ gets the set
make_game.py places, the two licence texts and a notice with every file's sha256."""
import streamline_pin
from unittest import mock
files = {n: f'{n} of the SDK'.encode() for n in streamline_pin.SDK_FILES}
pins = {n: hashlib.sha256(d).hexdigest() for n, d in files.items()}
cache = self.tmp / 'dl'
cache.mkdir()
archive = cache / f'streamline-sdk-v{streamline_pin.VERSION}.zip'
with zipfile.ZipFile(archive, 'w') as z:
for n, d in files.items():
z.writestr(n, d)
z.writestr('bin/x64/sl.nis.dll', b'a plugin the game does not load')
fetched = []
def download(url, dest, sha256=None, size=None): # the archive is already where net.download writes it
fetched.append(url)
self.assertEqual(Path(dest), archive)
return dest
with mock.patch.dict(streamline_pin.SDK_FILES, pins), mock.patch('launcher.net.download', download):
sdk = streamline_pin.resolve(None, cache)
self.assertEqual(fetched, [streamline_pin.URL])
self.assertFalse(archive.exists())
self.assertEqual(streamline_pin.wrong_files(sdk), [])
self.assertFalse((sdk / 'bin' / 'x64' / 'sl.nis.dll').exists())
self.assertEqual(streamline_pin.resolve(None, cache), sdk) # filled: no second download
self.assertEqual(len(fetched), 1)
self.assertEqual(streamline_pin.resolve(sdk, cache), sdk) # a folder on disk with the pinned files
(sdk / 'bin' / 'x64' / 'sl.common.dll').write_bytes(b'another Streamline')
with self.assertRaises(SystemExit):
streamline_pin.resolve(sdk, cache)
(sdk / 'bin' / 'x64' / 'sl.common.dll').write_bytes(files['bin/x64/sl.common.dll'])
with zipfile.ZipFile(archive, 'w') as z: # an archive whose file differs is refused
for n, d in files.items():
z.writestr(n, b'changed' if n == 'license.txt' else d)
with self.assertRaises(SystemExit):
streamline_pin.extract(archive, self.tmp / 'x')
dll = self.tmp / 'nx2navi_dlssg.dll'
dll.write_bytes(b'our frame generation shim')
dest = self.tmp / 'bin' / 'dlssg'
streamline_pin.place(dll, sdk, dest)
self.assertEqual(sorted(p.name for p in dest.iterdir()),
sorted((*streamline_pin.FILES, *streamline_pin.TEXTS, streamline_pin.NOTICE)))
self.assertEqual((dest / 'streamline-LICENSE.txt').read_bytes(), files['license.txt'])
note = (dest / streamline_pin.NOTICE).read_text(encoding='utf-8')
self.assertIn(f'Streamline {streamline_pin.VERSION} SDK', note)
self.assertIn(f'nx2navi_dlssg.dll sha256 {hashlib.sha256(dll.read_bytes()).hexdigest()}', note)
self.assertIn(f'nvngx_dlssg.dll sha256 {pins["bin/x64/nvngx_dlssg.dll"]}', note)
@unittest.skipIf(os.name == 'nt', 'a script stands in for windres.exe')
def test_compile_resources(self):
# The toolchain, the kit and the game under folders with spaces, as under C:\Users\Ali Sayed. windres must