From 263fc19d6f72482c90ac56107ff4621d1b943846 Mon Sep 17 00:00:00 2001 From: chiizufish Date: Mon, 2 May 2011 15:23:27 +0000 Subject: [PATCH] fixes AFC type 5 decoding (At least for Super Mario Sunshine, from whose ucode it was derived - hopefully this won't break other games.) Fixes Issue 4437. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7504 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_ADPCM.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_ADPCM.cpp b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_ADPCM.cpp index 280aca4be2..ab808003c1 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_ADPCM.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_Zelda_ADPCM.cpp @@ -47,10 +47,10 @@ void CUCode_Zelda::AFCdecodebuffer(const s16 *coef, const char *src, signed shor // In Super Mario Sunshine, you can get such a sound by talking to/jumping on anyone for (int i = 0; i < 16; i += 4) { - nibbles[i + 0] = (*src >> 6) & 0x02; - nibbles[i + 1] = (*src >> 4) & 0x02; - nibbles[i + 2] = (*src >> 2) & 0x02; - nibbles[i + 3] = (*src >> 0) & 0x02; + nibbles[i + 0] = (*src >> 6) & 0x03; + nibbles[i + 1] = (*src >> 4) & 0x03; + nibbles[i + 2] = (*src >> 2) & 0x03; + nibbles[i + 3] = (*src >> 0) & 0x03; src++; } @@ -67,10 +67,7 @@ void CUCode_Zelda::AFCdecodebuffer(const s16 *coef, const char *src, signed shor for (int i = 0; i < 16; i++) { int sample = delta * nibbles[i] + ((int)hist * coef[idx * 2]) + ((int)hist2 * coef[idx * 2 + 1]); - if (type == 9) - sample >>= 11; - else - sample >>= 13; + sample >>= 11; if (sample > 32767) sample = 32767; if (sample < -32768)