Skip to content

pokered-deaf: disable audio engine, preserve sound trigger IDs#1

Open
1hedu wants to merge 5 commits into
masterfrom
claude/pokered-deaf-audio-removal-FX1TC
Open

pokered-deaf: disable audio engine, preserve sound trigger IDs#1
1hedu wants to merge 5 commits into
masterfrom
claude/pokered-deaf-audio-removal-FX1TC

Conversation

@1hedu

@1hedu 1hedu commented Mar 25, 2026

Copy link
Copy Markdown
Owner

Summary

Baseline for MegaGB (SuperGameboy-on-Genesis via link cable). Removes the audio engine processing to free CPU cycles and WRAM, while preserving all sound trigger infrastructure so the GB can still determine which music/SFX to play — the IDs land in wNewSoundID / wLastMusicSoundID where MegaGB link code can forward them to the Genesis for playback.

What's removed (cycle/RAM savings)

  • VBlank audio tickAudio1/2/3_UpdateMusic, Music_DoLowHealthAlarm, FadeOutAudio calls removed (~5-10% frame time)
  • Audio engine bankswitch in PlaySound — no more ROM bank juggling to call Audio1/2/3_PlaySound
  • UpdateMusic6Times — stubbed (no engine to tick)
  • WaitForSoundToFinish — returns immediately (would infinite-loop without engine clearing channel IDs)
  • APU hardware — disabled via rNR52 = $00 in Init

What's preserved (MegaGB trigger points)

  • PlayDefaultMusic / PlayDefaultMusicFadeOutCurrent — full map/bike/surf music selection logic intact
  • PlayMusic — writes sound ID + bank to WRAM, falls through to PlaySound
  • PlaySound — writes the sound ID to wNewSoundID (readable by MegaGB link code)
  • PlayBattleMusic — battle music selection (wild/trainer/gym leader/final) intact
  • StopAllSounds — writes SFX_STOP_ALL_MUSIC to wNewSoundID
  • All call sites — every call PlaySound, call PlayCry, call PlayMusic throughout the codebase is untouched

Files changed

File Change
home/audio.asm PlaySound preserves ID in WRAM, skips engine. UpdateMusic6Times stubbed. Selection logic kept.
home/fade_audio.asm FadeOutAudio stubbed
home/delay.asm WaitForSoundToFinish returns immediately
home/vblank.asm Audio engine tick block removed
home/init.asm APU disabled, StopAllSounds writes stop ID and returns

Freed resources

  • CPU: ~5-10% of frame time (more during cries/complex music)
  • WRAM: ~240 bytes of Audio RAM section now zeroed and available
  • ROM banks: Audio data (banks 2, 8, 1F) still compiled but never called — can be reclaimed later

Test plan

  • make clean && make builds successfully (pokered.gbc + pokeblue.gbc)
  • Boot in emulator — verify silent operation, no crashes
  • Walk between maps — verify no hangs (music selection logic still runs, just no playback)
  • Trigger wild encounter — verify wNewSoundID updates with battle music ID
  • Open Pokédex entry — verify cry trigger writes ID without freezing

https://claude.ai/code/session_01CjEMsJS9aiLy2ZUdpdkwiA

claude added 3 commits March 25, 2026 03:55
Stub all audio entry points (PlayMusic, PlaySound, PlayDefaultMusic,
FadeOutAudio, StopAllSounds, WaitForSoundToFinish) so they return
immediately. Remove the VBlank audio update block to reclaim ~5-10%
of frame time. Disable the APU via rNR52 in Init for total silence.

Audio data (audio.asm) and WRAM labels are kept intact to avoid
linker errors - they serve as a stable baseline for future mods.

https://claude.ai/code/session_01CjEMsJS9aiLy2ZUdpdkwiA
Remove audio engine processing (UpdateMusic, PlaySound engine calls,
FadeOutAudio) while keeping all music/SFX selection logic intact.
Sound IDs still flow into wNewSoundID and wLastMusicSoundID so
MegaGB link code can read them and forward triggers to the Genesis.

- home/audio.asm: PlaySound writes ID to wNewSoundID, skips engine
  bankswitch. PlayDefaultMusic/PlayMusic selection logic preserved.
  UpdateMusic6Times stubbed (no engine to tick).
- home/vblank.asm: Audio engine tick block removed (~5-10% frame time)
- home/fade_audio.asm: FadeOutAudio stubbed (no APU to fade)
- home/delay.asm: WaitForSoundToFinish returns immediately (would
  infinite-loop with no engine clearing channel IDs)
- home/init.asm: APU disabled via rNR52, StopAllSounds writes
  SFX_STOP_ALL_MUSIC to wNewSoundID then returns

https://claude.ai/code/session_01CjEMsJS9aiLy2ZUdpdkwiA
@1hedu 1hedu changed the title pokered-deaf: strip all audio engine entry points pokered-deaf: disable audio engine, preserve sound trigger IDs Mar 25, 2026
claude added 2 commits March 25, 2026 04:08
Tested both vanilla and deaf builds side-by-side in SameBoy.
Intro, Oak, and name selection all render identically.
Game progresses normally with silent audio.

https://claude.ai/code/session_01CjEMsJS9aiLy2ZUdpdkwiA
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.

2 participants