From 9b7db5954f1a586373f726dc96ecebfd24b395f2 Mon Sep 17 00:00:00 2001 From: skidau Date: Fri, 29 Mar 2013 00:43:41 +1100 Subject: [PATCH] Rounded the loop addresses to the nearest 16bit value in the loop comparison. Fixes issue 6160. --- Source/Core/Core/Src/DSP/DSPAccelerator.cpp | 11 +++++------ .../Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h | 5 ++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Source/Core/Core/Src/DSP/DSPAccelerator.cpp b/Source/Core/Core/Src/DSP/DSPAccelerator.cpp index f625f1ddf6..63c5bb7dae 100644 --- a/Source/Core/Core/Src/DSP/DSPAccelerator.cpp +++ b/Source/Core/Core/Src/DSP/DSPAccelerator.cpp @@ -21,6 +21,7 @@ #include "DSPHost.h" #include "DSPHWInterface.h" #include "DSPInterpreter.h" +#include "CoreTiming.h" // The hardware adpcm decoder :) static s16 ADPCM_Step(u32& _rSamplePos) @@ -165,14 +166,12 @@ u16 dsp_read_accelerator() // Somehow, YN1 and YN2 must be initialized with their "loop" values, // so yeah, it seems likely that we should raise an exception to let // the DSP program do that, at least if DSP_FORMAT == 0x0A. - if (Address >= EndAddress) + if ((Address & ~1) == (EndAddress & ~1)) { // Set address back to start address. - if (DSPHost_Wii() || (Address == EndAddress)) - { - Address = (g_dsp.ifx_regs[DSP_ACSAH] << 16) | g_dsp.ifx_regs[DSP_ACSAL]; - DSPCore_SetException(EXP_ACCOV); - } + Address = (g_dsp.ifx_regs[DSP_ACSAH] << 16) | g_dsp.ifx_regs[DSP_ACSAL]; + DSPCore_SetException(EXP_ACCOV); + CoreTiming::ForceExceptionCheck(0); } g_dsp.ifx_regs[DSP_ACCAH] = Address >> 16; diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h index 76c67d0952..1b717afb48 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h @@ -205,11 +205,10 @@ u16 AcceleratorGetSample() // // On real hardware, this would raise an interrupt that is handled by the // UCode. We simulate what this interrupt does here. - if (*acc_cur_addr >= acc_end_addr) + if ((*acc_cur_addr & ~1) == (acc_end_addr & ~1)) { // loop back to loop_addr. - if (Core::g_CoreStartupParameter.bWii || *acc_cur_addr == acc_end_addr) - *acc_cur_addr = acc_loop_addr; + *acc_cur_addr = acc_loop_addr; if (acc_pb->audio_addr.looping) {