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
This commit is contained in:
Marko Pusljar 2011-05-05 11:06:04 +00:00
parent 7144162f0f
commit 3d7a2b92d4
2 changed files with 18 additions and 11 deletions

View File

@ -18,6 +18,9 @@
#include "DSPMemoryMap.h" #include "DSPMemoryMap.h"
#include "DSPIntExtOps.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 // 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 // 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. // 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 // always make sure to have an extra entry at the end w/ -1 to avoid
// infinitive loops // infinitive loops
for (int i = 0; writeBackLogIdx[i] != -1; i++) { 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]); 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 // Clear back log
writeBackLogIdx[i] = -1; writeBackLogIdx[i] = -1;
} }
@ -529,20 +536,22 @@ void applyWriteBackLog()
// apply the ext command output, because if the main op didn't change the value // 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 // then 0 | ext output = ext output and if it did then bitwise or is still the
// right thing to do // 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() void zeroWriteBackLog()
{ {
#ifdef PRECISE_BACKLOG
// always make sure to have an extra entry at the end w/ -1 to avoid // always make sure to have an extra entry at the end w/ -1 to avoid
// infinitive loops // infinitive loops
for (int i = 0; writeBackLogIdx[i] != -1; i++) { for (int i = 0; writeBackLogIdx[i] != -1; i++) {
dsp_op_write_reg(writeBackLogIdx[i], 0); 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) void zeroWriteBackLogPreserveAcc(u8 acc)
{ {
#ifdef PRECISE_BACKLOG
for (int i = 0; writeBackLogIdx[i] != -1; i++) { for (int i = 0; writeBackLogIdx[i] != -1; i++) {
// acc0 // acc0
@ -557,4 +566,5 @@ void zeroWriteBackLogPreserveAcc(u8 acc)
dsp_op_write_reg(writeBackLogIdx[i], 0); dsp_op_write_reg(writeBackLogIdx[i], 0);
} }
#endif
} }

View File

@ -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) // This happens at 4 khz, since 32 bytes at 4khz = 4 bytes at 32 khz (16bit stereo pcm)
void UpdateAudioDMA() 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 // Read audio at g_audioDMA.ReadAddress in RAM and push onto an
// external audio fifo in the emulator, to be mixed with the disc // external audio fifo in the emulator, to be mixed with the disc
// streaming output. If that audio queue fills up, we delay the // streaming output. If that audio queue fills up, we delay the
// emulator. // emulator.
g_audioDMA.ReadAddress += 32;
g_audioDMA.BlocksLeft--; g_audioDMA.BlocksLeft--;
g_audioDMA.ReadAddress += 32;
if (g_audioDMA.BlocksLeft == 0) if (g_audioDMA.BlocksLeft == 0)
{ {
dsp_emulator->DSP_SendAIBuffer(g_audioDMA.SourceAddress, 8*g_audioDMA.AudioDMAControl.NumBlocks); dsp_emulator->DSP_SendAIBuffer(g_audioDMA.SourceAddress, 8*g_audioDMA.AudioDMAControl.NumBlocks);
GenerateDSPInterrupt(DSP::INT_AID); GenerateDSPInterrupt(DSP::INT_AID);
if (g_audioDMA.AudioDMAControl.Enable) g_audioDMA.BlocksLeft = g_audioDMA.AudioDMAControl.NumBlocks;
{ g_audioDMA.ReadAddress = g_audioDMA.SourceAddress;
g_audioDMA.BlocksLeft = g_audioDMA.AudioDMAControl.NumBlocks;
g_audioDMA.ReadAddress = g_audioDMA.SourceAddress;
}
//DEBUG_LOG(DSPLLE, "ADMA read addresses: %08x", g_audioDMA.ReadAddress);
} }
} }
else else