n64dev / cen64

Cycle-Accurate Nintendo 64 Emulator
BSD 3-Clause "New" or "Revised" License
803 stars 70 forks source link

Audio DMA is immediate (inaccurate) #188

Open clbr opened 3 years ago

clbr commented 3 years ago

Same as the RSP DMA, the audio DMA is also instant. Not how the hw works, this hides bugs.

High chance this applies to all other forms of DMA too.

loganmc10 commented 3 years ago

On mupen64plus, I don't know of any issues from an immediate RSP DMA. However, on the AI, BOSS games (World Driver Championship for instance) did not play audio right when we DMAed everything at the beginning.

Mupen64plus doesn't emulate cpu cycles like cen64, so we got around it by DMAing a portion everytime the game reads AI_LEN_REG

clbr commented 3 years ago

Immediate DMA mainly affects new code; correctly written code with the full buffer prepared in advance won't be affected. It sounds like WRC generates audio just-in-time ahead of the DMA.

Say you're writing new RSP code. Because of the immediate DMA, you miss a required wait somewhere -> the program works on emulators and fails on real hw.