Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rounded the loop addresses to the nearest 16bit value in the loop com…
…parison.

Fixes issue 6160.
  • Loading branch information
skidau committed Mar 28, 2013
1 parent 5337742 commit 9b7db59
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
11 changes: 5 additions & 6 deletions Source/Core/Core/Src/DSP/DSPAccelerator.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h
Expand Up @@ -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)
{
Expand Down

0 comments on commit 9b7db59

Please sign in to comment.