From fcbed7483d709ec0c36f6a2cb7559344a38afd3e Mon Sep 17 00:00:00 2001 From: Pierre Bourdon Date: Sun, 9 Aug 2015 19:02:11 +0200 Subject: [PATCH] ZeldaHLE: Properly read remaining AFC samples when a whole frame is available. --- Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp index dcefb6bfdf..122713d592 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp @@ -1544,8 +1544,9 @@ void ZeldaAudioRenderer::DownloadAFCSamplesFromARAM( // Try to push currently cached/already decoded samples. u16 remaining_to_output = std::min(vpb->afc_remaining_decoded_samples, requested_samples_count); - for (size_t i = 0x10 - remaining_to_output; i < 0x10; ++i) - *dst++ = vpb->afc_remaining_samples[i]; + s16* base = &vpb->afc_remaining_samples[0x10 - vpb->afc_remaining_decoded_samples]; + for (size_t i = 0; i < remaining_to_output; ++i) + *dst++ = base[i]; vpb->afc_remaining_decoded_samples -= remaining_to_output; requested_samples_count -= remaining_to_output;