dolphin/Source/Core
smurf3tte c2da12ca75 DSP: Fix write masks on AUDIO_*/AR_* MMIO registers
https://bugs.dolphin-emu.org/issues/6749

This change fixes the scratchy audio in Teenage Mutant Ninja Turtles (SX7E52/SX7P52). The game starts an audio interface DMA with an unaligned address, and because Dolphin was not masking off the low 5 bits of AUDIO_DMA_START_LO, all future AI DMAs were misaligned. To understand why, it is instructive to refer to AUDIO_InitDMA() in libogc, which behaves the same as the official SDK:

_dspReg[25] = (_dspReg[25]&~0xffe0)|(startaddr&0xffff);

The implementation does not mask off the low bits of the passed in value before it ORs them with low bits of the current register value. Therefore, if they are not masked off by the hardware itself, they become permanently stuck once set.

Adding a write mask for AUDIO_DMA_START_LO is enough to fix the bug in TMNT, but I decided to run some tests on GC and Wii to find the correct write masks for the surrounding registers, as only a couple were already being masked. Dolphin has gotten away with not masking the rest because many are already A) masked on read (or never read) by the SDK and/or B) masked on use (or never used) in Dolphin.

This leaves just three registers where the difference may be observable: AR_DMA_CNT_H and AUDIO_DMA_START_HI/LO.
2020-12-30 01:34:48 -08:00
..
AudioCommon AudioCommon: Convert alerts over to fmt-based variants 2020-11-27 10:10:11 -05:00
Common MemoryUtil: Use HW_PHYSMEM64 sysctl in MemPhysical 2020-12-20 22:25:36 +00:00
Core DSP: Fix write masks on AUDIO_*/AR_* MMIO registers 2020-12-30 01:34:48 -08:00
DiscIO DiscIO: Fix recursive directory extraction 2020-12-03 21:13:53 +01:00
DolphinNoGUI Clean up screen saver inhibition and apply setting change immediately. 2020-10-18 16:31:48 -05:00
DolphinQt DolphinQt: Fix all instances of <gameid> in AdvancedWidget to use the appropriate html code instead 2020-12-18 22:50:06 -06:00
InputCommon InputCommon: Fix callback dispatch deadlock 2020-12-13 00:30:27 +00:00
MacUpdater Reformat repo to clang-format 7.0 rules 2019-05-06 18:48:04 +00:00
UICommon Turn Config::Info into a class with getters 2020-12-11 19:54:16 +01:00
UpdaterCommon Fix updater not always cleaning up temp directory 2020-11-13 12:25:53 -08:00
VideoBackends Core: Remove ImageWrite and get rid of -Wmissing-declarations warnings 2020-12-16 16:04:19 +01:00
VideoCommon Core: Remove ImageWrite and get rid of -Wmissing-declarations warnings 2020-12-16 16:04:19 +01:00
WinUpdater DolphinQt: Handle non-ASCII characters in Windows cmd arguments 2020-09-21 17:26:29 +02:00
CMakeLists.txt WinUpdater: Add CMakeLists.txt 2019-05-08 23:59:04 +02:00