Give up on RivaTuner Statistics Server for the run when it hooks the game with the limit for 30 s and never shows it holds it.

The review found that nothing ended an RTSS hold that was never proven: when RTSS listed the game with the limit in
its profile but one sign never came (presents of another API value than Vulkan's, the update flag never cleared, a
period that never moved), the profile kept the limit and the game's pacer held the frames too for the whole run, two
limiters where the pacing rules allow one, with only a reason line in the log and nothing in the menu. Before the
hold had to be proven, RTSS alone held the game once it listed it. rtss_decide.h rtss_decide now counts the polls in a
row where RTSS lists the game, the profile holds a limit of this run (not "none"), a picture went out within 200 ms
and the hold is not shown; at RTSS_UNPROVEN_POLLS (60, 30 s) it puts the profile back and RTSS is out for the run
(RTSS_FAIL_UNPROVEN, "RivaTuner Statistics Server never showed it holds the game"). A minimised window, RTSS not
hooked, a want of no limit, a kept-out want or a poll that shows the hold start the count again. rtss_limit.c logs the
give-up, rtss_limit_state returns 3 for it, so the menu says RivaTuner does not limit the game and the game does, and
rtss_out_of_limit counts it, so a limit set in RTSS itself is reported as a second limiter. The comment above
rtss_decide, rewritten for the rule, is wrapped at 120 columns and no longer cites rtss_fresh, which does not exist.
tests/rtss_limit_check.c checks each sign that never comes (given up at the 60th poll, once, for the run), the polls
that do not count and a shown hold restarting the count; tests/rtss_worker_check.c unproven_run checks it against the
real worker. docs/architecture.md, docs/building.md and nx2navi.ini.example describe the rule and the remaining window
of two limiters before it.

This changes when the game takes the limit back from RTSS, beyond the approved rules: an RTSS whose hold never shows
in its shared memory (a version or setting that differs) is now left out after 30 s and the game's limiter holds
alone, as with rtss = 0, where it held the frames beside the game's limiter before. Not reproduced before the change.
Checks that passed: tests/rtss_limit_check.py (41 of 41), 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:46:48 -05:00
parent a7b4f0c7cb
commit 1744681f1a
8 changed files with 164 additions and 35 deletions

View File

@@ -260,16 +260,20 @@ keeps per-core data without locks and relies on that, so the host models it (`ru
The pacer is the fallback wherever the other limiter's hold is not proven: before the first host present, while a
movie plays (the pacer keeps the movie's slots, which no other limiter knows), once no picture went out for 200 ms (a
minimised window, `frame_hold`), for the rest of the run once the frames show the other limiter letting them through
faster than the limit, and after any failure. While RTSS holds the limit the pacer keeps only the 240-frame ceiling
faster than the limit or once it was not seen holding them for 30 s, and after any failure. While RTSS holds the
limit the pacer keeps only the 240-frame ceiling
the game's code needs (`rtss_decide.h` `rtss_pace_period`). Frame generation keeps RTSS out (it would count the
generated frames), and the game's pacer holds the drawn frames beside it. The exceptions as they stand: `pace_smooth`
still waits on the present thread while RTSS holds the limit; DLSS Frame Generation's Reflex sleeps where the frame
starts while the pacer holds the limit; at a play limit equal to a movie's rate (60, the default, for the game's 60
fps movies) RTSS's profile keeps that limit and RTSS holds the movie beside the pacer; and a limit set in RTSS itself
fps movies) RTSS's profile keeps that limit and RTSS holds the movie beside the pacer; once RTSS hooks the game with
the limit in its profile it holds the frames beside the pacer until it is seen holding them, for 30 s at most, after
which the profile goes back for the run; and a limit set in RTSS itself
still holds the game where the game keeps RTSS out, which the log ("two limiters") and the
frame rate row of the menu point out, and the same where RTSS is out of it for the run because its profile cannot be
written or its hooks library does not load, which the log points out the same way (the menu shows the administrator
note for the first and nothing for the second).
written, its hooks library does not load or it never showed its hold, which the log points out the same way (the
menu shows the administrator note for the first, nothing for the second and that RivaTuner does not limit the game
for the third).
- RivaTuner Statistics Server (`rtss_limit.c`, `NX2NAVI_RTSS`, restart; its decisions in `rtss_decide.h`): the game's
first present starts a thread that looks RTSS up (`InstallDir` under `HKLM\SOFTWARE\WOW6432Node\Unwinder\RTSS`,
`RTSSHooks64.dll`) and reads its shared memory (`RTSSSharedMemoryV2`) every 500 ms. While RTSS runs, the limit goes
@@ -285,8 +289,10 @@ keeps per-core data without locks and relies on that, so the host models it (`ru
frames lately, no movie plays and a picture went out within 200 ms. The pacer keeps the limit while RTSS does not run
or has not hooked the game, for a limit RTSS refuses, and for the rest of the run when the profile cannot be written
(no administrator rights), the hooks library does not load, or RTSS's own frame count of the game is above 1.05
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
times the limit in three new periods in a row (a period RTSS no longer moves counts neither way), or RTSS lists the
game with the limit while pictures go out for 60 polls in a row (30 s) and never shows its hold (no Vulkan presents
seen, the profile not read, no period measured); the menu names the first and the last two 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 (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

View File

@@ -488,8 +488,9 @@ memory against a fake `RTSSSharedMemoryV2` (a bad header, short entries, an entr
find nothing; the flags and the period where RTSS keeps them) and the worker's decisions poll by poll against a fake
profile and a fake RTSS clock: RTSS's injection delay through listed with no API, the profile not read yet and no
period measured, RTSS quitting and coming back, a read-only profile, a refused limit, the frame count rule (1.05 times
the limit over three new periods, a frozen period never counted), no picture going out, kept-out wants and their
reasons, a want that must stay two polls and low latency switching at every poll, a movie at 144 and at 40, a closed
the limit over three new periods, a frozen period never counted), an RTSS that lists the game and never shows its
hold (given up after 30 s, a minimised window not counted), no picture going out, kept-out wants and their
reasons, a want that must stay two polls and low latency switching at every poll, a movie at 144, 60 and 40, a closed
run, a hooks library that does not load, and two limiters. It also checks the pacer's period beside RTSS
(`rtss_pace_period`), the limit's rounding without a denominator, and the state file `rtss-profile.txt`: its lines,
its rewrite and what a start does with a line a run that did not close left. Statically, a crash and a fatal error