Let the game's pacer hold a movie while RivaTuner Statistics Server holds the limit, and keep the play limit in RTSS's profile through it.

During a movie frame_step_cap_ns wanted the movie's rate and returned 0 once RTSS held it, so pace() kept none of the
movie's slots while ocarina_step still gave one movie frame per update: each late frame put the picture behind the
sound for good, the fall-behind d3e50328 fixed for the game's pacer. Each movie start and end also rewrote RTSS's
profile (two saves and two UpdateProfiles per movie in lane A's probe). Now frame_step_cap_ns wants the play limit
through the movie and tells RTSS of the movie (rtss_limit_movie); rtss_pace_period keeps the movie's period from its
first frame, and the worker leaves the movie to the pacer (RTSS_WHY_MOVIE) with the profile as it is. Under a limit
below the movie's rate (30, 40, 45) the profile has no limit for the movie's length (rtss_decide.h rtss_target), since
RTSS at the movie's rate would space out the frames the pacer sends at once to catch up; that is still two writes per
movie there, and none at 60 or more.

Not reproduced before the change. rtss_limit_check (the movie case at 144 and 40, rtss_target, rtss_pace_period),
rtss_worker_check (movie_run, new movie_low_run) and frame_step_check (the want and period through a movie under RTSS)
pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 18:58:47 -05:00
parent 27a034e946
commit 208a10718d
7 changed files with 136 additions and 41 deletions

View File

@@ -726,19 +726,40 @@ static void churn_run(void) {
CHECK(rtss_limit_active(), "RTSS limits after the last want of a limit");
}
// A movie at 60 under a limit of 144: the want follows the movie, and each start and end is a write.
// A movie at 60 under a limit of 144: the want stays 144 (frame_rate.c frame_step_cap_ns) and RTSS's profile keeps it
// with no write, while the game's pacer holds the movie at its rate; RTSS holds the game again at its end.
static void movie_run(void) {
app_set(1, 0xA, 1000, 2000, 144);
ask(144000);
poll();
long s0 = saves;
ask(60000);
poll();
CHECK(own.limit == 60 && rtss_limit_active(), "RTSS holds the movie's 60");
rtss_limit_movie(60);
ask(144000);
poll();
show("after one movie");
CHECK(own.limit == 144 && saves - s0 == 2, "two writes for one movie");
show("a movie at 60");
CHECK(own.limit == 144 && !rtss_limit_active() && saves == s0, "the profile keeps 144; the game's pacer holds it");
CHECK(logged("the game's own limiter (a movie plays: the game keeps its pictures on time)"), "logged");
rtss_limit_movie(0);
poll();
show("after the movie");
CHECK(own.limit == 144 && rtss_limit_active() && saves == s0, "RTSS holds again, no write for the movie");
}
// The same under a limit of 40: the profile has no limit while the movie plays, so RTSS cannot space out the frames the
// pacer sends at once after a late one, and gets 40 back at its end.
static void movie_low_run(void) {
app_set(1, 0xA, 1000, 2000, 40);
ask(40000);
poll();
long s0 = saves;
rtss_limit_movie(60);
poll();
show("a movie at 60 with the limit at 40");
CHECK(own.exists && own.limit == 0 && !rtss_limit_active(), "no limit in the profile during the movie");
rtss_limit_movie(0);
poll();
show("after the movie");
CHECK(own.limit == 40 && rtss_limit_active() && saves - s0 == 2, "40 back: two writes for the movie");
}
static const struct { const char *name; void (*run)(void); } scenarios[] = {
@@ -768,6 +789,7 @@ static const struct { const char *name; void (*run)(void); } scenarios[] = {
{"library_run", library_run},
{"churn_run", churn_run},
{"movie_run", movie_run},
{"movie_low_run", movie_low_run},
};
int main(int argc, char **argv) {