mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-17 07:09:57 -04:00
Fix what the 0.6.0 review found, and ship DLSS Frame Generation in the launcher release.
The commit census of the perf trace walked the address space on the presenting thread outside mem_census, which brought back the hitch mem_census was added to remove; it now runs only with mem_census = 1. DLSS's output pass at the mode's share fell back to no pass at all when the scene was not at that share (the first presents, a dynamic resolution step): after such a frame the first pass wider than the scene is taken again for 120 frames. The launcher's nx2navi.ini editor no longer rewrites a file it cannot read, keeps the byte order mark and bytes that are not UTF-8, reads an empty line as the game does, and leaves no temporary file behind. The build kit carries the two modules build_game.py imports on Linux, the Linux steps list the right packages and Python, and stale comments and notes are corrected (Discord on by default, two prebuild threads, Enhanced HDR gone). DLSS Frame Generation needs nx2navi_dlssg.dll, NVIDIA Streamline's runtime and nvngx_dlssg.dll beside the game, which no release carried, so the menu offered it and the game turned it off. tools/make_launcher.py --dlssg and --streamline put them with their licences and a notice in the release's bin/dlssg/, and tools/make_game.py place_dlssg copies the whole set beside the game. THIRD_PARTY_NOTICES.md has the row; the notes and README say RTX 40 and 50. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -258,18 +258,20 @@ class GameIniTest(Tmp):
|
||||
|
||||
def test_new_file_gets_the_section(self):
|
||||
gameini.put(self.tmp, 'discord', 'discord_rpc', '1')
|
||||
self.assertEqual((self.tmp / 'nx2navi.ini').read_text(encoding='utf-8'), '[discord]\ndiscord_rpc = 1\n')
|
||||
self.assertEqual((self.tmp / 'nx2navi.ini').read_bytes(), b'[discord]\ndiscord_rpc = 1\n')
|
||||
self.assertEqual(gameini.get(self.tmp, 'discord_rpc'), '1')
|
||||
|
||||
def test_only_the_key_line_changes(self):
|
||||
# the byte order mark, the line ends and a line that is not UTF-8 stay as they were
|
||||
ini = self.tmp / 'nx2navi.ini'
|
||||
ini.write_bytes('[display]\r\nfullscreen = 1\r\n# discord_rpc = 1\r\n[discord]\r\n'
|
||||
'NX2NAVI_DISCORD_RPC = "1"\r\ndiscord_app_id = 42'.encode('utf-8'))
|
||||
ini.write_bytes(b'\xef\xbb\xbf[display]\r\nfullscreen = 1\r\n# caf\xe9\r\n# discord_rpc = 1\r\n[discord]\r\n'
|
||||
b'NX2NAVI_DISCORD_RPC = "1"\r\ndiscord_app_id = 42')
|
||||
self.assertEqual(gameini.get(self.tmp, 'DISCORD_RPC'), '1') # quotes, prefix and case as the game reads them
|
||||
gameini.put(self.tmp, 'discord', 'discord_rpc', '0')
|
||||
self.assertEqual(ini.read_bytes().decode('utf-8'), '[display]\r\nfullscreen = 1\r\n# discord_rpc = 1\r\n'
|
||||
'[discord]\r\ndiscord_rpc = 0\r\ndiscord_app_id = 42')
|
||||
self.assertEqual(ini.read_bytes(), b'\xef\xbb\xbf[display]\r\nfullscreen = 1\r\n# caf\xe9\r\n# discord_rpc = 1\r\n'
|
||||
b'[discord]\r\ndiscord_rpc = 0\r\ndiscord_app_id = 42')
|
||||
self.assertEqual(gameini.get(self.tmp, 'discord_rpc'), '0')
|
||||
self.assertFalse((self.tmp / 'nx2navi.ini.tmp').exists())
|
||||
|
||||
def test_missing_key_goes_under_its_section(self):
|
||||
ini = self.tmp / 'nx2navi.ini'
|
||||
@@ -278,6 +280,22 @@ class GameIniTest(Tmp):
|
||||
gameini.put(self.tmp, 'discord', 'discord_rpc', '1')
|
||||
self.assertEqual(ini.read_bytes(), b'[discord]\ndiscord_rpc = 1\ndiscord_app_id = 42\n[display]\nfullscreen = 1')
|
||||
|
||||
def test_an_empty_line_leaves_the_earlier_value(self):
|
||||
# runtime/cfg.c: "key =" leaves the setting as it was, so the game keeps 0 here, and a change goes to that line
|
||||
ini = self.tmp / 'nx2navi.ini'
|
||||
ini.write_bytes(b'discord_rpc = 0\ndiscord_rpc =\n')
|
||||
self.assertEqual(gameini.get(self.tmp, 'discord_rpc'), '0')
|
||||
gameini.put(self.tmp, 'discord', 'discord_rpc', '1')
|
||||
self.assertEqual(ini.read_bytes(), b'discord_rpc = 1\ndiscord_rpc =\n')
|
||||
|
||||
def test_an_unreadable_file_is_not_rewritten(self):
|
||||
(self.tmp / 'nx2navi.ini').mkdir() # there, but not a file that can be read
|
||||
with self.assertRaises(OSError):
|
||||
gameini.get(self.tmp, 'discord_rpc')
|
||||
with self.assertRaises(OSError):
|
||||
gameini.put(self.tmp, 'discord', 'discord_rpc', '1')
|
||||
self.assertTrue((self.tmp / 'nx2navi.ini').is_dir())
|
||||
|
||||
|
||||
class SettingsTest(Tmp):
|
||||
def test_roundtrip_and_reset(self):
|
||||
@@ -1287,6 +1305,28 @@ class MakeGameTest(Tmp):
|
||||
self.assertEqual(self.mg.notice_sha256(self.tmp / 'n.txt'), dlss_pin.SHA256)
|
||||
self.assertEqual((dlss_pin.NAME, dlss_pin.NOTICE), (self.mg.DLSS_DLL, self.mg.DLSS_NOTICE))
|
||||
|
||||
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
|
||||
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)
|
||||
with mock.patch.object(self.mg, 'KIT', kit):
|
||||
for n in self.mg.DLSSG_FILES[:-1]:
|
||||
(src / n).write_bytes(n.encode())
|
||||
self.assertEqual(self.mg.place_dlssg(out), 0) # nvngx_dlssg.dll missing: nothing is placed
|
||||
self.assertFalse((out / 'nx2navi_dlssg.dll').exists())
|
||||
(src / 'nvngx_dlssg.dll').write_bytes(b'ngx')
|
||||
(src / 'streamline-LICENSE.txt').write_text('MIT')
|
||||
self.assertEqual(self.mg.place_dlssg(out), len(self.mg.DLSSG_FILES) + 1)
|
||||
for n in self.mg.DLSSG_FILES:
|
||||
self.assertEqual((out / n).read_bytes(), (src / n).read_bytes())
|
||||
self.assertEqual((out / 'streamline-LICENSE.txt').read_text(), 'MIT')
|
||||
|
||||
@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
|
||||
|
||||
Reference in New Issue
Block a user