mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-15 19:19:58 -04:00
With NX2NAVI_RTSS=0, frame generation or the driver's low latency, the game keeps RTSS out of its frame limit, but a limit the player set in RTSS itself (its Global profile or the game's own: a frame rate limit, a frame time limit or scanline sync) still holds the frames, on top of the game's limiter, the driver's or frame generation's. Nothing read RTSS's settings in such a run: a first want that kept RTSS out never started its thread, and frame_step_cap_ns folded the reasons into -1, so the log said "NX2NAVI_RTSS=0 or frame generation" for low latency too. frame_step_cap_ns now passes the reason (rtss_decide.h RTSS_OUT_SETTING, RTSS_OUT_FRAMEGEN, RTSS_OUT_LOWLAT; the unlimited branch too), and the kept-out line names it. A kept-out first want starts the worker as well. While RTSS is kept out the worker never loads RTSS's hooks library and only reads: its shared memory, and once RTSS lists the game the [Framerate] values of Profiles\<exe>.cfg, else Profiles\Global, with the system's ini reader, again only when either file's write time changes. When one of them limits the game, the log names the file, the values and the other limiter, once per change, and rtss_limit_state returns 4, which the frame rate row shows as a new note (UI_MENU_FPS_RTSS_TWO, in English, Russian, Brazilian Portuguese and Simplified Chinese). A later want of a limit (frame generation or low latency switched off) loads the hooks and hands RTSS the limit as before; NX2NAVI_RTSS=0 stays read-only for the run. Pacing does not change. Not reproduced before the change: a stacked limit needs RTSS running in a play-test. tests/rtss_worker_check.c gains three scenarios against the fake RTSS (a Global limit with NX2NAVI_RTSS=0, scanline sync in the game's profile under low latency and then a limit, frame generation with no limit of RTSS's own), and tests/rtss_limit_check.c builds rtss_decide.h alone and checks which settings hold the frames and their text. Both pass, with frame_step_check and a compile of every runtime file; -Wall adds no warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
46 lines
2.2 KiB
C
46 lines
2.2 KiB
C
// RivaTuner Statistics Server as the frame limiter (rtss_limit.c): the parts that make no system call, so that
|
|
// tests/rtss_limit_check.c builds them on any system.
|
|
#pragma once
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
|
|
// rtss_limit_want's argument: a limit in millihertz (>0), 0 for none, or why RTSS is kept out of it (frame_rate.c
|
|
// frame_step_cap_ns). RTSS_UNSET is the want before the first one.
|
|
enum {
|
|
RTSS_UNSET = -2,
|
|
RTSS_OUT_SETTING = -1, // NX2NAVI_RTSS=0, for the whole run
|
|
RTSS_OUT_FRAMEGEN = -3, // frame generation: RTSS would count the generated frames too
|
|
RTSS_OUT_LOWLAT = -4, // a driver's low latency (vk_lowlat.c) holds the frames where they start
|
|
};
|
|
|
|
// What keeps RTSS out, for the log.
|
|
static inline const char *rtss_out_text(int64_t want) {
|
|
return want == RTSS_OUT_FRAMEGEN ? "frame generation"
|
|
: want == RTSS_OUT_LOWLAT ? "the driver's low latency"
|
|
: "NX2NAVI_RTSS=0";
|
|
}
|
|
|
|
// The limiter that holds the frames while RTSS is kept out, for the log.
|
|
static inline const char *rtss_out_limiter(int64_t want) {
|
|
return want == RTSS_OUT_FRAMEGEN ? "frame generation and the game's limiter"
|
|
: want == RTSS_OUT_LOWLAT ? "the driver's low latency"
|
|
: "the game's limiter";
|
|
}
|
|
|
|
// RTSS's own [Framerate] settings for the game, as its profile file holds them (rtss_limit.c read_settings): a frame
|
|
// rate limit (Limit over LimitDenominator), a frame time limit (LimitTime over LimitTimeDenominator) and scanline sync
|
|
// (SyncScanline0 and SyncScanline1); 0 is off for each.
|
|
typedef struct {
|
|
int limit, limit_den, time, time_den, scan0, scan1;
|
|
} RtssSettings;
|
|
|
|
// 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; }
|
|
|
|
// "limit L/D, frame time limit T/TD, scanline sync S0/S1", the values as the file holds them.
|
|
static inline void rtss_settings_text(char *out, size_t n, const RtssSettings *s) {
|
|
snprintf(out, n, "limit %d/%d, frame time limit %d/%d, scanline sync %d/%d", s->limit, s->limit_den, s->time,
|
|
s->time_den, s->scan0, s->scan1);
|
|
}
|