From 51290fd48221eed8a6a6a113c494045c1c0c4f56 Mon Sep 17 00:00:00 2001 From: skidau Date: Tue, 26 Mar 2013 08:31:20 +1100 Subject: [PATCH] Adjusted the audio loop criteria, using >= on the Wii and == on GC. This fixes the audio static that occurred in Wii games after hours of play. Fixes issue 5938. Fixes issue 6067. --- Source/Core/Core/Src/DSP/DSPAccelerator.cpp | 8 ++++++-- Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h | 7 ++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Src/DSP/DSPAccelerator.cpp b/Source/Core/Core/Src/DSP/DSPAccelerator.cpp index dcb79b7ac5..4e16b386b3 100644 --- a/Source/Core/Core/Src/DSP/DSPAccelerator.cpp +++ b/Source/Core/Core/Src/DSP/DSPAccelerator.cpp @@ -21,6 +21,8 @@ #include "DSPHost.h" #include "DSPHWInterface.h" #include "DSPInterpreter.h" +#include "CoreTiming.h" +#include "Core.h" // The hardware adpcm decoder :) static s16 ADPCM_Step(u32& _rSamplePos) @@ -168,9 +170,11 @@ u16 dsp_read_accelerator() if (Address >= EndAddress) { // Set address back to start address. - if ((Address & ~0x1f) == (EndAddress & ~0x1f)) + if (Core::g_CoreStartupParameter.bWii || Address == EndAddress) + { Address = (g_dsp.ifx_regs[DSP_ACSAH] << 16) | g_dsp.ifx_regs[DSP_ACSAL]; - DSPCore_SetException(EXP_ACCOV); + DSPCore_SetException(EXP_ACCOV); + } } 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 349dc7e03b..76c67d0952 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 @@ -29,6 +29,8 @@ #include "Common.h" #include "UCode_AX_Structs.h" #include "../../DSP.h" +#include "CoreTiming.h" +#include "Core.h" #ifdef AX_GC # define PB_TYPE AXPB @@ -205,9 +207,8 @@ u16 AcceleratorGetSample() // UCode. We simulate what this interrupt does here. if (*acc_cur_addr >= acc_end_addr) { - // If we are really at the end (and we don't simply have cur_addr > - // end_addr all the time), loop back to loop_addr. - if ((*acc_cur_addr & ~0x1F) == (acc_end_addr & ~0x1F)) + // loop back to loop_addr. + if (Core::g_CoreStartupParameter.bWii || *acc_cur_addr == acc_end_addr) *acc_cur_addr = acc_loop_addr; if (acc_pb->audio_addr.looping)