Round a fractional limit down for a RivaTuner Statistics Server without the denominator field, so "display" never holds the game above the refresh.

apply() rounded the millihertz to the nearest whole frame where RTSS has no FramerateLimitDenominator, so "display" on
a 59.94 Hz monitor wrote 60 and on a 143.856 Hz one 144: above the refresh, one frame more than the monitor shows
every 17 s and every 7 s. Only "display" asks a fractional rate under RTSS (fixed limits and movie rates are whole,
frame generation keeps RTSS out), so the new rtss_decide.h rtss_limit_value rounds every fraction down when the
denominator is missing (59/1, 143/1), and keeps a whole rate over 1 and a fraction over 1000 where RTSS knows the
denominator. VRR and present-wait handling stay to be measured.

Not reproduced before the change. rtss_limit_check (T15: rtss_limit_value at 59940, 60000, 143856, 0 and 240000 with
and without the denominator) and rtss_worker_check (round_logged_whole now 59/1 and 143/1, round_logged) pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 19:17:33 -05:00
parent 4d4b97b043
commit 60694532a1
4 changed files with 35 additions and 8 deletions

View File

@@ -214,10 +214,9 @@ static int apply(void *ctx, int64_t mhz, int first, int clear) {
has_denominator = get_property("FramerateLimitDenominator", (LPBYTE)&old_denominator, sizeof old_denominator);
if (!old_denominator) old_denominator = 1;
}
DWORD limit, denominator = 1;
if (mhz % 1000 == 0) limit = (DWORD)(mhz / 1000);
else if (has_denominator) limit = (DWORD)mhz, denominator = 1000;
else limit = (DWORD)((mhz + 500) / 1000);
uint32_t l, d;
rtss_limit_value(mhz, has_denominator, &l, &d);
DWORD limit = l, denominator = d;
if (first) { // the line goes in before the profile changes: a kill between the two finds it as it was
rec = (RtssSaved){had_profile, old_limit, old_denominator, limit, denominator, ""};
snprintf(rec.name, sizeof rec.name, "%s", profile);