From f512a989882f0d11d1f3e7e8add698bb384b9f74 Mon Sep 17 00:00:00 2001 From: chrg6 Date: Fri, 13 Nov 2026 05:46:58 -0500 Subject: [PATCH] Give the water and floor surfaces' fixed-step remainders as many slots as the waters' ripples. Every interactive floor of a place and both water managers ask frame_rate_sim_host once an update, each for its own object. With 8 slots, a place with more such objects than that had them take each other's slot in turn, start without a remainder every update and stand still above 60 fps, as before the set owater. The table now has 64 slots, as the ripples' has, and frame_step_check runs 32 surfaces at 144 fps. Co-Authored-By: Claude Opus 5.5 --- runtime/frame_rate.c | 5 ++++- tests/frame_step_check.c | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/runtime/frame_rate.c b/runtime/frame_rate.c index f9f8819b..7db33ac4 100644 --- a/runtime/frame_rate.c +++ b/runtime/frame_rate.c @@ -584,7 +584,10 @@ void frame_rate_water_host(Cpu *c) { // that is not positive, or too large for a count, stays for the cut. The remainders are in a table of their own: an // object that shares slots with the counters above would lose its fraction to them. // NX2NAVI_TRACE=perf: every 10 s, the steps the objects were given beside those the cut alone would have given. -#define SIM_SLOTS 8 +// Every interactive floor of a place (the Deku Tree's ground webs are such floors) and both water managers ask once an +// update, each for its own object, so the table holds as many as the waters' does: with fewer slots than objects each +// would take another's slot in turn, start without a remainder every update and stand still again above 60 fps. +#define SIM_SLOTS 64 static WholeSlot sim_slot[SIM_SLOTS]; void frame_rate_sim_host(Cpu *c) { diff --git a/tests/frame_step_check.c b/tests/frame_step_check.c index 285fd9e2..acc47ced 100644 --- a/tests/frame_step_check.c +++ b/tests/frame_step_check.c @@ -277,6 +277,16 @@ int main(int argc, char **argv) { sim(interactive, NAN) == 0, "no time, negative time and NaN are cut as fcvtzs cuts"); CHECK(sim(interactive, 1.0f / 15.0f) == 4, "four steps for a 15 fps update (the game's clamp to 3 follows)"); } + // A place with many interactive floors: 2 water managers and 30 floors, each asking once an update at 144 fps, all + // keep their own remainder and run 60 fixed steps a second (with 8 slots they took each other's and ran none). + { + const uint64_t first = 0x7600000000ull; + uint32_t steps[32] = {0}; + for (int f = 0; f < 1440; f++) + for (int k = 0; k < 32; k++) steps[k] += sim(first + 0x1000 * (uint64_t)k, 1.0f / 144.0f); + for (int k = 0; k < 32; k++) + CHECK(steps[k] >= 599 && steps[k] <= 600, "surface %d of 32 at 144 fps: %u steps in 10 s", k, steps[k]); + } printf("frame_step_check: %s\n", fails ? "FAILED" : "ok"); return fails != 0; }