Fix BGM fade ownership across scene startup

This commit is contained in:
gamer147
2026-07-28 13:29:49 -04:00
parent f4bf78d7d1
commit a991d5699c
3 changed files with 60 additions and 6 deletions

View File

@@ -2567,8 +2567,14 @@ enabled=`1` and target=`50` percent; SC0000 writes only control masks `0` and `1
The port therefore retains `0x1cf` as script-owned runtime state, applies the native registered default
attenuation when an unsuppressed voice begins, and restores the saved BGM level when that voice completes
or is stopped by message Skip. This introduces no profile record, boot seed, or persistence backend. A
future unified settings backend can replace the registered defaults without changing the opcode/host seam.
or is stopped by message Skip. Godot also gives an explicit `0xc2` fade exclusive ownership of the BGM
envelope: voice start does not duck during that fade, a new fade cancels its predecessor, and starting a
replacement BGM cancels any still-live prior fade before restoring normal gain. The last rule closes a
main-thread scheduling race at the TITLE-to-SC0000 boundary. The VM's blocking fade deadline begins before
the deferred Godot tween is created, so `BGM005` could start during the tween's final frame and then be
overwritten to `-80 dB`; a later voice temporarily wrote the audible 50-percent duck level and restored
the erroneous silent level afterward. This introduces no profile record, boot seed, or persistence backend.
A future unified settings backend can replace the registered defaults without changing the opcode/host seam.
### Scene-entry state snapshot — auto-seeding single-scene runs (2026-07-09)

View File

@@ -118,6 +118,16 @@ while Godot treated them as active-script manifest ids. The packed resolver maps
through the existing channel players. A synchronized TITLE→GAMESTART→TITLE trace records every load/start
with its filename, and manual validation confirms they are audible; BGM remains unaffected.
**TITLE-to-SC0000 BGM fade ownership corrected (2026-07-28).** SC0000's `0xc2@0x7c1` blocks the VM for
the three-second title-music fade, then starts `BGM005` at `0x7fa`. Godot created the actual gain tween
through a deferred main-thread call, however, so its start could lag the already-running virtual deadline
by one frame. On the unlucky schedule, `BGM005` restored unity gain just before that stale title tween
finished and wrote `-80 dB`. Voice ducking exposed the diagnosis: a voice wrote the configured 50-percent
level, making the live BGM audible, then restored the captured silent level. The Godot backend now owns
exactly one explicit BGM fade, cancels it before replacing the track or starting another fade, and suppresses
voice ducking while the fade owns the envelope as native AGE does. The threaded selftest starts a live
fade and proves a replacement BGM cancels it and retains normal gain.
**Pre-title video sequence implemented (2026-07-20).** SYSTEM4 already owns the native sequence; the
port did not lose an executable-side launcher. Its sole op `0x130` call returns an engine initial-root flag
that is one at context construction and cleared only when op `0x9` resets/reloads root script id zero.