mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 17:29:57 -04:00
Name the game's frame-rate ceiling as a period of its own, frame_step_ceiling_ns, for a pacer that hands the limit over.
When Reflex holds the frame limit with DLSS Frame Generation, the game's pacer is to keep only the rate the game's code survives (240 a second; the quick menu read address 0 at 640 to 700), so that a limiter that lets go, or one that counts other frames than the game's, cannot run the game past it. frame_step_ceiling_ns gives that period from LIMIT_FREE_MAX_HZ, or LIMIT_MAX_HZ for a build with the fps60 or realtime patch set; frame_step_cap_ns is left as it is. tests/frame_step_check.c checks 4166666 ns for a game stepping by the clock; frame_step_check passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -180,6 +180,13 @@ static double shown_hz(double hz) { return hz <= 0 ? 60 : hz < LIMIT_MIN_HZ ? LI
|
|||||||
#define LIMIT_FREE_MAX_HZ 240
|
#define LIMIT_FREE_MAX_HZ 240
|
||||||
int frame_free_running(void) { return rt_patch_set("fps60") < 0 && rt_patch_set("realtime") < 0; }
|
int frame_free_running(void) { return rt_patch_set("fps60") < 0 && rt_patch_set("realtime") < 0; }
|
||||||
int frame_limit_adjustable(void) { return 1; }
|
int frame_limit_adjustable(void) { return 1; }
|
||||||
|
|
||||||
|
// The period the pacer keeps while something else holds the frame limit where the frame starts (Reflex with DLSS Frame
|
||||||
|
// Generation, vk_dlssg.c vk_dlssg_pace): a limiter that lets go, or counts other frames than the game's, still leaves
|
||||||
|
// the game no faster than the rate its code survives.
|
||||||
|
uint64_t frame_step_ceiling_ns(void) {
|
||||||
|
return 1000000000ull / (frame_free_running() ? LIMIT_FREE_MAX_HZ : LIMIT_MAX_HZ);
|
||||||
|
}
|
||||||
static unsigned limit_seen;
|
static unsigned limit_seen;
|
||||||
static int limit_read;
|
static int limit_read;
|
||||||
static int limit_hz = -1; // 0: display; -2: unlimited (free-running builds); -1 before the first read
|
static int limit_hz = -1; // 0: display; -2: unlimited (free-running builds); -1 before the first read
|
||||||
|
|||||||
@@ -451,6 +451,7 @@ void frame_step_init(void); // after rt_patches_i
|
|||||||
int frame_step_realtime(void); // the real-time step is on: presents ignore the interval
|
int frame_step_realtime(void); // the real-time step is on: presents ignore the interval
|
||||||
uint64_t frame_step_cap_ns(void); // with the real-time step: the shortest frame in ns
|
uint64_t frame_step_cap_ns(void); // with the real-time step: the shortest frame in ns
|
||||||
int frame_step_movie_hz(void); // the movie rate frame_step_cap_ns paces at; 0: no movie
|
int frame_step_movie_hz(void); // the movie rate frame_step_cap_ns paces at; 0: no movie
|
||||||
|
uint64_t frame_step_ceiling_ns(void); // the shortest frame the game survives, whoever holds the limit
|
||||||
int ov_movie_live(void); // ov_movie2.c: a movie plays (frame_rate.c movie_cap_hz)
|
int ov_movie_live(void); // ov_movie2.c: a movie plays (frame_rate.c movie_cap_hz)
|
||||||
int frame_limit_adjustable(void); // the frame limit setting changes the rate (always)
|
int frame_limit_adjustable(void); // the frame limit setting changes the rate (always)
|
||||||
int frame_free_running(void); // no fps60/realtime patch set: the game steps by the clock
|
int frame_free_running(void); // no fps60/realtime patch set: the game steps by the clock
|
||||||
|
|||||||
@@ -182,6 +182,9 @@ int main(int argc, char **argv) {
|
|||||||
int mean = argc > 1 && !strcmp(argv[1], "mean");
|
int mean = argc > 1 && !strcmp(argv[1], "mean");
|
||||||
if (mean) steady = "0";
|
if (mean) steady = "0";
|
||||||
frame_step_init();
|
frame_step_init();
|
||||||
|
// the pacer's period while Reflex holds the limit (vk_dlssg.c vk_dlssg_pace): 240 fps for a game stepping by the clock
|
||||||
|
CHECK(frame_step_ceiling_ns() == 4166666, "the ceiling of a game that steps by the clock: %llu ns",
|
||||||
|
(unsigned long long)frame_step_ceiling_ns());
|
||||||
float one, cut0;
|
float one, cut0;
|
||||||
memcpy(&one, page + 256, 4);
|
memcpy(&one, page + 256, 4);
|
||||||
memcpy(&cut0, page + 260, 4);
|
memcpy(&cut0, page + 260, 4);
|
||||||
|
|||||||
Reference in New Issue
Block a user