fix(fps): a song's notes show one at a time with its melody above a 60 fps cap #1471

Merged
HumanBean merged 2 commits from CraftyCorvid/Longshot:fix/ocarina-song-notes-above-60 into main 2026-11-18 19:44:57 +00:00
Contributor

Type: fix · Risk: low · Tested on: Linux, RTX 5090 · Needs: none

TL;DR

With the frame rate cap above 60, after you played a song on the ocarina its notes showed two or three at a time, ahead
of the music. Now they show one at a time as the music reaches each, as at a cap of 60. A new test fails on main and
passes here, and Zelda's Lullaby played uncapped (about 150 fps) on Linux showed its notes in time with the music.

Breakdown

  • Who it helps: anyone who plays ocarina songs with the frame rate cap above 60.
  • What was wrong: the song's playback counted each note every time it looked, and above 60 it looked two or three
    times before the sound engine, which runs 60 times a second, moved on.
  • What changes: above 60, a note is counted once per run of the sound engine.
  • What does not change: a cap of 60 (and frames slower than 60 fps), saves, options and every other sound.
  • How it was checked: a game-free test (fails on main: 2 to 4 notes per note at 90 to 240 fps; passes here), a
    cold review by a second agent, and the game uncapped on Linux, RTX 5090.
  • What is still open: Windows in the game, and the ocarina's other melody playback (probably a song being taught),
    which uses the same code but which I haven't seen run.
  • Risk: low: only the timing of a song's notes above 60 could be off, and a cap of 60 is untouched.

Why

With the Game frame rate cap past 60, after you play a song on the ocarina the game plays the song back and shows its
notes, but they come two or three at a time and run ahead of the music: at about 150 fps Zelda's Lullaby showed all six
notes within 1.3 s of a melody that lasts about 4 s. At a cap of 60 each note shows as the music reaches it. No issue
covers it (the tracker searched for ocarina, song, playback, notes, melody); #78 fixed a different counter, the
Scarecrow's Song's, and #414 is the ocarina's input.

How to reproduce

Seen on: CachyOS Linux (kernel 7.3), RTX 5090, NVIDIA 620.70.06
Settings and switches: Game frame rate cap Uncapped (about 140-160 fps on this PC), everything else default
Steps: take out the ocarina anywhere and play a song you know (Zelda's Lullaby here), then watch the playback
Expected: one note shows at each note of the melody, as at a cap of 60
Actual: the notes show in bursts of two or three, ahead of the music, and the playback ends early

What changed

After a song is played, its playback (f_832b2af0) goes on to the next note on each update it finds the note flag set:
a word the sound engine sets when the melody reaches a note and clears on its next run. The sound engine runs in the
sound job, which runs at 60 Hz above 60 fps (its gate, hos_oot_sound_gate, from 8fcc8c22), so at 150 fps the playback found the flag set on two or
three updates in a row and went on that many notes. The flag's read now goes through the host: above a cap of 60, a set
flag read again before the sound job has run again is the same note and reads clear. At a cap of 60 the game's value is
unchanged. The ocarina's other melody playback (f_832b2dc0, the ocarina state machine's state 6) has the same code
and gets the same treatment (its melodies are the game's example melodies, by their names; I haven't seen it run).

  • lift: nx2/oot_patches.py patch_song_cue: after each of the two calls to f_832b7b50 (the flag's read, by its
    return address 0x832b2c84 and 0x832b2ed4), its result goes through hos_oot_song_cue; report warns when either
    is not found once.
  • host: host/oot_high_fps.h oot_song_cue (the rule, and why at the top of the file), and host/oot_high_fps.c
    hos_oot_song_cue (each playback's last read, under the sound job's lock) with the sound job's runs counted at its
    gate (hos_oot_sound_gate). HOS_FPS_LOG counts the reads it held back.
  • test: tests/test_song_note_cue.py.
  • docs: the README's frame rate cap row.

How it was found: a diagnostic build (not in this PR) counted the calls of the ocarina's functions at 60 and uncapped,
which pointed at the playback's update, then logged its state each update and put a hardware write watchpoint on the
flag. The only writer is the sound job (f_80435300, through f_806aa3b0): it writes 0 on every run and sets the
flag on the run where the melody reaches a note.

Measurements

Verdict: fixed. Uncapped, the notes now show one at a time with the music (by eye, and the host held back the
flag's repeated reads); the game-free test fails on main for this bug and passes here.

Hardware: CachyOS Linux (kernel 7.3), RTX 5090, NVIDIA 620.70.06
Scene: the ocarina in a field, Zelda's Lullaby; Game frame rate cap Uncapped (about 140-160 fps) and 60
Method: tests/test_song_note_cue.py (gcc and clang); in the game, a diagnostic build on main's code logging the
playback's note and the flag each update, then this branch played by hand with HOS_FPS_LOG=1
How to reproduce: python -I -B tests/test_song_note_cue.py; in the game, the steps above
Baseline: the in-game before is a diagnostic build (logging only) of an earlier main, 71b1edd8, the dev base on this
PC. Since then main gained, in the same files, the battle music's flags and the music manager's step (#1224), Gohma's
turn rate (#1098) and a horse's jump (#1434); the sound job's gate and the ocarina's code are unchanged, and the
game-free test shows the same bursts on main c7db6c02. The after is this branch (at 22c8ce7e, the same fix code),
built as a dev pack over the same base.

Before: main @ c7db6c02 (with the test, b1832551) After: this PR @ 70835372
test_song_note_cue.py fails: at 90 to 240 fps each playback goes on 9 to 23 notes for a melody's 5 (2 to 4 at each of its notes) passes (76 checks); the unpatched updates fail the 120 fps check
Zelda's Lullaby's playback, uncapped, in the game notes at 0.07 s (1), 0.90 s (3) and 1.33 s (2): all six in 1.3 s. At 60: one at each of the melody's notes, over 4 s one at a time with the music; 8 repeated reads of the set flag held back
Before, test (b1832551 on main c7db6c02):
FAIL: 120 fps: playback 0 went on 11 notes, on the sound engine's runs 10 60 60 85 85 165 165 218 218 246 246 (expected 5: 60 85 165 218 246)
FAIL: 165 fps: playback 0 went on 17 notes, on the sound engine's runs 10 10 60 60 60 85 85 85 165 165 165 218 218 218 246 246 (expected 5: 60 85 165 218 246)
FAIL: a song's playback above 60 fps (the patch is missing)

After, test (70835372):
PASS: a song's playback goes on one note at each of its melody's notes (76 checks)
PASS: the unpatched updates compile and fail the 120 fps check (two notes at each of the melody's)
PASS: scoped, idempotent, and a changed anchor is left alone with a warning

Before, in the game (diagnostic build; t seconds from the playback's start, snd the sound job's runs, idx the note, flag
the note flag; a line where something changed):
uncapped: t 0.0620 snd 1391 step 0.662 | idx 0 | flag 1048576
          t 0.0692 snd 1392 step 0.659 | idx 1 | flag 0
          t 0.8938 snd 1442 step 0.426 | idx 1 | flag 1048576
          t 0.9008 snd 1442 step 0.421 | idx 2 | flag 1048576
          t 0.9080 snd 1442 step 0.418 | idx 3 | flag 1048576
          t 0.9149 snd 1443 step 0.420 | idx 4 | flag 0
          t 1.3308 snd 1468 step 0.372 | idx 5 | flag 1048576
          t 1.3369 snd 1468 step 0.374 | idx 6 | flag 1048576
cap 60:   t 17.3781 snd 2430 | idx 1 ... t 17.7945 snd 2455 | idx 2 ... t 19.1281 snd 2535 | idx 3 ...
          t 20.0114 snd 2588 | idx 4 ... t 20.4780 snd 2616 | idx 5

After, in the game (this branch, HOS_FPS_LOG=1, uncapped):
oot: a song's playback read its note flag set again before the sound job ran 8 of the last 600 reads

Flags and settings

None (HOS_FPS_LOG, the existing diagnostic switch, gets one more line).

Testing

Tested:

  • In the game: Linux, RTX 5090, NVIDIA 620.70.06; this branch at 22c8ce7e built as a dev pack over a base of 71b1edd8 (the
    lift reports "the song playbacks' note flag once a note above 60 fps in code_045.c", and no warning). Since then the
    branch changed only its test and comments (the cold review) and was rebased onto main c7db6c02, whose #1434 adds
    a horse's jump patch beside this one in the same files; the fix's code is the same. Uncapped (about
    140-160 fps), Zelda's Lullaby's notes showed one at a time with the music; at a cap of 60 as before.
  • tests/test_song_note_cue.py with gcc and clang (and compiled by MinGW gcc): fails at b1832551 (the test alone, on
    main), passes at 70835372. Broken on purpose, it fails: no repeat held back (120 fps), the sound job's runs not
    counted (two notes on consecutive runs of the sound engine), the rule applied at a cap of 60 too (a cap of 60 with two
    reads a frame), the host handing back the game's value, and a rule by time instead of by the job's runs (a set flag
    counted once per 60 fps frame of time: it loses one of two notes on consecutive runs at 75 fps and around 60).
  • A cold review by a second agent (the diff and the test, not my conclusions): no blocking problem. Its points are in
    this version: the test gained two notes on consecutive runs at 75, 90, 144 and 165 fps, uncapped with varying frame
    times and around 60 (steps of 0.98 to 1.02), which the time-based rule above passed before; the header now states the
    thread order the rule relies on, with the log that shows the game keeps it; three comments corrected. It also caught
    these mutations in the test: one state for both playbacks, the result stored instead of the game's, the hook before
    the call.
  • python -I -B tests/run_all.py (Linux): 633 passed, 38 failed, 91 skipped (Vulkan and SPIR-V headers missing here).
    The 38 also fail on main (run there), for reasons in files this PR doesn't touch (test_dev_packs, which reads the
    patch file, fails the same way on main c7db6c02: "a game patch shows in the objects"): test_bug_report_defaults,
    test_compute_warm_apart, test_cpu_report, test_crt_options, test_damage_debug_menu, test_discover,
    test_dev_packs, test_display_startup_failure, test_dlss_feature_size, test_failed_compile_keeps_objects, test_framegen_preset,
    test_guest_imported, test_hud_layout_row, test_invalidate_quick, test_invalidate_vcore, test_lift_lookups, test_linux_preflight,
    test_linux_pressure, test_linux_update, test_log_open_failure, test_mirror_budget, test_missing_nup,
    test_mods_size_table, test_pending_guest_import, test_pipeline_play_cache, test_present_thread, test_profiling_mode,
    test_readback_timeout_source, test_rumble_menu, test_run_all_changed, test_slow_frames, test_switch_table, test_target_image_pool,
    test_upscaler_round_trip, test_upscaler_rows, test_vcore_escape, test_walk, test_walk_key.
  • host/oot_high_fps.c compiled alone (-fsyntax-only -Wall -Wextra, the build's include folders) with gcc and clang
    for Linux and with llvm-mingw clang (tools.lock's, 20261104) and MinGW gcc for Windows: no warnings, as on main.

Not tested:

  • The ocarina's other melody playback (f_832b2dc0, state 6) in the game: it didn't run in these rides and I haven't
    identified when the game uses it. It is the same code and the same rule, and the game-free test runs it.
  • Windows in the game (the change has no platform-specific code; its host file compiles with llvm-mingw).
  • Other songs in the game, and frame rates other than about 140-160 fps (the game-free test covers 90 to 240 and
    frames slower than 60).

Must be tested: None.

Risks

What could break: the note display of an ocarina song's playback above a 60 fps cap. Above 60, a set flag read on
two updates with no run of the sound job between is counted once; were the flag ever meant to count twice within one
run, a note would be lost (the game's own timer then moves the playback on when its melody ends). The job's runs are
counted at the head of its phase 0 and the flag is written later in that phase, so a playback read inside phase 0 would
count one note twice: the game's own threads never did that in the diagnostic's log (the run count less the flag's
clears stayed the same through each playback, 432 reads on five worker threads and the main thread), and the test
cannot model threads. At a cap of 60 nothing changes: the host hands back the game's value.

Turning it off: revert the commit, or a cap of 60.

Compatibility: Nothing changes for saves, options or caches; an update translates the game's code again, as for any
change to the lift's patches.

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what
    can't be run by hand is in Testing's Not testable by hand, with why.
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and
    in Risks.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named).
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • A game-free test added for the fix, failing on main and passing here.
  • A check under tests/ that reads changed source updated in this PR, not weakened. (None needed: the checks that
    read host/oot_high_fps.* or nx2/oot_patches.py, test_high_fps_fixes.py, test_patch_hooks_defined.py,
    test_ocarina_wait.py and test_scarecrow_timing.py among them, pass unchanged.)
  • Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • Docs updated.

🤖 Generated with Claude Code

**Type:** fix · **Risk:** low · **Tested on:** Linux, RTX 5090 · **Needs:** none ## TL;DR With the frame rate cap above 60, after you played a song on the ocarina its notes showed two or three at a time, ahead of the music. Now they show one at a time as the music reaches each, as at a cap of 60. A new test fails on main and passes here, and Zelda's Lullaby played uncapped (about 150 fps) on Linux showed its notes in time with the music. ## Breakdown - **Who it helps:** anyone who plays ocarina songs with the frame rate cap above 60. - **What was wrong:** the song's playback counted each note every time it looked, and above 60 it looked two or three times before the sound engine, which runs 60 times a second, moved on. - **What changes:** above 60, a note is counted once per run of the sound engine. - **What does not change:** a cap of 60 (and frames slower than 60 fps), saves, options and every other sound. - **How it was checked:** a game-free test (fails on main: 2 to 4 notes per note at 90 to 240 fps; passes here), a cold review by a second agent, and the game uncapped on Linux, RTX 5090. - **What is still open:** Windows in the game, and the ocarina's other melody playback (probably a song being taught), which uses the same code but which I haven't seen run. - **Risk:** low: only the timing of a song's notes above 60 could be off, and a cap of 60 is untouched. ## Why With the Game frame rate cap past 60, after you play a song on the ocarina the game plays the song back and shows its notes, but they come two or three at a time and run ahead of the music: at about 150 fps Zelda's Lullaby showed all six notes within 1.3 s of a melody that lasts about 4 s. At a cap of 60 each note shows as the music reaches it. No issue covers it (the tracker searched for ocarina, song, playback, notes, melody); #78 fixed a different counter, the Scarecrow's Song's, and #414 is the ocarina's input. ## How to reproduce **Seen on:** CachyOS Linux (kernel 7.3), RTX 5090, NVIDIA 620.70.06 **Settings and switches:** Game frame rate cap Uncapped (about 140-160 fps on this PC), everything else default **Steps:** take out the ocarina anywhere and play a song you know (Zelda's Lullaby here), then watch the playback **Expected:** one note shows at each note of the melody, as at a cap of 60 **Actual:** the notes show in bursts of two or three, ahead of the music, and the playback ends early ## What changed After a song is played, its playback (`f_832b2af0`) goes on to the next note on each update it finds the note flag set: a word the sound engine sets when the melody reaches a note and clears on its next run. The sound engine runs in the sound job, which runs at 60 Hz above 60 fps (its gate, `hos_oot_sound_gate`, from 8fcc8c22), so at 150 fps the playback found the flag set on two or three updates in a row and went on that many notes. The flag's read now goes through the host: above a cap of 60, a set flag read again before the sound job has run again is the same note and reads clear. At a cap of 60 the game's value is unchanged. The ocarina's other melody playback (`f_832b2dc0`, the ocarina state machine's state 6) has the same code and gets the same treatment (its melodies are the game's example melodies, by their names; I haven't seen it run). - lift: `nx2/oot_patches.py` `patch_song_cue`: after each of the two calls to `f_832b7b50` (the flag's read, by its return address `0x832b2c84` and `0x832b2ed4`), its result goes through `hos_oot_song_cue`; `report` warns when either is not found once. - host: `host/oot_high_fps.h` `oot_song_cue` (the rule, and why at the top of the file), and `host/oot_high_fps.c` `hos_oot_song_cue` (each playback's last read, under the sound job's lock) with the sound job's runs counted at its gate (`hos_oot_sound_gate`). `HOS_FPS_LOG` counts the reads it held back. - test: `tests/test_song_note_cue.py`. - docs: the README's frame rate cap row. How it was found: a diagnostic build (not in this PR) counted the calls of the ocarina's functions at 60 and uncapped, which pointed at the playback's update, then logged its state each update and put a hardware write watchpoint on the flag. The only writer is the sound job (`f_80435300`, through `f_806aa3b0`): it writes 0 on every run and sets the flag on the run where the melody reaches a note. ## Measurements **Verdict:** fixed. Uncapped, the notes now show one at a time with the music (by eye, and the host held back the flag's repeated reads); the game-free test fails on `main` for this bug and passes here. Hardware: CachyOS Linux (kernel 7.3), RTX 5090, NVIDIA 620.70.06 Scene: the ocarina in a field, Zelda's Lullaby; Game frame rate cap Uncapped (about 140-160 fps) and 60 Method: `tests/test_song_note_cue.py` (gcc and clang); in the game, a diagnostic build on `main`'s code logging the playback's note and the flag each update, then this branch played by hand with `HOS_FPS_LOG=1` How to reproduce: `python -I -B tests/test_song_note_cue.py`; in the game, the steps above Baseline: the in-game before is a diagnostic build (logging only) of an earlier `main`, 71b1edd8, the dev base on this PC. Since then `main` gained, in the same files, the battle music's flags and the music manager's step (#1224), Gohma's turn rate (#1098) and a horse's jump (#1434); the sound job's gate and the ocarina's code are unchanged, and the game-free test shows the same bursts on `main` c7db6c02. The after is this branch (at 22c8ce7e, the same fix code), built as a dev pack over the same base. | | Before: main @ c7db6c02 (with the test, b1832551) | After: this PR @ 70835372 | |---|---|---| | `test_song_note_cue.py` | fails: at 90 to 240 fps each playback goes on 9 to 23 notes for a melody's 5 (2 to 4 at each of its notes) | passes (76 checks); the unpatched updates fail the 120 fps check | | Zelda's Lullaby's playback, uncapped, in the game | notes at 0.07 s (1), 0.90 s (3) and 1.33 s (2): all six in 1.3 s. At 60: one at each of the melody's notes, over 4 s | one at a time with the music; 8 repeated reads of the set flag held back | ``` Before, test (b1832551 on main c7db6c02): FAIL: 120 fps: playback 0 went on 11 notes, on the sound engine's runs 10 60 60 85 85 165 165 218 218 246 246 (expected 5: 60 85 165 218 246) FAIL: 165 fps: playback 0 went on 17 notes, on the sound engine's runs 10 10 60 60 60 85 85 85 165 165 165 218 218 218 246 246 (expected 5: 60 85 165 218 246) FAIL: a song's playback above 60 fps (the patch is missing) After, test (70835372): PASS: a song's playback goes on one note at each of its melody's notes (76 checks) PASS: the unpatched updates compile and fail the 120 fps check (two notes at each of the melody's) PASS: scoped, idempotent, and a changed anchor is left alone with a warning Before, in the game (diagnostic build; t seconds from the playback's start, snd the sound job's runs, idx the note, flag the note flag; a line where something changed): uncapped: t 0.0620 snd 1391 step 0.662 | idx 0 | flag 1048576 t 0.0692 snd 1392 step 0.659 | idx 1 | flag 0 t 0.8938 snd 1442 step 0.426 | idx 1 | flag 1048576 t 0.9008 snd 1442 step 0.421 | idx 2 | flag 1048576 t 0.9080 snd 1442 step 0.418 | idx 3 | flag 1048576 t 0.9149 snd 1443 step 0.420 | idx 4 | flag 0 t 1.3308 snd 1468 step 0.372 | idx 5 | flag 1048576 t 1.3369 snd 1468 step 0.374 | idx 6 | flag 1048576 cap 60: t 17.3781 snd 2430 | idx 1 ... t 17.7945 snd 2455 | idx 2 ... t 19.1281 snd 2535 | idx 3 ... t 20.0114 snd 2588 | idx 4 ... t 20.4780 snd 2616 | idx 5 After, in the game (this branch, HOS_FPS_LOG=1, uncapped): oot: a song's playback read its note flag set again before the sound job ran 8 of the last 600 reads ``` ### Flags and settings None (`HOS_FPS_LOG`, the existing diagnostic switch, gets one more line). ## Testing **Tested:** - In the game: Linux, RTX 5090, NVIDIA 620.70.06; this branch at 22c8ce7e built as a dev pack over a base of 71b1edd8 (the lift reports "the song playbacks' note flag once a note above 60 fps in code_045.c", and no warning). Since then the branch changed only its test and comments (the cold review) and was rebased onto `main` c7db6c02, whose #1434 adds a horse's jump patch beside this one in the same files; the fix's code is the same. Uncapped (about 140-160 fps), Zelda's Lullaby's notes showed one at a time with the music; at a cap of 60 as before. - `tests/test_song_note_cue.py` with gcc and clang (and compiled by MinGW gcc): fails at b1832551 (the test alone, on `main`), passes at 70835372. Broken on purpose, it fails: no repeat held back (120 fps), the sound job's runs not counted (two notes on consecutive runs of the sound engine), the rule applied at a cap of 60 too (a cap of 60 with two reads a frame), the host handing back the game's value, and a rule by time instead of by the job's runs (a set flag counted once per 60 fps frame of time: it loses one of two notes on consecutive runs at 75 fps and around 60). - A cold review by a second agent (the diff and the test, not my conclusions): no blocking problem. Its points are in this version: the test gained two notes on consecutive runs at 75, 90, 144 and 165 fps, uncapped with varying frame times and around 60 (steps of 0.98 to 1.02), which the time-based rule above passed before; the header now states the thread order the rule relies on, with the log that shows the game keeps it; three comments corrected. It also caught these mutations in the test: one state for both playbacks, the result stored instead of the game's, the hook before the call. - `python -I -B tests/run_all.py` (Linux): 633 passed, 38 failed, 91 skipped (Vulkan and SPIR-V headers missing here). The 38 also fail on `main` (run there), for reasons in files this PR doesn't touch (test_dev_packs, which reads the patch file, fails the same way on `main` c7db6c02: "a game patch shows in the objects"): test_bug_report_defaults, test_compute_warm_apart, test_cpu_report, test_crt_options, test_damage_debug_menu, test_discover, test_dev_packs, test_display_startup_failure, test_dlss_feature_size, test_failed_compile_keeps_objects, test_framegen_preset, test_guest_imported, test_hud_layout_row, test_invalidate_quick, test_invalidate_vcore, test_lift_lookups, test_linux_preflight, test_linux_pressure, test_linux_update, test_log_open_failure, test_mirror_budget, test_missing_nup, test_mods_size_table, test_pending_guest_import, test_pipeline_play_cache, test_present_thread, test_profiling_mode, test_readback_timeout_source, test_rumble_menu, test_run_all_changed, test_slow_frames, test_switch_table, test_target_image_pool, test_upscaler_round_trip, test_upscaler_rows, test_vcore_escape, test_walk, test_walk_key. - `host/oot_high_fps.c` compiled alone (`-fsyntax-only -Wall -Wextra`, the build's include folders) with gcc and clang for Linux and with llvm-mingw clang (tools.lock's, 20261104) and MinGW gcc for Windows: no warnings, as on `main`. **Not tested:** - The ocarina's other melody playback (`f_832b2dc0`, state 6) in the game: it didn't run in these rides and I haven't identified when the game uses it. It is the same code and the same rule, and the game-free test runs it. - Windows in the game (the change has no platform-specific code; its host file compiles with llvm-mingw). - Other songs in the game, and frame rates other than about 140-160 fps (the game-free test covers 90 to 240 and frames slower than 60). **Must be tested:** None. ## Risks **What could break:** the note display of an ocarina song's playback above a 60 fps cap. Above 60, a set flag read on two updates with no run of the sound job between is counted once; were the flag ever meant to count twice within one run, a note would be lost (the game's own timer then moves the playback on when its melody ends). The job's runs are counted at the head of its phase 0 and the flag is written later in that phase, so a playback read inside phase 0 would count one note twice: the game's own threads never did that in the diagnostic's log (the run count less the flag's clears stayed the same through each playback, 432 reads on five worker threads and the main thread), and the test cannot model threads. At a cap of 60 nothing changes: the host hands back the game's value. **Turning it off:** revert the commit, or a cap of 60. **Compatibility:** Nothing changes for saves, options or caches; an update translates the game's code again, as for any change to the lift's patches. ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what can't be run by hand is in Testing's Not testable by hand, with why. - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and in Risks. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] A game-free test added for the fix, failing on `main` and passing here. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. (None needed: the checks that read `host/oot_high_fps.*` or `nx2/oot_patches.py`, `test_high_fps_fixes.py`, `test_patch_hooks_defined.py`, `test_ocarina_wait.py` and `test_scarecrow_timing.py` among them, pass unchanged.) - [x] Host code builds on both Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] Docs updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Contributor

Tested in game: RTX 5090, NVIDIA 620.70.06, Linux (CachyOS): the ocarina in a field, Zelda's Lullaby, Game frame rate cap Uncapped (about 140-160 fps): after the song, its notes showed one at a time with the music (on main they came two or three at a time, ahead of it); at a cap of 60 as before. Built as a dev pack over a base of 71b1edd8.

Tested in game: RTX 5090, NVIDIA 620.70.06, Linux (CachyOS): the ocarina in a field, Zelda's Lullaby, Game frame rate cap Uncapped (about 140-160 fps): after the song, its notes showed one at a time with the music (on main they came two or three at a time, ahead of it); at a cap of 60 as before. Built as a dev pack over a base of 71b1edd8.
CraftyCorvid force-pushed fix/ocarina-song-notes-above-60 from 22c8ce7e25
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
to bd8e6c4e83
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
2026-11-17 23:29:58 +00:00
Compare
Author
Contributor

Rewritten after a cold review by a second agent (the diff and the test, not my conclusions): the branch still reads test, then fix, now aed6e69d and bd8e6c4e (were dae46b12 and 22c8ce7e). No blocking problem was found; what changed:

  • test: two notes on consecutive runs of the sound engine at four places in the melody, at 75, 90, 144 and 165 fps, uncapped with varying frame times and around 60 (steps of 0.98 to 1.02). A wrong fix that counts a set flag once per 60 fps frame of time, instead of once per run of the sound job, passed the 26 checks before; it now fails (one of two notes lost at 75 fps and around 60). 76 checks, gcc and clang; it still fails at the test commit on main 257c5491.
  • host/oot_high_fps.h: the comment states the thread order the rule relies on: the job's runs are counted at the head of its phase 0 and the flag is written later in that phase, so the playback must not read it inside phase 0. The diagnostic's log shows the game keeps that order (the run count less the flag's clears stayed the same through each playback, 432 reads on five worker threads and the main thread). Also in Risks.
  • Comments: the flag is a word of the melody's player that its sound handle points to; "a third of the melody" is at about 150 fps; the host function's rule applies above a cap of 60.

No code change: tests/run_all.py gives the same 607 passed and the same 34 failures that also fail on main; host/oot_high_fps.c compiles without warnings with gcc, clang, llvm-mingw clang and MinGW gcc.

Rewritten after a cold review by a second agent (the diff and the test, not my conclusions): the branch still reads test, then fix, now aed6e69d and bd8e6c4e (were dae46b12 and 22c8ce7e). No blocking problem was found; what changed: - test: two notes on consecutive runs of the sound engine at four places in the melody, at 75, 90, 144 and 165 fps, uncapped with varying frame times and around 60 (steps of 0.98 to 1.02). A wrong fix that counts a set flag once per 60 fps frame of time, instead of once per run of the sound job, passed the 26 checks before; it now fails (one of two notes lost at 75 fps and around 60). 76 checks, gcc and clang; it still fails at the test commit on `main` 257c5491. - `host/oot_high_fps.h`: the comment states the thread order the rule relies on: the job's runs are counted at the head of its phase 0 and the flag is written later in that phase, so the playback must not read it inside phase 0. The diagnostic's log shows the game keeps that order (the run count less the flag's clears stayed the same through each playback, 432 reads on five worker threads and the main thread). Also in Risks. - Comments: the flag is a word of the melody's player that its sound handle points to; "a third of the melody" is at about 150 fps; the host function's rule applies above a cap of 60. No code change: `tests/run_all.py` gives the same 607 passed and the same 34 failures that also fail on `main`; `host/oot_high_fps.c` compiles without warnings with gcc, clang, llvm-mingw clang and MinGW gcc.
CraftyCorvid force-pushed fix/ocarina-song-notes-above-60 from bd8e6c4e83
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
to 70835372dc
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-17 23:47:04 +00:00
Compare
Author
Contributor

Rebased onto main c7db6c02: now b1832551 (test) and 70835372 (fix), were aed6e69d and bd8e6c4e. #1434 (a horse's jump above 60) had merged into the same places: host/oot_high_fps.h and .c, nx2/oot_patches.py's patch_file and report, and the README's frame rate cap row. Both are kept, the horse's first, and the host file's head comment names both. The fix's code is unchanged.

After the rebase:

  • tests/test_song_note_cue.py fails at b1832551 and passes at 70835372 (76 checks, gcc and clang).
  • test_horse_jump_step, test_high_fps_fixes, test_patch_hooks_defined, test_ocarina_wait and test_scarecrow_timing pass.
  • host/oot_high_fps.c compiles without warnings with gcc, clang, llvm-mingw clang and MinGW gcc.
  • tests/run_all.py: 633 passed, 38 failed, 91 skipped. The 38 also fail on main c7db6c02. Four of them are new since 257c5491 and fail on main too: test_compute_warm_apart, test_dev_packs (the same "a game patch shows in the objects" on both), test_invalidate_quick, test_switch_table.
Rebased onto `main` c7db6c02: now b1832551 (test) and 70835372 (fix), were aed6e69d and bd8e6c4e. #1434 (a horse's jump above 60) had merged into the same places: `host/oot_high_fps.h` and `.c`, `nx2/oot_patches.py`'s `patch_file` and `report`, and the README's frame rate cap row. Both are kept, the horse's first, and the host file's head comment names both. The fix's code is unchanged. After the rebase: - `tests/test_song_note_cue.py` fails at b1832551 and passes at 70835372 (76 checks, gcc and clang). - `test_horse_jump_step`, `test_high_fps_fixes`, `test_patch_hooks_defined`, `test_ocarina_wait` and `test_scarecrow_timing` pass. - `host/oot_high_fps.c` compiles without warnings with gcc, clang, llvm-mingw clang and MinGW gcc. - `tests/run_all.py`: 633 passed, 38 failed, 91 skipped. The 38 also fail on `main` c7db6c02. Four of them are new since 257c5491 and fail on `main` too: test_compute_warm_apart, test_dev_packs (the same "a game patch shows in the objects" on both), test_invalidate_quick, test_switch_table.
CraftyCorvid changed title from WIP: fix(fps): a song's notes show one at a time with its melody above a 60 fps cap to fix(fps): a song's notes show one at a time with its melody above a 60 fps cap 2026-11-17 23:47:59 +00:00
HumanBean force-pushed fix/ocarina-song-notes-above-60 from 70835372dc
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 97d8b51b20
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 12s
CI / Conventional Commit title (pull_request) Successful in 11s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 17s
CI / Workflow lint (actionlint) (pull_request) Successful in 20s
Third-party parts / As their notes say (pull_request) Successful in 23s
2026-11-18 19:41:16 +00:00
Compare
HumanBean approved these changes 2026-11-18 19:43:20 +00:00
HumanBean left a comment

Quick code review: the note-flag rule (a set flag read again before the sound job's next phase-0 run is the same note) is small and matches the description; the patch is idempotent and warns when either call site is missing. Rebased onto main (af. #1628/#1559): the header comments in host/oot_high_fps.{c,h}, the README line and nx2/oot_patches.py's patch_file/report were union-merged with main's floor-carry and cloth entries; no code changed.

Quick code review: the note-flag rule (a set flag read again before the sound job's next phase-0 run is the same note) is small and matches the description; the patch is idempotent and warns when either call site is missing. Rebased onto main (af. #1628/#1559): the header comments in host/oot_high_fps.{c,h}, the README line and nx2/oot_patches.py's patch_file/report were union-merged with main's floor-carry and cloth entries; no code changed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!1471
No description provided.