Put back a profile a run that did not close left in RivaTuner Statistics Server, also at a start that keeps RTSS out.

The review found that the worker read rtss-profile.txt only on its first poll with the hooks library, which it loads
only for a limit, so a start with frame generation on, with the driver's low latency on from the first present, or
with NX2NAVI_RTSS=0 never put back a killed run's limit: RTSS then went on limiting the game at that value (counting
the generated frames too under frame generation), and the log and the menu reported it as the player's own limit
beside the game's limiter. rtss_limit.c worker now looks at the state file on its first poll that finds RTSS running
(left_start): a limit puts the profile back with the library it loads anyway, as before; frame generation and low
latency load the library for that one restore (restore_left, which now takes the line found); NX2NAVI_RTSS=0 keeps the
thread read-only and logs that the file holds the game's limit from a run that did not close and that a start with
RTSS let in puts it back. A restore the library could not be loaded for waits for the first poll with the library.
tests/rtss_worker_check.c adds kill_restart_framegen (the next start asks frame generation first: the profile is
removed, no limit written, the line gone) and kill_restart_setting (NX2NAVI_RTSS=0: no library loaded, the profile and
the line stay, the log says so). The rtss_limit.c header, docs/architecture.md, docs/building.md and
nx2navi.ini.example say so, and the ini text no longer says the game alone paces movies under RTSS.

Not reproduced before the change. Checks that passed: tests/rtss_limit_check.py (40 of 40),
pass_cc_check.py --wall on rtss_limit.c, tools/check_content.py --staged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 19:42:54 -05:00
parent ad84e0a1c0
commit a7b4f0c7cb
5 changed files with 99 additions and 35 deletions

View File

@@ -288,15 +288,18 @@ keeps per-core data without locks and relies on that, so the host models it (`ru
times the limit in three new periods in a row (a period RTSS no longer moves counts neither way); the menu names the
first and the last of these. Frame generation, the
driver's low latency and `NX2NAVI_RTSS=0` keep RTSS out (`RTSS_OUT_*`): the profile gets back what it held before
the run changed it, and while RTSS is kept out its thread does not load the hooks library and only reads RTSS's own
settings for the game; a later limit (frame generation or low latency switched off) loads it and hands RTSS the limit
as usual, and `NX2NAVI_RTSS=0` keeps the thread read-only for the run. While RTSS lists the game the log names those
the run changed it, and while RTSS is kept out its thread does not load the hooks library (but for the one restore
below at the start) and only reads RTSS's own settings for the game; a later limit (frame generation or low latency
switched off) loads it and hands RTSS the limit as usual, and `NX2NAVI_RTSS=0` keeps the thread read-only for the
run. While RTSS lists the game the log names those
settings (limit, frame time limit, scanline sync, display sync, Reflex sleep, passive wait) once per change. Every
orderly exit puts the profile back as it was before the run (`rtss_limit_restore`), and no want reaches it after
that. What the profile held is also kept in `rtss-profile.txt` next to the executable, one line per profile, written
before the run's first change of it and removed once it is back: a start that finds a line left by a run that did
not close (a kill, a hang, the device-lost watchdog, a crash or a fatal error, whose ends make no call into RTSS's
library: `rtss_limit_crash`) puts that profile back first, unless the player changed it since. A file that cannot be
library: `rtss_limit_crash`) puts that profile back first (`left_start`), unless the player changed it since; frame
generation and low latency, which keep RTSS out, have the hooks library loaded for that one restore, and a start with
`NX2NAVI_RTSS=0` leaves the profile and the line as they are and says so in the log. A file that cannot be
written leaves the run as before, with a line in the log; profiles that versions before the file left with the
game's limit cannot be told from the player's own.
- Measuring pacing: `NX2NAVI_TRACE=present` logs a line per picture (the host present's interval, the game's present