mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-21 10:09:59 -04:00
Log RivaTuner Statistics Server's own settings for the game while it lists the game.
rtss_limit.c writes and reads back only FramerateLimit and FramerateLimitDenominator, but RTSS's [Framerate] section holds more that limits or paces the frames: a frame time limit (LimitTime over LimitTimeDenominator), scanline sync (SyncScanline0/1), display sync, its own Reflex sleep and passive waiting. A player with any of them set in Global gets an RTSS that holds the game to more than the game's limit, and no log said so. While RTSS lists the game, the worker's reader (read_settings, the system's ini reader on Profiles\<exe>.cfg, else Profiles\Global, read again only when either file's write time changes) now also takes SyncDisplay, ReflexSleep and PassiveWait, and watch logs "RivaTuner Statistics Server's settings for the game (<file>): limit L/D, frame time limit T/TD, scanline sync S0/S1, display sync X, Reflex sleep R, passive wait P" once per change, 40 lines at most. It reads only, makes no call into RTSS's hooks library and changes nothing RTSS or the game does; whether the game should keep RTSS out when one of these is set is left for approval. Not reproduced before the change: it needs RTSS's settings in a play-test. tests/rtss_limit_check.c checks the text with and without the modes and that a short buffer cuts it; tests/rtss_worker_check.c gains settings_logged (nothing read while the game is not listed, then one line for the game's profile with what it took from Global, and one more after the limit changes). Both pass, with a compile of every runtime file; -Wall adds no warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@ static int fails;
|
||||
|
||||
// RTSS's own settings: which of them hold the game's frames, and the log's text of them.
|
||||
static void settings(void) {
|
||||
RtssSettings none = {0, 1, 0, 0, 0, 0};
|
||||
RtssSettings none = {0, 1, 0, 0, 0, 0, 1, 1, 1};
|
||||
CHECK(!rtss_settings_limit(&none), "no limit, no frame time limit, no scanline sync: RTSS holds nothing");
|
||||
RtssSettings s = none;
|
||||
s.limit = 50;
|
||||
@@ -23,13 +23,20 @@ static void settings(void) {
|
||||
CHECK(rtss_settings_limit(&s), "the second scanline sync holds the frames");
|
||||
s = none, s.limit_den = 1000, s.time_den = 7;
|
||||
CHECK(!rtss_settings_limit(&s), "denominators alone hold nothing");
|
||||
char text[128];
|
||||
s = (RtssSettings){59940, 1000, 16667, 1, -40, 0};
|
||||
rtss_settings_text(text, sizeof text, &s);
|
||||
CHECK(!rtss_settings_limit(&none), "display sync, Reflex sleep and passive wait alone hold nothing");
|
||||
char text[192];
|
||||
s = (RtssSettings){59940, 1000, 16667, 1, -40, 0, 1, 2, 0};
|
||||
rtss_settings_text(text, sizeof text, &s, 0);
|
||||
CHECK(!strcmp(text, "limit 59940/1000, frame time limit 16667/1, scanline sync -40/0"), "text: %s", text);
|
||||
char small[16];
|
||||
rtss_settings_text(small, sizeof small, &s);
|
||||
rtss_settings_text(text, sizeof text, &s, 1);
|
||||
CHECK(!strcmp(text, "limit 59940/1000, frame time limit 16667/1, scanline sync -40/0, display sync 1, Reflex sleep 2, "
|
||||
"passive wait 0"),
|
||||
"text with the modes: %s", text);
|
||||
char small[16], mid[70];
|
||||
rtss_settings_text(small, sizeof small, &s, 1);
|
||||
CHECK(strlen(small) == sizeof small - 1, "a short buffer is cut, not overrun");
|
||||
rtss_settings_text(mid, sizeof mid, &s, 1);
|
||||
CHECK(strlen(mid) == sizeof mid - 1 && !strncmp(mid, text, sizeof mid - 1), "the modes cut at the buffer's end");
|
||||
}
|
||||
|
||||
// The kept-out reasons, for the log.
|
||||
|
||||
Reference in New Issue
Block a user