Skip to content

Implement native GBA cry playback and world-script waits - #289

Closed
Roxas2712 wants to merge 140 commits into
UNDERdecoded:mainfrom
Roxas2712:feature/native-cry-commands
Closed

Roxas2712 wants to merge 140 commits into
UNDERdecoded:mainfrom
Roxas2712:feature/native-cry-commands

Conversation

@Roxas2712

@Roxas2712 Roxas2712 commented Oct 26, 2026 •

Copy link
Copy Markdown

Native GBA playmoncry currently loses its mode and defers playback to a later text dialog; waitmoncry is lowered to a no-op. This starts the recording immediately, resolves species/mode variables, and yields the actual world runner until native cry completion.

FireRed/Emerald playback now handles Game Freak DPCM, all 13 cry modes, native pitch/chorus/reverse/release controls and Emerald's mode-six volume. Hoenn species use their native cry-ID control table; the importer writes the correct mapping and runtime playback repairs older stock sequential entries while retaining explicit mod overrides. PCM is cached separately from fresh, independently owned playback sources. Isolated dex playback does not replace world wait state or music attenuation.

The real audio clock runs separately from accelerated logic. Wait polling supplies a tick only when the audio service did not advance; recording-derived expiry, early source completion and the native no-pack fallback remain distinct. Native command revision 19 rejects older cry semantics before link-battle setup; party codec stays 1. Independent parent serialization changes only revision 18 -> 19: native digest 22e453523676534e, legacy e33d251961f2a41d unchanged.

Stack and review

Depends on #278 and the preceding portability series. Feature-only comparison. The main-based diff includes prerequisites until they merge. The contract document and source-bound QA receipt include reproduction commands and retained failure evidence. The playable fork testing branch is updated to d9321835ad2ca50ee40028c59f3b36f2a0d34b9b; qualified source/test trees are preserved.

Validation

  • Combined runtime 0286d291: 285/285 engine suites, SDK 3/3, B30 and all quick tiers pass.
  • Feature 1322ee81: 167/176 engine suites versus fresh Honor native GBA world-script sound waits and audio-clock completion #278 166/175. Exact anchored FAIL-line Counters match: the same 25 lines / nine inherited suites, with no additions or removals. SDK 3/3 and B30 pass on both.
  • Each runtime: 240 qualified workers / 176,170 complete paired observations against unchanged Gen1 code, including 554 new cry rows. Every admitted mode/backend/profile is present exactly once; complete nested fields, events, RNG, PP, animation data, PCM samples and JSON boolean types are retained and independently compared.
  • One original feature nature_power FireRed worker was terminated at its recorded 60-second deadline with no observations. The original failed report is retained. Four fresh workers with a bounded 180-second budget all pass (9.6–19.2 seconds); every previously completed observation is unchanged. The checker gives this exhaustive mode the same bounded budget.
  • Native cry engine suite: 10,983 checks, actual Game/FixedStep/StateStack at 1x/2x/10x, field locks, public command hooks, script-ended events, isolated playback, cache/source ownership, missing devices, device recovery and the real structural importer over owned bytes. Protocol 175, SE-player lifecycle 110, existing world-SE waits 6,306 checks pass.
  • Each runtime on existing local FireRed/Emerald audio and owned ROMs: 18 actual cry-script cases, all 221 frames per case and every PCM sample equal; a separate 48 actual PCM outputs also match completely. Imported M4A bytes equal their ROM slices. All 135 runtime Hoenn cry IDs equal both original ROM control tables.
  • Actual running music sources preserve native cry attenuation/restoration across modes, release, stop, overlap and option changes. This validates attenuation relative to each backend's retained baseline gain, not whole-music waveform equivalence.
  • Existing import regressions: 10 native sound cases and 24 Mirror Move scenarios / 48 actual public-submitted turns / 120 move-used events per runtime, complete observations equal between candidates.
  • Negative control removes only the real Game cry-clock call: six exact expected failures (10,977/10,983). The unchanged parent also retains the separately reproduced immediate-cry/no-op-wait gap. Failed and superseded raw logs remain preserved.

The reference stays read-only at 535a5ec088c1ae1bf4d91dd3e35a56f64cf46d91; no reference function is patched. CPU hardware doubles run the real engines, controllers, VMs and renderers without starting a game/GPU/audio device or writing normal saves/imports. No ROM, imported audio image or private pack is committed. Results cover the admitted FireRed/Emerald contracts, not every public audio-event timing, unsupported profile, whole mod or playthrough. Native BGM commands remain follow-up work: actual fadeoutbgm 4 still stops immediately on the host instead of following the native 64-frame fade.

All validation above is local. All ten PR workflows currently report action_required and await upstream approval. The dedicated contract workflow has zero executed jobs; this does not establish hosted validation.

Contributions by Roxas2712 are offered under the fork contribution terms and provenance notice; existing upstream and third-party terms remain applicable.

Native silent-fallback follow-up: no-pack and failed-render playback clear the current physical source while retaining the existing64-frame native wait. An earlier stopped device can no longer complete that new wait immediately. Isolated playback and older overlapping voices retain their owners. The new ROM-free regression records30 failures before the fix and passes165 checks afterward across all five GBA editions. Exact offered source 937467f1 passes those165 checks plus10983 existing native PCM/script/audio-clock/field/isolated-playback checks; evidence 5ec898c5ca. A dedicated CI job runs both groups. No private mod, player save or additional audio clock is changed.

Covered original contributions by Roxas2712 are offered under LICENSE-ROXAS2712.md, including the specific permission for Cedric / UNDERdecoded with credit. Existing source notices and earlier permissions remain applicable.

# Conflicts:
#	src/mods/Loader.lua
# Conflicts:
#	docs/modding.md
#	src/mods/Loader.lua
#	src/world/WorldAPI.lua
@Roxas2712 Roxas2712 closed this Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant