mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 11:09:56 -04:00
Tell of two limiters also where RivaTuner Statistics Server is out of the limit because its profile is read-only or its library did not load.
The review found that docs/architecture.md's list of exceptions to the one-limiter rule leaves one out: when RTSS is out of it for the run because its profile cannot be written (no administrator rights) or its hooks library does not load, a limit the player set in RTSS itself (Global or the game's .cfg, a frame time limit, scanline sync) still holds the game while the game's own limiter paces it. rtss_limit.c watch worked the second limiter out only for a kept-out want, so neither the "two limiters" line nor anything else said so; only the "settings for the game" line showed the values. rtss_decide.h now has rtss_out_of_limit (kept out, or failed with RTSS_FAIL_READONLY or RTSS_FAIL_LIBRARY; a run the frame count check gave up on is left out, since RTSS was seen not to hold the game), and rtss_two takes the failure. watch gets S.fail and logs the two-limiter line for those runs too, and logs it again when the other limiter changes (a failed run that then keeps RTSS out for low latency). The menu is unchanged: its two-limiter note (rtss_limit_state 4) stays for a kept-out want, and a read-only profile keeps its administrator note (state 2). Log only: no pacing decision changes. The docs' exceptions sentence names the case and what the log and the menu show. tests/rtss_worker_check.c readonly_two and library_two run it with a limit in Global; both fail on the code before this change (no two-limiter line). rtss_limit_check.c's two() covers the failures. rtss_limit_check passes 26 of 26, check_content passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -258,7 +258,9 @@ keeps per-core data without locks and relies on that, so the host models it (`ru
|
||||
DLSS Frame Generation's Reflex sleeps where the frame starts while the pacer holds the limit; while RTSS holds it the
|
||||
pacer holds nothing at all, through movies and while no picture goes out (a minimised window, `frame_hold`) too; 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.
|
||||
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).
|
||||
- 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
|
||||
|
||||
@@ -226,10 +226,17 @@ typedef struct {
|
||||
// RTSS holds the game's frames by a setting of its own.
|
||||
static inline int rtss_settings_limit(const RtssSettings *s) { return s->limit || s->time || s->scan0 || s->scan1; }
|
||||
|
||||
// Two limiters: RTSS is kept out of the game's limit, and while it lists the game a setting of its own still holds the
|
||||
// frames (rtss_settings_limit), beside the game's limiter, the driver's or frame generation's.
|
||||
static inline int rtss_two(int64_t want, int listed, int own_limit) {
|
||||
return want < 0 && want != RTSS_UNSET && listed && own_limit;
|
||||
// RTSS has no part in the game's limit although it may list the game: the want keeps it out, or it is out for the run
|
||||
// because its profile cannot be written or its hooks library did not load. A run whose frame count check gave up on
|
||||
// RTSS does not count: RTSS was seen not to hold the game.
|
||||
static inline int rtss_out_of_limit(int64_t want, int fail) {
|
||||
return want != RTSS_UNSET && (want < 0 || fail == RTSS_FAIL_READONLY || fail == RTSS_FAIL_LIBRARY);
|
||||
}
|
||||
|
||||
// Two limiters: RTSS is out of the game's limit (rtss_out_of_limit), and while it lists the game a setting of its own
|
||||
// still holds the frames (rtss_settings_limit), beside the game's limiter, the driver's or frame generation's.
|
||||
static inline int rtss_two(int64_t want, int fail, int listed, int own_limit) {
|
||||
return rtss_out_of_limit(want, fail) && listed && own_limit;
|
||||
}
|
||||
|
||||
// "limit L/D, frame time limit T/TD, scanline sync S0/S1", and with modes ", display sync X, Reflex sleep R, passive
|
||||
|
||||
@@ -271,14 +271,19 @@ static void read_settings(void) {
|
||||
}
|
||||
|
||||
// While RTSS lists the game, the settings it holds for it are logged once per change: what RTSS applies may be more than
|
||||
// the FramerateLimit the game writes (a frame time limit, scanline sync, its own Reflex). While RTSS is kept out
|
||||
// (w < 0) the game's own limiter, the driver's low latency or frame generation holds the frames, and a limit the player
|
||||
// set in RTSS itself for the game (its global profile or the game's own, a frame time limit or scanline sync) still
|
||||
// holds them a second time. Logged once per change and shown in the menu (rtss_limit_state 4).
|
||||
static void watch(int64_t w, int listed) {
|
||||
// the FramerateLimit the game writes (a frame time limit, scanline sync, its own Reflex). While RTSS has no part in the
|
||||
// game's limit (rtss_out_of_limit: kept out, w < 0, or out for the run because its profile cannot be written or its
|
||||
// hooks library did not load) the game's own limiter, the driver's low latency or frame generation holds the frames,
|
||||
// and a limit the player set in RTSS itself for the game (its global profile or the game's own, a frame time limit or
|
||||
// scanline sync) still holds them a second time. Logged once per change, and again when the other limiter changes;
|
||||
// the menu shows it for a kept-out want (rtss_limit_state 4), while a profile that cannot be written keeps its own note
|
||||
// there (state 2).
|
||||
static void watch(int64_t w, int fail, int listed) {
|
||||
static int said, lines, settings_lines;
|
||||
static const char *said_by;
|
||||
static char said_text[128], said_settings[MAX_PATH + 256];
|
||||
int on = 0;
|
||||
int out = rtss_out_of_limit(w, fail), on = 0;
|
||||
const char *by = rtss_out_limiter(w); // the limiter beside RTSS's own setting
|
||||
char text[128] = "";
|
||||
if (listed) {
|
||||
read_settings();
|
||||
@@ -289,23 +294,23 @@ static void watch(int64_t w, int listed) {
|
||||
rt_log("frame rate: RivaTuner Statistics Server's settings for the game %s", all);
|
||||
snprintf(said_settings, sizeof said_settings, "%s", all);
|
||||
}
|
||||
if (w < 0 && listed) {
|
||||
on = rtss_two(w, listed, rtss_settings_limit(&settings));
|
||||
if (out && listed) {
|
||||
on = rtss_two(w, fail, listed, rtss_settings_limit(&settings));
|
||||
rtss_settings_text(text, sizeof text, &settings, 0);
|
||||
}
|
||||
if (w >= 0) said = 0; // a later kept-out want logs afresh
|
||||
else if (on != said || (on && strcmp(text, said_text))) {
|
||||
if (!out) said = 0; // RTSS takes the game's limit: a later want out of it logs afresh
|
||||
else if (on != said || (on && (strcmp(text, said_text) || by != said_by))) {
|
||||
if (lines++ < 40) {
|
||||
if (on)
|
||||
rt_log("frame rate: two limiters: RivaTuner Statistics Server's own setting for the game (%s: %s) limits "
|
||||
"it beside %s", settings_file, text, rtss_out_limiter(w));
|
||||
"it beside %s", settings_file, text, by);
|
||||
else
|
||||
rt_log("frame rate: RivaTuner Statistics Server no longer limits the game beside %s", rtss_out_limiter(w));
|
||||
rt_log("frame rate: RivaTuner Statistics Server no longer limits the game beside %s", by);
|
||||
}
|
||||
said = on;
|
||||
said = on, said_by = by;
|
||||
snprintf(said_text, sizeof said_text, "%s", text);
|
||||
}
|
||||
atomic_store(&two, on);
|
||||
atomic_store(&two, on && w < 0); // the menu's note (rtss_limit_state 4) is for a kept-out want
|
||||
}
|
||||
|
||||
// RTSS's folder (InstallDir under its registry key), its hooks library and this executable's profile name, on the
|
||||
@@ -372,7 +377,7 @@ static void worker(void *arg) {
|
||||
rtss_why_text(why, sizeof why, &o, S.fail);
|
||||
set_active(w, o.holds, why);
|
||||
}
|
||||
watch(w, in.app.listed);
|
||||
watch(w, S.fail, in.app.listed);
|
||||
plat_mutex_unlock(&lock);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,14 +367,21 @@ static void closed_and_library(void) {
|
||||
CHECK(!strcmp(t, "RivaTuner Statistics Server is not running"), "%s", t);
|
||||
}
|
||||
|
||||
// Two limiters: kept out, listed and a limit of RTSS's own; never for a limit the game hands RTSS.
|
||||
// Two limiters: RTSS out of the game's limit (kept out, or a profile that cannot be written or a hooks library that did
|
||||
// not load), listed and a limit of RTSS's own; never for a limit the game hands RTSS.
|
||||
static void two(void) {
|
||||
CHECK(rtss_two(RTSS_OUT_SETTING, 1, 1) && rtss_two(RTSS_OUT_FRAMEGEN, 1, 1) && rtss_two(RTSS_OUT_LOWLAT, 1, 1),
|
||||
CHECK(rtss_two(RTSS_OUT_SETTING, 0, 1, 1) && rtss_two(RTSS_OUT_FRAMEGEN, 0, 1, 1) &&
|
||||
rtss_two(RTSS_OUT_LOWLAT, 0, 1, 1),
|
||||
"every reason");
|
||||
CHECK(!rtss_two(RTSS_OUT_SETTING, 0, 1), "not listed: RTSS holds nothing");
|
||||
CHECK(!rtss_two(RTSS_OUT_SETTING, 1, 0), "no limit of its own");
|
||||
CHECK(!rtss_two(60000, 1, 1) && !rtss_two(0, 1, 1), "the game's limit in RTSS: one limiter");
|
||||
CHECK(!rtss_two(RTSS_UNSET, 1, 1), "no want yet");
|
||||
CHECK(!rtss_two(RTSS_OUT_SETTING, 0, 0, 1), "not listed: RTSS holds nothing");
|
||||
CHECK(!rtss_two(RTSS_OUT_SETTING, 0, 1, 0), "no limit of its own");
|
||||
CHECK(!rtss_two(60000, 0, 1, 1) && !rtss_two(0, 0, 1, 1), "the game's limit in RTSS: one limiter");
|
||||
CHECK(!rtss_two(RTSS_UNSET, 0, 1, 1) && !rtss_two(RTSS_UNSET, RTSS_FAIL_READONLY, 1, 1), "no want yet");
|
||||
CHECK(rtss_two(60000, RTSS_FAIL_READONLY, 1, 1) && rtss_two(0, RTSS_FAIL_LIBRARY, 1, 1),
|
||||
"out for the run: the profile cannot be written, or the hooks library did not load");
|
||||
CHECK(!rtss_two(60000, RTSS_FAIL_READONLY, 0, 1) && !rtss_two(60000, RTSS_FAIL_LIBRARY, 1, 0),
|
||||
"out for the run, but not listed or no limit of its own");
|
||||
CHECK(!rtss_two(60000, RTSS_FAIL_NOT_LIMITING, 1, 1), "RTSS seen not to hold the game: not counted");
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
|
||||
@@ -547,6 +547,45 @@ static void readonly_run(void) {
|
||||
CHECK(logged("RivaTuner Statistics Server's profile cannot be changed"), "logged");
|
||||
}
|
||||
|
||||
// The same with a limit set in RTSS's Global profile: RTSS, out of the game's limit for the run, still holds the game
|
||||
// by its own setting, and the log tells of the two limiters; the menu keeps its administrator note.
|
||||
static void readonly_two(void) {
|
||||
readonly = 1;
|
||||
global.limit = 50;
|
||||
app_set(1, 0xA, 1000, 2000, 50);
|
||||
ask(60000);
|
||||
poll();
|
||||
show("read-only profiles, Global limit 50");
|
||||
CHECK(rtss_limit_state() == 2 && !rtss_limit_active(), "the menu says RTSS needs administrator rights");
|
||||
CHECK(logged("two limiters: RivaTuner Statistics Server's own setting for the game (Profiles\\Global: limit 50/1, "
|
||||
"frame time limit 0/0, scanline sync 0/0) limits it beside the game's limiter"),
|
||||
"the two-limiter line names the file and the values");
|
||||
ask(RTSS_OUT_LOWLAT);
|
||||
poll();
|
||||
CHECK(logged("scanline sync 0/0) limits it beside the driver's low latency"), "logged again for the other limiter");
|
||||
CHECK(rtss_limit_state() == 4, "kept out: the menu's two-limiter note");
|
||||
ask(60000);
|
||||
poll();
|
||||
global.limit = 0, touch(&global);
|
||||
poll();
|
||||
CHECK(logged("RivaTuner Statistics Server no longer limits the game beside the game's limiter"), "logged once it ended");
|
||||
CHECK(rtss_limit_state() == 2, "the administrator note again");
|
||||
}
|
||||
|
||||
// RTSS's hooks library does not load, with a limit set in RTSS's Global profile: the log tells of the two limiters.
|
||||
static void library_two(void) {
|
||||
no_library = 1;
|
||||
global.limit = 50;
|
||||
app_set(1, 0xA, 1000, 2000, 50);
|
||||
ask(60000);
|
||||
poll();
|
||||
show("no hooks library, Global limit 50");
|
||||
CHECK(!rtss_limit_active() && !saves, "the game's limiter");
|
||||
CHECK(logged("two limiters: RivaTuner Statistics Server's own setting for the game (Profiles\\Global: limit 50/1, "
|
||||
"frame time limit 0/0, scanline sync 0/0) limits it beside the game's limiter"),
|
||||
"the two-limiter line");
|
||||
}
|
||||
|
||||
// RTSS refuses a limit out of its range: the game keeps that one, the earlier limit of this run is cleared to none,
|
||||
// and a limit in range goes to RTSS again at once.
|
||||
static void refused_run(void) {
|
||||
@@ -688,6 +727,8 @@ static const struct { const char *name; void (*run)(void); } scenarios[] = {
|
||||
{"not_installed", not_installed},
|
||||
{"settings_logged", settings_logged},
|
||||
{"readonly_run", readonly_run},
|
||||
{"readonly_two", readonly_two},
|
||||
{"library_two", library_two},
|
||||
{"refused_run", refused_run},
|
||||
{"over_run", over_run},
|
||||
{"over_slack_run", over_slack_run},
|
||||
|
||||
Reference in New Issue
Block a user