From c6c0f69c6b43d7956640289c19833a15b057333e Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sun, 9 Aug 2015 01:27:20 +0200 Subject: [PATCH] ZeldaHLE: really fix the constant pattern variable step computation. This time tested by comparing pattern indexes across LLE and HLE with the same inputs. Matches on the 3-4 test cases I made. --- Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp index ea0e2b97af..69f75bbcb5 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp @@ -1341,21 +1341,22 @@ void ZeldaAudioRenderer::LoadInputSamples(MixingBuffer* buffer, VPB* vpb) s16* pattern = m_const_patterns.data() + pattern_offset; u32 pos = vpb->current_pos_frac << 6; // log2(PATTERN_SIZE) + u32 step = vpb->resampling_ratio << 5; for (size_t i = 0; i < buffer->size(); ++i) { - u32 step = vpb->resampling_ratio << 5; - if (pattern_info.variable_step) - step += (u32)((u16)m_buf_back_right[i] * vpb->resampling_ratio) >> 26; - (*buffer)[i] = pattern[pos >> 16]; pos = (pos + step) % (PATTERN_SIZE << 16); + if (pattern_info.variable_step) + pos = ((pos << 10) + m_buf_back_right[i] * vpb->resampling_ratio) >> 10; } vpb->current_pos_frac = pos >> 6; break; } + + case VPB::SRC_PCM8_FROM_ARAM: DownloadPCMSamplesFromARAM(raw_input_samples.data() + 4, vpb, NeededRawSamplesCount(*vpb));