From 3d7a2b92d44e4478d32aa528af00caaeb141d787 Mon Sep 17 00:00:00 2001 From: Marko Pusljar Date: Thu, 5 May 2011 11:06:04 +0000 Subject: [PATCH] UpdateAudioDMA() fix/revert -> fixes Rayman 3/Smugglers Run with LLE, + small optimization for lleint/llejit32 git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7510 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Core/Src/DSP/DSPIntExtOps.cpp | 16 +++++++++++++--- Source/Core/Core/Src/HW/DSP.cpp | 13 +++++-------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Source/Core/Core/Src/DSP/DSPIntExtOps.cpp b/Source/Core/Core/Src/DSP/DSPIntExtOps.cpp index 274332f54d..76032165e1 100644 --- a/Source/Core/Core/Src/DSP/DSPIntExtOps.cpp +++ b/Source/Core/Core/Src/DSP/DSPIntExtOps.cpp @@ -18,6 +18,9 @@ #include "DSPMemoryMap.h" #include "DSPIntExtOps.h" +//not needed for game ucodes (it slows down interpreter/dspjit32 + easier to compare int VS dspjit64 without it) +//#define PRECISE_BACKLOG + // Extended opcodes do not exist on their own. These opcodes can only be // attached to opcodes that allow extending (8 (or 7) lower bits of opcode not used by // opcode). Extended opcodes do not modify program counter $pc register. @@ -518,7 +521,11 @@ void applyWriteBackLog() // always make sure to have an extra entry at the end w/ -1 to avoid // infinitive loops for (int i = 0; writeBackLogIdx[i] != -1; i++) { +#ifdef PRECISE_BACKLOG dsp_op_write_reg(writeBackLogIdx[i], dsp_op_read_reg(writeBackLogIdx[i]) | writeBackLog[i]); +#else + dsp_op_write_reg(writeBackLogIdx[i], writeBackLog[i]); +#endif // Clear back log writeBackLogIdx[i] = -1; } @@ -529,20 +536,22 @@ void applyWriteBackLog() // apply the ext command output, because if the main op didn't change the value // then 0 | ext output = ext output and if it did then bitwise or is still the // right thing to do +// Only needed for cases when when mainop and extended are modifying the same ACC +// Games are not doing that + in motorola (similar dsp) dox this is forbidden to do. void zeroWriteBackLog() { +#ifdef PRECISE_BACKLOG // always make sure to have an extra entry at the end w/ -1 to avoid // infinitive loops for (int i = 0; writeBackLogIdx[i] != -1; i++) { dsp_op_write_reg(writeBackLogIdx[i], 0); } +#endif } -//needed for 0x3... cases when main and extended are modifying the same ACC -//games are not doing that + in motorola (similar dsp) dox this is forbidden to do -//ex. corner case -> 0x3060: main opcode modifies .m, and extended .l -> .l shoudnt be zeroed because of .m write... void zeroWriteBackLogPreserveAcc(u8 acc) { +#ifdef PRECISE_BACKLOG for (int i = 0; writeBackLogIdx[i] != -1; i++) { // acc0 @@ -557,4 +566,5 @@ void zeroWriteBackLogPreserveAcc(u8 acc) dsp_op_write_reg(writeBackLogIdx[i], 0); } +#endif } diff --git a/Source/Core/Core/Src/HW/DSP.cpp b/Source/Core/Core/Src/HW/DSP.cpp index 5de07f89ac..e08e0c798d 100644 --- a/Source/Core/Core/Src/HW/DSP.cpp +++ b/Source/Core/Core/Src/HW/DSP.cpp @@ -649,25 +649,22 @@ void UpdateDSPSlice(int cycles) { // This happens at 4 khz, since 32 bytes at 4khz = 4 bytes at 32 khz (16bit stereo pcm) void UpdateAudioDMA() { - if (g_audioDMA.BlocksLeft) + if (g_audioDMA.AudioDMAControl.Enable && g_audioDMA.BlocksLeft) { // Read audio at g_audioDMA.ReadAddress in RAM and push onto an // external audio fifo in the emulator, to be mixed with the disc // streaming output. If that audio queue fills up, we delay the // emulator. - g_audioDMA.ReadAddress += 32; + g_audioDMA.BlocksLeft--; + g_audioDMA.ReadAddress += 32; if (g_audioDMA.BlocksLeft == 0) { dsp_emulator->DSP_SendAIBuffer(g_audioDMA.SourceAddress, 8*g_audioDMA.AudioDMAControl.NumBlocks); GenerateDSPInterrupt(DSP::INT_AID); - if (g_audioDMA.AudioDMAControl.Enable) - { - g_audioDMA.BlocksLeft = g_audioDMA.AudioDMAControl.NumBlocks; - g_audioDMA.ReadAddress = g_audioDMA.SourceAddress; - } - //DEBUG_LOG(DSPLLE, "ADMA read addresses: %08x", g_audioDMA.ReadAddress); + g_audioDMA.BlocksLeft = g_audioDMA.AudioDMAControl.NumBlocks; + g_audioDMA.ReadAddress = g_audioDMA.SourceAddress; } } else