feat(modapi): songPlayed, and content flags bound to how a song was played #2658

Merged
HumanBean merged 2 commits from ChloeNow/Longshot:feat/modapi-song-played into mod-api 2026-11-28 00:50:49 +00:00
Contributor

Summary

Mods can't tell when the ocarina plays a song, or how it was played. A mod that wants to react to songs (a tracker, a
randomizer, a mod that changes what a song does) has nothing to listen to, and an event flow can't branch on whether a
song was sung or pressed on the buttons.

This adds two things to the Modding API:

  • songPlayed in longshot/game: { frame, song, source } for the first song the ocarina recognises in each try, keeping at most 16 songs between frames. song is one of
    the game's thirteen (sunsSong, preludeOfLight, scarecrowsSong...), source is "microphone" (sung or played on
    an instrument through the game's Ocarina Mic Input option) or "buttons". It arrives at the acquire phase like the
    other game events (order 28). A filter keeps a listener to the songs it wants, as flagChanged does:
    songPlayed.on(fn, { song: "sunsSong", source: "microphone" }).
  • bind: "ocarina.sung" on a content.flag bool: the game side sets the flag on the game's own thread the moment
    the song is recognised, before the event flow goes on, so a flow (with a flow patch, #2656) can branch on it with no
    script in the way. It comes from the same site as songPlayed, so has("game.songPlayed") says whether a build sets
    it.

How it's found: the event flows ask the query node QueryMelodyTypeForNormal (f_82a7c980) which song was recognised;
a new core site ocarina.melody sits just after its answer (w1), with an engine callback. A try is one run of the
note-wait action (the existing ocarina.waitStart), told once. It's the buttons' when a note button went down in the
word the game reads during the wait, including before the first controller read of the try; a button already held is
not a note until released and pressed again. It's the microphone's when no note button went down and the game listened
on the microphone at some point in the wait (the game stops its streams just before it recognises the song, so this is
kept for the whole try). If neither happened, it's the buttons'.

Read first: game/crates/game-core/src/ocarina.rs (the try, the site's callback, the bound flags, what the API takes),
the site's row in game/sites/sites.toml, then game_events_step in game/crates/api/src/services/game.rs and
content_binds in services/content.rs; the schema's songPlayed (game.toml) and Song, SongSource,
SongPlayed, SongFilter (types.toml). The host's part is small: host/nn_hid.c oc_track hands each read's five
note buttons and host/nn_audio_in.c's new hos_mic_listening to game_ocarina_notes (game/game.h). The test game
plays a song with game.playSong(song, { source }), through the same game_core::ocarina::tell the site uses.

This is #2267's change, made again on the Rust mod API and the new hook sites; #2267 (the C mod API) can close. Part of
#1958's Modding API; targets mod-api. Magic Singing (a mod that skips the song cutscene when you sing) uses it with the
flow patches (#2656) and flags by id (#2657).

Testing

Tested: Windows 11, NVIDIA GeForce RTX 4060 Laptop GPU, driver 621.24. In the game (a quick build of current
mod-api with this, #2656 and #2657; dev.py game-tests, the repository's kokiri-start): the lift places
ocarina.melody in f_82a7c980 (gen/edits.txt); a mod that requires game.songPlayed, declares a flag with
bind: "ocarina.sung" and listens to songPlayed (once with a filter) starts, has("game.songPlayed") is true, its
bound flag is in the game, and its test passes. Checks: cargo test -p game-core (ocarina: a try told once, on the
buttons or heard, a held button that is no note, none recognised, nothing kept while not watched), -p content (the
content vectors: a bound bool flag, bind refused on an int and for an unknown target), -p modtool (the test game:
songPlayed and a filtered listener, the bound flag set at once each way, an unknown song refused), -p api,
-p game-sites, -p sites --test repository; cargo check --workspace --all-targets; cargo run -p schema-gen -- --check; rustfmt. Tests that fail on mod-api itself and here, on Windows: api's
a_content_mods_changed_module_runs_again_and_its_outputs_are_served, modtool's
eden_and_ryujinx_mods_are_found_with_their_switches, and longshot-game's three path tests
(a_folder_of_mods_tests_each_of_its_folders, a_mods_profile_sits_inside_the_launchers_save_folder,
a_separate_mod_moves_the_saves_into_its_profile_and_records_it).

The C version (#2267) was played: songs on the buttons told once as "buttons" with the bound flag 0, songs sung told
as "microphone" with the flag 1 and the flow taking the bound branch. The site and the offset are the same here.

Still to test:

  • Songs played in this build: one on the buttons and one sung, songPlayed and the bound flag each way (a playtest:
    the ocarina in hand)
  • Linux, and clippy with warnings as errors: mise run rust and mise run test (by hand, or CI)

Measurements

Nothing to measure: the site runs once per recognised song and sets nothing while no mod listens or binds a flag; the
note tracking is a few loads and compares per controller read.

Risks

A new engine site in the melody query: if its signature stops matching on another build, songPlayed is absent there
(has() false), a bound flag stays false, and nothing else changes. With no mod using it, nothing a player notices. The
generated docs' schema hash (docs/modding/*.md), and testing_game/tests.rs beside #2657's new test, conflict with
#2656 and #2657: whichever merges later needs cargo run -p schema-gen again and both tests kept.

Checklist

Ready for review

  • One topic, on current mod-api; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A check under tests/ that reads changed source is updated, not weakened. (builder/crates/sites/tests/site_owners.txt names the new site)
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary Mods can't tell when the ocarina plays a song, or how it was played. A mod that wants to react to songs (a tracker, a randomizer, a mod that changes what a song does) has nothing to listen to, and an event flow can't branch on whether a song was sung or pressed on the buttons. This adds two things to the Modding API: - **`songPlayed`** in `longshot/game`: `{ frame, song, source }` for the first song the ocarina recognises in each try, keeping at most 16 songs between frames. `song` is one of the game's thirteen (`sunsSong`, `preludeOfLight`, `scarecrowsSong`...), `source` is `"microphone"` (sung or played on an instrument through the game's Ocarina Mic Input option) or `"buttons"`. It arrives at the acquire phase like the other game events (order 28). A filter keeps a listener to the songs it wants, as `flagChanged` does: `songPlayed.on(fn, { song: "sunsSong", source: "microphone" })`. - **`bind: "ocarina.sung"`** on a `content.flag` bool: the game side sets the flag on the game's own thread the moment the song is recognised, before the event flow goes on, so a flow (with a flow patch, #2656) can branch on it with no script in the way. It comes from the same site as `songPlayed`, so `has("game.songPlayed")` says whether a build sets it. How it's found: the event flows ask the query node `QueryMelodyTypeForNormal` (`f_82a7c980`) which song was recognised; a new core site `ocarina.melody` sits just after its answer (`w1`), with an engine callback. A try is one run of the note-wait action (the existing `ocarina.waitStart`), told once. It's the buttons' when a note button went down in the word the game reads during the wait, including before the first controller read of the try; a button already held is not a note until released and pressed again. It's the microphone's when no note button went down and the game listened on the microphone at some point in the wait (the game stops its streams just before it recognises the song, so this is kept for the whole try). If neither happened, it's the buttons'. Read first: `game/crates/game-core/src/ocarina.rs` (the try, the site's callback, the bound flags, what the API takes), the site's row in `game/sites/sites.toml`, then `game_events_step` in `game/crates/api/src/services/game.rs` and `content_binds` in `services/content.rs`; the schema's `songPlayed` (`game.toml`) and `Song`, `SongSource`, `SongPlayed`, `SongFilter` (`types.toml`). The host's part is small: `host/nn_hid.c` `oc_track` hands each read's five note buttons and `host/nn_audio_in.c`'s new `hos_mic_listening` to `game_ocarina_notes` (`game/game.h`). The test game plays a song with `game.playSong(song, { source })`, through the same `game_core::ocarina::tell` the site uses. This is #2267's change, made again on the Rust mod API and the new hook sites; #2267 (the C mod API) can close. Part of #1958's Modding API; targets `mod-api`. Magic Singing (a mod that skips the song cutscene when you sing) uses it with the flow patches (#2656) and flags by id (#2657). ## Testing **Tested:** Windows 11, NVIDIA GeForce RTX 4060 Laptop GPU, driver 621.24. In the game (a quick build of current `mod-api` with this, #2656 and #2657; `dev.py game-tests`, the repository's `kokiri-start`): the lift places `ocarina.melody` in `f_82a7c980` (`gen/edits.txt`); a mod that `requires` `game.songPlayed`, declares a flag with `bind: "ocarina.sung"` and listens to `songPlayed` (once with a filter) starts, `has("game.songPlayed")` is true, its bound flag is in the game, and its test passes. Checks: `cargo test -p game-core` (`ocarina`: a try told once, on the buttons or heard, a held button that is no note, none recognised, nothing kept while not watched), `-p content` (the content vectors: a bound bool flag, `bind` refused on an int and for an unknown target), `-p modtool` (the test game: `songPlayed` and a filtered listener, the bound flag set at once each way, an unknown song refused), `-p api`, `-p game-sites`, `-p sites --test repository`; `cargo check --workspace --all-targets`; `cargo run -p schema-gen -- --check`; rustfmt. Tests that fail on `mod-api` itself and here, on Windows: `api`'s `a_content_mods_changed_module_runs_again_and_its_outputs_are_served`, `modtool`'s `eden_and_ryujinx_mods_are_found_with_their_switches`, and `longshot-game`'s three path tests (`a_folder_of_mods_tests_each_of_its_folders`, `a_mods_profile_sits_inside_the_launchers_save_folder`, `a_separate_mod_moves_the_saves_into_its_profile_and_records_it`). The C version (#2267) was played: songs on the buttons told once as `"buttons"` with the bound flag 0, songs sung told as `"microphone"` with the flag 1 and the flow taking the bound branch. The site and the offset are the same here. **Still to test:** - Songs played in this build: one on the buttons and one sung, `songPlayed` and the bound flag each way (a playtest: the ocarina in hand) - Linux, and clippy with warnings as errors: `mise run rust` and `mise run test` (by hand, or CI) ## Measurements Nothing to measure: the site runs once per recognised song and sets nothing while no mod listens or binds a flag; the note tracking is a few loads and compares per controller read. ## Risks A new engine site in the melody query: if its signature stops matching on another build, `songPlayed` is absent there (`has()` false), a bound flag stays false, and nothing else changes. With no mod using it, nothing a player notices. The generated docs' schema hash (`docs/modding/*.md`), and `testing_game/tests.rs` beside #2657's new test, conflict with #2656 and #2657: whichever merges later needs `cargo run -p schema-gen` again and both tests kept. ## Checklist ### Ready for review - [x] One topic, on current `mod-api`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes (any failure that also fails on `main` is named). <!-- Windows run as Testing says; clippy and Linux: CI --> - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A check under `tests/` that reads changed source is updated, not weakened. (`builder/crates/sites/tests/site_owners.txt` names the new site) - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. <!-- Windows built and played; Linux: CI --> - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(modapi): songPlayed, and content flags bound to how a song was played
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 8s
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
026d5d5084
Mods can't tell when the ocarina plays a song, or how: a tracker, a randomizer or a mod that changes what a song does
has nothing to listen to, and an event flow can't branch on whether a song was sung or pressed on the buttons.

- longshot/game's songPlayed: { frame, song, source } for each song the ocarina recognises, once a try, at the
  acquire phase (order 28). song is one of the game's thirteen (the schema's Song, in the game's order), source
  "microphone" (heard through the game's own microphone option, no note button pressed in the try) or "buttons".
  A SongFilter keeps a listener to one song, one way of playing, or both.
- content.flag's bind: "ocarina.sung" on a bool flag: the game side sets it as the song is recognised, on the game's
  thread, before the flow goes on (true heard, false on the buttons), so a flow patch can branch on it.

The site ocarina.melody (game/sites/sites.toml) sits just after QueryMelodyTypeForNormal's answer (f_82a7c980, w1);
game_core::ocarina tells a try's first song (a try: one run of the note-wait action, ocarina.waitStart), sets the
bound flags and keeps it for the API. host/nn_hid.c hands each read's five note buttons, and whether the game
listens on the microphone (host/nn_audio_in.c hos_mic_listening), to game_ocarina_notes. The API fires the event in
game_events_step and hands the running mods' bound flags (content::plan::Content::binds) to the game side when they
change; has("game.songPlayed") follows the site. The test game plays a song with game.playSong(song, { source }).

Tests: game-core's ocarina (a try told once, buttons or heard, none recognised, not watched), the content vectors
(a bound bool flag, bind refused on an int and for an unknown target), modtool's testing_game (songPlayed and a
filter, the bound flag set at once each way, an unknown song refused).

This replaces #2267, which made the same change to the C mod API.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: Windows 11, RTX 4060 Laptop, a quick build of current mod-api with this, #2656 and #2657: the lift places ocarina.melody in f_82a7c980, and a mod that requires game.songPlayed, binds a flag to ocarina.sung and listens to songPlayed starts with has("game.songPlayed") true and its flag in the game; its test passes (dev.py game-tests, kokiri-start). A song played in this build is still to do (a playtest).

Tested in game: Windows 11, RTX 4060 Laptop, a quick build of current mod-api with this, #2656 and #2657: the lift places ocarina.melody in f_82a7c980, and a mod that requires game.songPlayed, binds a flag to ocarina.sung and listens to songPlayed starts with has("game.songPlayed") true and its flag in the game; its test passes (dev.py game-tests, kokiri-start). A song played in this build is still to do (a playtest).
Owner
@review
BeanBot left a comment

Recommendation: Request changes. The new event can report the wrong input source, silently leaves some declared bound flags unchanged, and fires out of its declared order. The actual song-recognition path has not yet been played in this build.

Adds a song-recognition event and flags that let event flows branch on how a song was played. The API is useful, but its input tracking, flag limit, and event ordering need correction.

Blocking (2): must change before merging.

  1. L1 game/crates/game-core/src/ocarina.rs:79: The first controller sample after a try starts is always treated as already held, even if the button went down after the wait began. (more on the line) Do: Preserve a baseline from before the try starts and compare the first wait sample against it; add a test for a press between start and the first read.
  2. L5: It conflicts with its base branch: bring it up to date (@​fix or @​rebase try first). (for the author)

Should fix (2): not blocking, but worth doing before merging.

  • L2 game/crates/game-core/src/ocarina.rs:165: The binding list silently truncates valid declarations after 64 flags. (more on the line) Do: Support all accepted bindings, or enforce and report a shared limit before accepting declarations; test the boundary.
  • L3 game/crates/api/src/services/game.rs:229: songPlayed fires before paused, although the schema assigns it order 28, after paused at order 24. (more on the line) Do: Fire songPlayed after the lower-order game events and add an ordering test covering events in the same frame.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L4 game/sites/sites.toml:1090: The new recognition and binding path has not been exercised by playing a song in this build. (more on the line) Do: Play a song on buttons and through the microphone on this head, checking the event, its source, and the bound flow flag; also exercise the path on Linux.

@fix can do L1, L2 and L3.

Checks: Still running: Guide screenshots / Guide images and local UI source review (pull_request), Third-party parts / As their notes say (pull_request), Third-party parts / The same as upstream (pull_request).

More: does it help, other systems, switches, what was read

Does it help: Unproven: the reported Windows run verifies hook placement and the fake-game test, but did not play a song through this build. No before-and-after performance numbers were reported.

Other systems: The hook and input tracking run on Windows and Linux and can affect controller reads even without a listening mod. The reported run covers Windows and one NVIDIA GPU; Linux and actual button and microphone song recognition remain untested. The fake game bypasses the hook and input tracking.

Switches: None.

Reviewed: 026d5d5084 against 3391f978eb: Read the supplied rules, PR description, comment and CI results; CONTRIBUTING.md, AGENTS.md, the PR template, standards, the diff and commit message. Read the new ocarina module and relevant wait, controller, flag and event code; skimmed generated documentation, schema, vectors and test changes. The requested review checklist and adjacent Tooling AGENTS.md were absent. The larger changed files and all surrounding callers were not read in full.; nothing run (a code review).

Checked and fine:

  • The commit records AI assistance in a Co-Authored-By trailer.
  • The change adds no environment switch and does not change the renderer interface.
  • The supplied CI results list no failure specific to this head.

Testing: No commands from the project, builds, or tests were run, as requested. The author's reported tests and playtest limitations are described above.

Overlaps and merge order: The PR identifies #2656 and #2657 as overlapping generated docs and test changes; their merge order is not established here.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The new event can report the wrong input source, silently leaves some declared bound flags unchanged, and fires out of its declared order. The actual song-recognition path has not yet been played in this build. Adds a song-recognition event and flags that let event flows branch on how a song was played. The API is useful, but its input tracking, flag limit, and event ordering need correction. **Blocking (2)**: must change before merging. 1. **L1** `game/crates/game-core/src/ocarina.rs:79`: The first controller sample after a try starts is always treated as already held, even if the button went down after the wait began. (more on the line) **Do:** Preserve a baseline from before the try starts and compare the first wait sample against it; add a test for a press between start and the first read. 2. **L5**: It conflicts with its base branch: bring it up to date (`@​fix` or `@​rebase` try first). *(for the author)* **Should fix (2)**: not blocking, but worth doing before merging. - **L2** `game/crates/game-core/src/ocarina.rs:165`: The binding list silently truncates valid declarations after 64 flags. (more on the line) **Do:** Support all accepted bindings, or enforce and report a shared limit before accepting declarations; test the boundary. - **L3** `game/crates/api/src/services/game.rs:229`: songPlayed fires before paused, although the schema assigns it order 28, after paused at order 24. (more on the line) **Do:** Fire songPlayed after the lower-order game events and add an ordering test covering events in the same frame. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L4** `game/sites/sites.toml:1090`: The new recognition and binding path has not been exercised by playing a song in this build. (more on the line) **Do:** Play a song on buttons and through the microphone on this head, checking the event, its source, and the bound flow flag; also exercise the path on Linux. `@fix` can do L1, L2 and L3. **Checks:** Still running: `Guide screenshots / Guide images and local UI source review (pull_request)`, `Third-party parts / As their notes say (pull_request)`, `Third-party parts / The same as upstream (pull_request)`. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven: the reported Windows run verifies hook placement and the fake-game test, but did not play a song through this build. No before-and-after performance numbers were reported. **Other systems:** The hook and input tracking run on Windows and Linux and can affect controller reads even without a listening mod. The reported run covers Windows and one NVIDIA GPU; Linux and actual button and microphone song recognition remain untested. The fake game bypasses the hook and input tracking. **Switches:** None. **Reviewed:** 026d5d5084a3 against 3391f978ebd9: Read the supplied rules, PR description, comment and CI results; CONTRIBUTING.md, AGENTS.md, the PR template, standards, the diff and commit message. Read the new ocarina module and relevant wait, controller, flag and event code; skimmed generated documentation, schema, vectors and test changes. The requested review checklist and adjacent Tooling AGENTS.md were absent. The larger changed files and all surrounding callers were not read in full.; nothing run (a code review). **Checked and fine:** - The commit records AI assistance in a Co-Authored-By trailer. - The change adds no environment switch and does not change the renderer interface. - The supplied CI results list no failure specific to this head. **Testing:** No commands from the project, builds, or tests were run, as requested. The author's reported tests and playtest limitations are described above. **Overlaps and merge order:** The PR identifies #2656 and #2657 as overlapping generated docs and test changes; their merge order is not established here. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -212,6 +226,15 @@ impl Services {
}
}
}
if songs {
Member

L3 (should fix): songPlayed fires before paused, although the schema assigns it order 28, after paused at order 24.

When: When a pause change and a recognised song are delivered in the same frame, a mod subscribed to both observes songPlayed first, contrary to the documented frame order.

Do: Fire songPlayed after the lower-order game events and add an ordering test covering events in the same frame.

**L3** (should fix): songPlayed fires before paused, although the schema assigns it order 28, after paused at order 24. *When:* When a pause change and a recognised song are delivered in the same frame, a mod subscribed to both observes songPlayed first, contrary to the documented frame order. **Do:** Fire songPlayed after the lower-order game events and add an ordering test covering events in the same frame.
@ -0,0 +76,4 @@
if SEEN_START.swap(starts, Ordering::AcqRel) != starts {
HELD.store(held, Ordering::Relaxed);
BUTTONS_USED.store(false, Ordering::Release);
MIC_SEEN.store(false, Ordering::Release);
Member

L1 (blocking): The first controller sample after a try starts is always treated as already held, even if the button went down after the wait began.

When: With microphone listening, a note button pressed between waitStart and the next controller read is copied into HELD before the edge check. If no later button goes down, the recognised song is reported as microphone and the bound flag is true despite a note-button press.

Do: Preserve a baseline from before the try starts and compare the first wait sample against it; add a test for a press between start and the first read.

**L1** (blocking): The first controller sample after a try starts is always treated as already held, even if the button went down after the wait began. *When:* With microphone listening, a note button pressed between waitStart and the next controller read is copied into HELD before the edge check. If no later button goes down, the recognised song is reported as microphone and the bound flag is true despite a note-button press. **Do:** Preserve a baseline from before the try starts and compare the first wait sample against it; add a test for a press between start and the first read.
@ -0,0 +162,4 @@
}
/// The flags set at each recognised song (every running mod's content flags bound to `"ocarina.sung"`, by the game's
/// hash of their names), in place of the last set; at most [`BINDS_MAX`]. Any thread.
Member

L2 (should fix): The binding list silently truncates valid declarations after 64 flags.

When: A mod can declare more than 64 bound bool flags, or several mods can exceed 64 together. content_binds returns them all, but binds keeps only the first 64, so the remaining flags retain old values and their flows take the wrong branch.

Do: Support all accepted bindings, or enforce and report a shared limit before accepting declarations; test the boundary.

**L2** (should fix): The binding list silently truncates valid declarations after 64 flags. *When:* A mod can declare more than 64 bound bool flags, or several mods can exceed 64 together. content_binds returns them all, but binds keeps only the first 64, so the remaining flags retain old values and their flows take the wrong branch. **Do:** Support all accepted bindings, or enforce and report a shared limit before accepting declarations; test the boundary.
@ -1086,0 +1087,4 @@
# (game/crates/game-core/src/ocarina.rs on_ocarina_melody, registered in game/crates/game-core/src/engine.rs).
[[site]]
name = "ocarina.melody"
engine = "hos_site_ocarina_melody"
Member

L4 (should fix): The new recognition and binding path has not been exercised by playing a song in this build.

When: The recorded run establishes site placement and exercises the fake game, whose playSong calls tell directly; it does not establish that actual button and microphone input reaches the hook with the correct song and source.

Do: Play a song on buttons and through the microphone on this head, checking the event, its source, and the bound flow flag; also exercise the path on Linux.

**L4** (should fix): The new recognition and binding path has not been exercised by playing a song in this build. *When:* The recorded run establishes site placement and exercises the fake game, whose playSong calls tell directly; it does not establish that actual button and microphone input reaches the hook with the correct song and source. **Do:** Play a song on buttons and through the microphone on this head, checking the event, its source, and the bound flow flag; also exercise the path on Linux.
Owner
@fix
BeanBot force-pushed feat/modapi-song-played from 026d5d5084
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 8s
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 7c99c02439
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 8s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
Third-party parts / As their notes say (pull_request) Successful in 14s
2026-11-27 23:12:16 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The event and bound flag have not yet been exercised by playing songs in this build. The recorded automated checks and earlier C implementation playtest do not establish that the new integration works in game. Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is 7c99c02439. I rebased it onto mod-api (0c803d490c).

Conflicts resolved

  • docs/modding/permissions.md: Kept both sets of permissions and updated the combined schema hash.
  • docs/modding/reference.md: Kept both API additions and updated the combined schema hash.
  • docs/modding/scripting.md: Kept both generated additions and updated the combined schema hash. I edited its description to match the change.

Changed

  • First controller sample after a try starts: Preserved the preceding controller sample for the first edge check and added coverage for a press before the first wait read in game/crates/game-core/src/ocarina.rs:72.
  • Bound flags truncated after 64: Removed the binding limit and added coverage at 64 and 65 bindings in game/crates/game-core/src/ocarina.rs:163.
  • songPlayed event order: Moved song dispatch after pause dispatch and added a same-frame ordering check in game/crates/api/src/services/game.rs:244 and game/crates/modtool/src/testing_game/tests.rs:230. Tests were not run, as requested.

Nothing was built or run: the checks run again on the new head.

The change lets mods react to recognized songs and lets event flows branch on whether a song was heard through the microphone. The fix preserves that feature while correcting first-read tracking, the binding limit and event order; the integration still needs a playtest.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L4 game/sites/sites.toml:1090: The new recognition and binding path has not been exercised by playing a song in this build. When: The recorded run establishes site placement and exercises the fake game, whose playSong calls tell directly; it does not establish that actual button and microphone input reaches the hook with the correct song and source. Do: Play a song on buttons and through the microphone on this head, checking the event, its source, and the bound flow flag; also exercise the path on Linux.

Checks: they run again on this head; a failure shows on the pull request.

Also noticed (1; not asked for, not blocking)
  • The description reports conflicts with #2656 and #2657 in generated documentation and the test file; the later merge needs to preserve both tests and regenerate the schema documentation.
More: does it help, other systems, switches, what was read

Does it help: Unproven: the test game and mod startup were reported working on Windows, but neither a button-played nor a sung song has been tested in this build.

Other systems: The host input and microphone paths run on Windows and Linux. The reported integration check was on Windows; Linux and actual song recognition remain untested.

Switches: No switches added, changed or removed.

Reviewed: 7c99c02439 against 0c803d490c: Read game/crates/game-core/src/ocarina.rs in full and inspected the fix diff, event dispatch, the changed test, relevant callers, repository rules and reported runs. The large base diff, other changed files and generated documentation were not read in full.; nothing run (a code review).

Checked and fine:

  • The fix retains the previous controller sample, removes the 64-binding truncation and dispatches song events after pause events.
  • The fix does not remove or route around the song event or bound-flag feature.

Testing: No commands that build or run code were executed. The author reports Windows automated checks and a mod startup test; the song playtest and Linux checks remain outstanding, and CI has not run on this head.

Overlaps and merge order: #2656 and #2657 overlap in generated documentation and tests; whichever merges later needs conflict resolution and schema regeneration.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The event and bound flag have not yet been exercised by playing songs in this build. The recorded automated checks and earlier C implementation playtest do not establish that the new integration works in game. Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is 7c99c02439bc. I rebased it onto `mod-api` (0c803d490c84). **Conflicts resolved** - docs/modding/permissions.md: Kept both sets of permissions and updated the combined schema hash. - docs/modding/reference.md: Kept both API additions and updated the combined schema hash. - docs/modding/scripting.md: Kept both generated additions and updated the combined schema hash. I edited its description to match the change. **Changed** - **First controller sample after a try starts**: Preserved the preceding controller sample for the first edge check and added coverage for a press before the first wait read in game/crates/game-core/src/ocarina.rs:72. - **Bound flags truncated after 64**: Removed the binding limit and added coverage at 64 and 65 bindings in game/crates/game-core/src/ocarina.rs:163. - **songPlayed event order**: Moved song dispatch after pause dispatch and added a same-frame ordering check in game/crates/api/src/services/game.rs:244 and game/crates/modtool/src/testing_game/tests.rs:230. Tests were not run, as requested. Nothing was built or run: the checks run again on the new head. The change lets mods react to recognized songs and lets event flows branch on whether a song was heard through the microphone. The fix preserves that feature while correcting first-read tracking, the binding limit and event order; the integration still needs a playtest. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L4** `game/sites/sites.toml:1090`: The new recognition and binding path has not been exercised by playing a song in this build. *When:* The recorded run establishes site placement and exercises the fake game, whose playSong calls tell directly; it does not establish that actual button and microphone input reaches the hook with the correct song and source. **Do:** Play a song on buttons and through the microphone on this head, checking the event, its source, and the bound flow flag; also exercise the path on Linux. **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>Also noticed (1; not asked for, not blocking)</summary> - The description reports conflicts with #2656 and #2657 in generated documentation and the test file; the later merge needs to preserve both tests and regenerate the schema documentation. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven: the test game and mod startup were reported working on Windows, but neither a button-played nor a sung song has been tested in this build. **Other systems:** The host input and microphone paths run on Windows and Linux. The reported integration check was on Windows; Linux and actual song recognition remain untested. **Switches:** No switches added, changed or removed. **Reviewed:** 7c99c02439bc against 0c803d490c84: Read game/crates/game-core/src/ocarina.rs in full and inspected the fix diff, event dispatch, the changed test, relevant callers, repository rules and reported runs. The large base diff, other changed files and generated documentation were not read in full.; nothing run (a code review). **Checked and fine:** - The fix retains the previous controller sample, removes the 64-binding truncation and dispatches song events after pause events. - The fix does not remove or route around the song event or bound-flag feature. **Testing:** No commands that build or run code were executed. The author reports Windows automated checks and a mod startup test; the song playtest and Linux checks remain outstanding, and CI has not run on this head. **Overlaps and merge order:** #2656 and #2657 overlap in generated documentation and tests; whichever merges later needs conflict resolution and schema regeneration. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
Owner
@fix
BeanBot force-pushed feat/modapi-song-played from 7c99c02439
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 8s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
Third-party parts / As their notes say (pull_request) Successful in 14s
to b180af9425
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 6s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
Third-party parts / As their notes say (pull_request) Successful in 14s
2026-11-27 23:43:32 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left (a run of the change itself). The API and bound flag are in place, but their actual recognition path still needs a playtest with both button and microphone input. Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is b180af9425. I rebased it onto mod-api (3f47557067).

Conflicts resolved

  • docs/modding/permissions.md: Updated the combined schema hash, retaining both sides’ permission entries.
  • docs/modding/reference.md: Updated the combined schema hash, retaining both sides’ reference content.
  • docs/modding/scripting.md: Updated the combined schema hash, retaining both sides’ generated entries.
  • game/crates/content/src/plan/mod.rs: Kept both independent item slots and flag bindings.

Nothing was built or run: the checks run again on the new head.

Mods can listen for recognised songs and branch on how they were played. The change adds input tracking and a recognition hook; its in-game behaviour remains to be demonstrated.

Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)

  • L4 game/sites/sites.toml:1090: The new recognition and binding path has not been exercised by playing a song in this build. When: The recorded run establishes site placement and exercises the fake game, whose playSong calls tell directly; it does not establish that actual button and microphone input reaches the hook with the correct song and source. Do: Play a song on buttons and through the microphone on this head, checking the event, its source, and the bound flow flag; also exercise the path on Linux.

Checks: they run again on this head (Guide screenshots / Guide images and local UI source review (pull_request) failed on the last one); a failure shows on the pull request.

More: does it help, other systems, switches, what was read

Does it help: Unproven: the reported Windows run verified the site, feature availability and mod startup, but did not play a song in this build.

Other systems: The host input and microphone paths run on Windows and Linux; Linux checks are still outstanding. The site is build-specific and feature availability reports whether it was found.

Switches: None added, changed or removed.

Reviewed: b180af9425 against 3f47557067: Read AGENTS.md, CONTRIBUTING.md, the pull request template and game/crates/game-core/src/ocarina.rs in full. Examined the recognition site, host input and microphone changes, API event and binding changes, rebased documentation changes and recorded test results; the remaining changed files and generated documentation were not read in full.; nothing run (a code review).

Checked and fine:

  • The rebased generated feature list retains game.songPlayed alongside the features added on the new base.

Testing: No commands that run the project or tests were executed. The author reports game-free checks and a Windows startup integration run; the song playtest and Linux checks remain outstanding, and CI has not run on this head.

Overlaps and merge order: The description identifies potential generated documentation and test conflicts with #2656 and #2657; merge order is not established.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left (a run of the change itself). The API and bound flag are in place, but their actual recognition path still needs a playtest with both button and microphone input. Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is b180af9425a8. I rebased it onto `mod-api` (3f4755706727). **Conflicts resolved** - docs/modding/permissions.md: Updated the combined schema hash, retaining both sides’ permission entries. - docs/modding/reference.md: Updated the combined schema hash, retaining both sides’ reference content. - docs/modding/scripting.md: Updated the combined schema hash, retaining both sides’ generated entries. - game/crates/content/src/plan/mod.rs: Kept both independent item slots and flag bindings. Nothing was built or run: the checks run again on the new head. Mods can listen for recognised songs and branch on how they were played. The change adds input tracking and a recognition hook; its in-game behaviour remains to be demonstrated. **Testing before merging (1)** (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation) - **L4** `game/sites/sites.toml:1090`: The new recognition and binding path has not been exercised by playing a song in this build. *When:* The recorded run establishes site placement and exercises the fake game, whose playSong calls tell directly; it does not establish that actual button and microphone input reaches the hook with the correct song and source. **Do:** Play a song on buttons and through the microphone on this head, checking the event, its source, and the bound flow flag; also exercise the path on Linux. **Checks:** they run again on this head (`Guide screenshots / Guide images and local UI source review (pull_request)` failed on the last one); a failure shows on the pull request. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven: the reported Windows run verified the site, feature availability and mod startup, but did not play a song in this build. **Other systems:** The host input and microphone paths run on Windows and Linux; Linux checks are still outstanding. The site is build-specific and feature availability reports whether it was found. **Switches:** None added, changed or removed. **Reviewed:** b180af9425a8 against 3f4755706727: Read AGENTS.md, CONTRIBUTING.md, the pull request template and game/crates/game-core/src/ocarina.rs in full. Examined the recognition site, host input and microphone changes, API event and binding changes, rebased documentation changes and recorded test results; the remaining changed files and generated documentation were not read in full.; nothing run (a code review). **Checked and fine:** - The rebased generated feature list retains game.songPlayed alongside the features added on the new base. **Testing:** No commands that run the project or tests were executed. The author reports game-free checks and a Windows startup integration run; the song playtest and Linux checks remain outstanding, and CI has not run on this head. **Overlaps and merge order:** The description identifies potential generated documentation and test conflicts with #2656 and #2657; merge order is not established. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
Owner
@fix
BeanBot force-pushed feat/modapi-song-played from b180af9425
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Website / Website preview, upload (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 6s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
Third-party parts / As their notes say (pull_request) Successful in 14s
to a8050b23ba
Some checks failed
Website / Website preview, upload (pull_request_target) Has been skipped
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, build (pull_request_target) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 10s
Third-party parts / As their notes say (pull_request) Successful in 15s
PR description / Description follows the template (pull_request_target) Failing after 7s
2026-11-28 00:20:18 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The new event and bound flag have not yet been exercised by playing songs in this build. A buttons-and-microphone playtest is needed before the feature is shown working. Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is a8050b23ba. I rebased it onto mod-api (37c16741d7).

Conflicts resolved

  • docs/modding/permissions.md: Updated the combined schema hash, retaining both sides.
  • docs/modding/reference.md: Updated the combined schema hash, retaining both sides.
  • docs/modding/scripting.md: Updated the abbreviated combined schema hash, retaining both sides.
  • game/crates/modtool/src/testing_game/tests.rs: Kept the existing resolution.

Nothing was built or run: the checks run again on the new head.

Adds a song recognition event and a content flag that lets mods branch on how a song was played. It gives mods a useful integration point, with added input tracking and a game hook whose real-game behavior remains unverified.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L4 game/sites/sites.toml:1090: The new recognition and binding path has not been exercised by playing a song in this build. When: The recorded run establishes site placement and exercises the fake game, whose playSong calls tell directly; it does not establish that actual button and microphone input reaches the hook with the correct song and source. Do: Play a song on buttons and through the microphone on this head, checking the event, its source, and the bound flow flag; also exercise the path on Linux.

Checks: they run again on this head (Guide screenshots / Guide images and local UI source review (pull_request) failed on the last one); a failure shows on the pull request.

Also noticed (2; not asked for, not blocking)
  • Linux host build and integration coverage remain unreported.
  • CI has not run on this head.
More: does it help, other systems, switches, what was read

Does it help: Unproven: the recorded Windows run confirms that the site and mod start, but did not play a song through the new path. The test game exercises event delivery and flag binding without exercising recognition in the game.

Other systems: The path touches controller reads, microphone streams, the game thread and mod event delivery on Windows and Linux. The recorded Windows run did not exercise song recognition; Linux remains untested.

Switches: None.

Reviewed: a8050b23ba against 37c16741d7: Read game/crates/game-core/src/ocarina.rs, the repository rules and pull request template; inspected the changed site, host input and microphone paths, API and content diffs, rebased schema and generated documentation changes. The remaining changed files and surrounding callers were not read in full.; nothing run (a code review).

Checked and fine:

  • The three changed generated schema hash references agree.
  • The test game checks filtered song events and immediate bound flag updates for both sources.

Testing: No commands that build or run the project were executed. The author reports Windows game startup and game-free checks; the actual song playtest remains outstanding.

Overlaps and merge order: The description identifies documentation and test conflicts with #2656 and #2657; later merges need regenerated schema documentation and both tests retained.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The new event and bound flag have not yet been exercised by playing songs in this build. A buttons-and-microphone playtest is needed before the feature is shown working. Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is a8050b23ba0a. I rebased it onto `mod-api` (37c16741d741). **Conflicts resolved** - docs/modding/permissions.md: Updated the combined schema hash, retaining both sides. - docs/modding/reference.md: Updated the combined schema hash, retaining both sides. - docs/modding/scripting.md: Updated the abbreviated combined schema hash, retaining both sides. - game/crates/modtool/src/testing_game/tests.rs: Kept the existing resolution. Nothing was built or run: the checks run again on the new head. Adds a song recognition event and a content flag that lets mods branch on how a song was played. It gives mods a useful integration point, with added input tracking and a game hook whose real-game behavior remains unverified. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L4** `game/sites/sites.toml:1090`: The new recognition and binding path has not been exercised by playing a song in this build. *When:* The recorded run establishes site placement and exercises the fake game, whose playSong calls tell directly; it does not establish that actual button and microphone input reaches the hook with the correct song and source. **Do:** Play a song on buttons and through the microphone on this head, checking the event, its source, and the bound flow flag; also exercise the path on Linux. **Checks:** they run again on this head (`Guide screenshots / Guide images and local UI source review (pull_request)` failed on the last one); a failure shows on the pull request. <details> <summary>Also noticed (2; not asked for, not blocking)</summary> - Linux host build and integration coverage remain unreported. - CI has not run on this head. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven: the recorded Windows run confirms that the site and mod start, but did not play a song through the new path. The test game exercises event delivery and flag binding without exercising recognition in the game. **Other systems:** The path touches controller reads, microphone streams, the game thread and mod event delivery on Windows and Linux. The recorded Windows run did not exercise song recognition; Linux remains untested. **Switches:** None. **Reviewed:** a8050b23ba0a against 37c16741d741: Read game/crates/game-core/src/ocarina.rs, the repository rules and pull request template; inspected the changed site, host input and microphone paths, API and content diffs, rebased schema and generated documentation changes. The remaining changed files and surrounding callers were not read in full.; nothing run (a code review). **Checked and fine:** - The three changed generated schema hash references agree. - The test game checks filtered song events and immediate bound flag updates for both sources. **Testing:** No commands that build or run the project were executed. The author reports Windows game startup and game-free checks; the actual song playtest remains outstanding. **Overlaps and merge order:** The description identifies documentation and test conflicts with #2656 and #2657; later merges need regenerated schema documentation and both tests retained. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
HumanBean changed title from WIP: feat(modapi): songPlayed, and content flags bound to how a song was played to feat(modapi): songPlayed, and content flags bound to how a song was played 2026-11-28 00:50:43 +00:00
HumanBean merged commit 0cc7332c79 into mod-api 2026-11-28 00:50:49 +00:00
HumanBean deleted branch feat/modapi-song-played 2026-11-28 00:50:50 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 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!2658
No description provided.