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:
chrg6
2026-11-09 09:10:36 -05:00
parent 250a12272a
commit dfc5b90b59
16 changed files with 207 additions and 51 deletions

View File

@@ -2,14 +2,18 @@
Read the way runtime/cfg.c reads the file: a UTF-8 byte order mark is skipped, lines starting with #, ; or [ are
not settings, a key is matched without regard to case and with or without its NX2NAVI_ prefix, a value in double
quotes loses them, an empty value leaves the setting at its default, and the last line for a key wins. Sections do
not matter to the game; a key the file does not have yet goes under its section, as the game writes it.
A change rewrites only the line it touches, through a temporary file, so the rest of the file stays as it was.
quotes loses them, an empty value leaves the setting as it was (its default, or an earlier line's value), and the last
line with a value wins. Sections do not matter to the game; a key the file does not have yet goes under its section,
as the game writes it.
A change rewrites only the line it touches, through a temporary file: the other lines keep their bytes (the byte
order mark, line ends, text that is not UTF-8). A file that exists but cannot be read is never rewritten, as
runtime/cfg.c cfg_save_to does not: rebuilding it from nothing would lose its lines.
"""
import os
from pathlib import Path
PREFIX = 'NX2NAVI_'
BOM = ''
def _path(game_dir):
@@ -21,18 +25,19 @@ def _key(text):
return k[len(PREFIX):] if k.startswith(PREFIX) else k
def _lines(game_dir):
try: # newline='': the file's own line ends, which a change keeps
with open(_path(game_dir), encoding='utf-8-sig', errors='replace', newline='') as f:
text = f.read()
except OSError:
return []
return text.splitlines(keepends=True)
def _text(game_dir):
"""The file's text with its own line ends (bytes that are not UTF-8 kept as surrogates), '' when it does not exist.
Any other error is raised."""
try:
with open(_path(game_dir), encoding='utf-8', errors='surrogateescape', newline='') as f:
return f.read()
except FileNotFoundError:
return ''
def _setting(line):
"""(key, value) of a settings line, or None."""
s = line.strip()
s = line.lstrip(BOM).strip()
if not s or s[0] in '#;[' or '=' not in s:
return None
k, v = s.split('=', 1)
@@ -43,22 +48,29 @@ def _setting(line):
def get(game_dir, key):
"""The value the file gives key ('' when it gives none: the game's default applies)."""
"""The value the file gives key ('' when it gives none: the game's default applies). Raises OSError when the file
exists but cannot be read."""
want, value = _key(key), ''
for line in _lines(game_dir):
for line in _text(game_dir).splitlines():
kv = _setting(line)
if kv and kv[0] == want:
if kv and kv[0] == want and kv[1]:
value = kv[1]
return value
def put(game_dir, section, key, value):
"""Write key = value: on the key's last line when the file has one, else under [section] (made at the end when
the file has none). The game folder must exist; the file is made when it does not."""
lines, want = _lines(game_dir), _key(key)
"""Write key = value: on the key's last line that has a value (else its last line) when the file has one, else
under [section] (made at the end when the file has none). Raises OSError, the file unchanged, when it exists but
cannot be read or the new one cannot be put in place."""
text = _text(game_dir)
bom = BOM if text.startswith(BOM) else ''
lines = text[len(bom):].splitlines(keepends=True)
want = _key(key)
entry = f'{key.lower()} = {value}'
nl = '\r\n' if lines and lines[0].endswith('\r\n') else '\n'
at = max((i for i, line in enumerate(lines) if (_setting(line) or ('',))[0] == want), default=-1)
mine = [i for i, line in enumerate(lines) if (_setting(line) or ('',))[0] == want]
valued = [i for i in mine if _setting(lines[i])[1]]
at = (valued or mine or [-1])[-1]
if at >= 0:
end = lines[at][len(lines[at].rstrip('\r\n')):] or nl
lines[at] = entry + end
@@ -75,5 +87,9 @@ def put(game_dir, section, key, value):
lines += [f'[{section}]{nl}', entry + nl]
path = _path(game_dir)
tmp = path.with_name(path.name + '.tmp')
tmp.write_text(''.join(lines), encoding='utf-8', newline='')
os.replace(tmp, path)
try:
with open(tmp, 'w', encoding='utf-8', errors='surrogateescape', newline='') as f:
f.write(bom + ''.join(lines))
os.replace(tmp, path)
finally:
tmp.unlink(missing_ok=True)

View File

@@ -590,14 +590,20 @@ class App:
def discord_row(self, game_dir):
"""The game's discord_rpc setting (runtime/discord_rpc.c), kept in the game's nx2navi.ini as the game's own
menu keeps it; the game reads it when it starts. On unless the file says 0, as the game reads it (cfg_bool, default
on)."""
menu keeps it; the game reads it when it starts. On unless the file says 0, as the game reads it (cfg_bool,
default on)."""
def on(v):
try:
gameini.put(game_dir, 'discord', 'discord_rpc', '1' if v else '0')
except OSError as e:
self.message = f'The game\'s settings could not be written: {e}'
return Row('toggle', 'Discord Status', on=on, get=lambda: gameini.get(game_dir, 'discord_rpc') != '0',
def get():
try:
return gameini.get(game_dir, 'discord_rpc') != '0'
except OSError: # nx2navi.ini there but unreadable: the game's default
return True
return Row('toggle', 'Discord Status', on=on, get=get,
desc=('Show "Playing NX2navi" with your play time in your Discord status while the game runs. '
'The game\'s menu switches it too (Game tab).',))