ZeldaHLE: Fix the AFC remaining samples logic on looping.

This commit is contained in:
Pierre Bourdon 2015-08-14 11:32:24 +02:00
parent 9105a76eb1
commit 18d0f15885
1 changed files with 13 additions and 2 deletions

View File

@ -1579,9 +1579,20 @@ void ZeldaAudioRenderer::DownloadAFCSamplesFromARAM(
DecodeAFC(vpb, dst, requested_blocks_count); DecodeAFC(vpb, dst, requested_blocks_count);
if (vpb->afc_remaining_decoded_samples)
{
for (size_t i = 0; i < 0x10; ++i) for (size_t i = 0; i < 0x10; ++i)
vpb->afc_remaining_samples[i] = dst[decoded_samples_count - 0x10 + i]; vpb->afc_remaining_samples[i] = dst[decoded_samples_count - 0x10 + i];
if (!vpb->GetRemainingLength() && vpb->GetLoopStartPosition())
{
// Adjust remaining samples to account for the future loop iteration.
base = vpb->afc_remaining_samples + ((vpb->GetLoopStartPosition() + 0xF) & 0xF);
for (size_t i = 0; i < vpb->afc_remaining_decoded_samples; ++i)
vpb->afc_remaining_samples[0x10 - i - 1] = *base--;
}
}
return; return;
} }
else else