mirror of
https://github.com/N64Recomp/N64ModernRuntime.git
synced 2026-06-26 18:02:55 +00:00
Audio engine code paths in some games (Pokemon Stadium with the caller-context fragment-vaddr override active) compute wave-bank ROM offsets from corrupted SoundBank fields, causing __amDMA to issue PI DMAs from physical addresses past the cart ROM end. Previously do_rom_read computed `rom.data() + (phys - rom_base)` without checking bounds — any out-of-range physical address read host memory past the ROM buffer, almost always causing an access violation that killed the process. Bounds-check the computed offset and the size against rom.size(). On out-of-range, zero-fill the destination and log the bad DMA. The runner survives, audio gets silence/clicks instead of garbage, and the rate-limited log surfaces the bad addresses for tracing back to the corrupted wave-bank fields. This is a defensive runtime measure, not a stub. The bad DMAs are real bugs upstream (in the recompiled audio code's data flow) — this just keeps the host process alive long enough to diagnose them. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| include/librecomp | ||
| src | ||
| CMakeLists.txt | ||