mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 12:29:57 -04:00
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:
@@ -143,6 +143,17 @@ typedef struct {
|
||||
// the frames that catch up, and the picture would fall behind the sound at each late frame for good.
|
||||
static inline int64_t rtss_target(int64_t w, int64_t movie_mhz) { return w > 0 && movie_mhz > w ? 0 : w; }
|
||||
|
||||
// The profile's FramerateLimit and FramerateLimitDenominator for mhz (>= 0): a whole rate over 1, a fraction over 1000
|
||||
// where RTSS knows the denominator (has_den), else rounded down to whole frames. Only "display" asks a fraction (59.94
|
||||
// or 143.856 Hz monitors), and a limit rounded up (60, 144) let the game run above the refresh, so that every 7 to 17
|
||||
// seconds a frame came that the monitor had no refresh for.
|
||||
static inline void rtss_limit_value(int64_t mhz, int has_den, uint32_t *limit, uint32_t *den) {
|
||||
*den = 1;
|
||||
if (mhz % 1000 == 0) *limit = (uint32_t)(mhz / 1000);
|
||||
else if (has_den) *limit = (uint32_t)mhz, *den = 1000;
|
||||
else *limit = (uint32_t)(mhz / 1000);
|
||||
}
|
||||
|
||||
// The hooks library is loaded only on a poll that may write the profile: a limit is wanted, RTSS is not out of it for
|
||||
// the run, and it runs. A poll of a kept-out want never loads it; a later limit does.
|
||||
static inline int rtss_wants_hooks(const RtssState *s, const RtssIn *in) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user