mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 02:09:57 -04:00
Make the engine's second time step follow the display interval too, so held buttons repeat at the right rate.
Besides the per-frame update that the set ostep patches, the graphics system's update (main+0x3b4ea90) divides 60.0 by the engine's nominal rate and stores the result as a global (main+0x4d41fc8): the 60 Hz frames of an update. Its one reader is the buttons' hold-to-repeat timer (main+0x3483680), which adds it to each held button's time and repeats the button once that passes the button's delay and period. Above 60 fps the global stayed 1.0 a rendered frame, so a held button repeated fps / 60 times too often. Two more ostep sites load frames per update from the patch page there, so the two steps are the same number. NX2NAVI_SPEED_PROBE=1 adds the global to the fps line. Checked: the generator's check passes for all 34 main sites against the 1.1.1 module, and the generated C differs from before only in the patched function. Two 60 s runs of an adult save at about 135 fps, uncapped: before, the global step read 1.000 frames while the game's step was 0.42-0.50; after, it read 0.43-0.46, inside the game's step range; frame rate unchanged (132-138 fps in both). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -556,6 +556,11 @@ static void speed_report(uint64_t now, double step, int interval) {
|
||||
memcpy(last_pos, p, sizeof p);
|
||||
last_pos_ns = now;
|
||||
}
|
||||
float global_step; // Ocarina 1.1.1: the engine's global step (patches-v111.txt, the set ostep's second site)
|
||||
if (probe && ostep_page && read_guest(MOD_MAIN_BASE + 0x4d41fc8, &global_step, 4)) {
|
||||
size_t o = strlen(pos);
|
||||
snprintf(pos + o, sizeof pos - o, "; global step %.3f frames", (double)global_step);
|
||||
}
|
||||
if (os_step_hi > 0) { // Ocarina: the shortest and longest step given in these frames, and the time still owed
|
||||
size_t o = strlen(pos);
|
||||
snprintf(pos + o, sizeof pos - o, "; step %.3f..%.3f frames, %.1f ms owed", os_step_lo * 60, os_step_hi * 60,
|
||||
|
||||
Reference in New Issue
Block a user