Swing the shake key's stick by the game's updates instead of the clock, two updates a side at any frame rate.

shake_stick picked the side from the time since the press, 67 ms a side (two frames at the game's 30 fps), so above
30 fps each side lasted more of the game's updates: 8 at 120 fps and 16 at 240, slower swings than the game reads at
its own rate. The side now comes from the game's present count, which frame_rate.c already kept for the flight
recorder and now gives through frame_step_presents, two presents a side. The press still swings for 800 ms of the
clock and a hold keeps it going, as before; while no present comes (a load) the stick keeps its side.

Not reproduced before the change (read from the code). The new tests/shake_key_check.py builds shake_stick from
input.c and passes (it fails 118 times on the old code); the runtime compile check and the -Wall comparison of
input.c and frame_rate.c show no new warnings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 19:00:47 -05:00
parent 5f9374e1d9
commit 5c9e480f90
5 changed files with 147 additions and 7 deletions

View File

@@ -425,7 +425,10 @@ static double ocarina_step_s(void) {
return base * speed / 60.0;
}
static _Atomic uint64_t guest_presents; // frame_step_present calls so far (frame_step_flight)
static _Atomic uint64_t guest_presents; // frame_step_present calls so far (frame_step_flight, frame_step_presents)
// The game's presents so far, one per update of the game at any frame rate (input.c shake_stick counts its updates).
uint64_t frame_step_presents(void) { return atomic_load_explicit(&guest_presents, memory_order_relaxed); }
// The flight recorder's view of the step at a host present (flight.c, render thread): the newest step the patch page
// holds in 60 Hz frames per update (set ostep; -1 without), the game's own step from its time manager in 60 Hz frames