Rounded the loop addresses to the nearest 16bit value in the loop comparison.

Fixes issue 6160.
This commit is contained in:
skidau 2013-03-29 00:43:41 +11:00
parent 53377425d1
commit 9b7db5954f
2 changed files with 7 additions and 9 deletions

View File

@ -21,6 +21,7 @@
#include "DSPHost.h" #include "DSPHost.h"
#include "DSPHWInterface.h" #include "DSPHWInterface.h"
#include "DSPInterpreter.h" #include "DSPInterpreter.h"
#include "CoreTiming.h"
// The hardware adpcm decoder :) // The hardware adpcm decoder :)
static s16 ADPCM_Step(u32& _rSamplePos) 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, // Somehow, YN1 and YN2 must be initialized with their "loop" values,
// so yeah, it seems likely that we should raise an exception to let // so yeah, it seems likely that we should raise an exception to let
// the DSP program do that, at least if DSP_FORMAT == 0x0A. // 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. // 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]; CoreTiming::ForceExceptionCheck(0);
DSPCore_SetException(EXP_ACCOV);
}
} }
g_dsp.ifx_regs[DSP_ACCAH] = Address >> 16; g_dsp.ifx_regs[DSP_ACCAH] = Address >> 16;

View File

@ -205,11 +205,10 @@ u16 AcceleratorGetSample()
// //
// On real hardware, this would raise an interrupt that is handled by the // On real hardware, this would raise an interrupt that is handled by the
// UCode. We simulate what this interrupt does here. // 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. // 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) if (acc_pb->audio_addr.looping)
{ {