From 711a8aa6adf211b766880c21fbb542b3f35fbbe6 Mon Sep 17 00:00:00 2001 From: skidau Date: Tue, 30 Sep 2014 22:11:34 +1000 Subject: [PATCH] Fixed the step_size_bytes in the ADPCM Accelerator loop taking into account the varying number of bytes that ADPCM steps by. --- Source/Core/Core/DSP/DSPAccelerator.cpp | 5 ++++- Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/DSP/DSPAccelerator.cpp b/Source/Core/Core/DSP/DSPAccelerator.cpp index 5e9f1ca52b..7dad45caf6 100644 --- a/Source/Core/Core/DSP/DSPAccelerator.cpp +++ b/Source/Core/Core/DSP/DSPAccelerator.cpp @@ -122,8 +122,11 @@ u16 dsp_read_accelerator() switch (g_dsp.ifx_regs[DSP_FORMAT]) { case 0x00: // ADPCM audio + if ((Address & 15) == 0) + step_size_bytes = 2; + else + step_size_bytes = 1; val = ADPCM_Step(Address); - step_size_bytes = 2; break; case 0x0A: // 16-bit PCM audio val = (DSPHost::ReadHostMemory(Address * 2) << 8) | DSPHost::ReadHostMemory(Address * 2 + 1); diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h b/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h index 070c82170a..d78d87e1a4 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h +++ b/Source/Core/Core/HW/DSPHLE/UCodes/AXVoice.h @@ -163,9 +163,13 @@ u16 AcceleratorGetSample() if ((*acc_cur_addr & 15) == 0) { acc_pb->adpcm.pred_scale = DSP::ReadARAM((*acc_cur_addr & ~15) >> 1); + step_size_bytes = 2; *acc_cur_addr += 2; } - + else + { + step_size_bytes = 1; + } int scale = 1 << (acc_pb->adpcm.pred_scale & 0xF); int coef_idx = (acc_pb->adpcm.pred_scale >> 4) & 0x7; @@ -184,7 +188,6 @@ u16 AcceleratorGetSample() acc_pb->adpcm.yn2 = acc_pb->adpcm.yn1; acc_pb->adpcm.yn1 = val; - step_size_bytes = 2; *acc_cur_addr += 1; ret = val; break;