From de83d1cda4ffe8e3651848caa6d715448f4836c2 Mon Sep 17 00:00:00 2001 From: "XTra.KrazzY" Date: Wed, 1 Jul 2009 19:58:10 +0000 Subject: [PATCH] Zelda UCode: Found volume and sound type(streaming, sfx) in PBs. Tried to implement volume but the floating point games got on my nerves. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3634 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h | 8 ++++++-- .../Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Voice.cpp | 9 +++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h index d178c30aa3..2f053077c2 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda.h @@ -36,8 +36,12 @@ struct ZeldaVoicePB u16 NeedsReset; // 0x04 | indicates if some values in PB need to be reset u16 ReachedEnd; // 0x05 | set to 1 when end reached u16 IsBlank; // 0x06 | 0 = normal sound, 1 = samples are always the same - u16 Unk07; // 0x07 | unknown - u16 Unk08[0x10]; // 0x08 | unknown // Buffer / something, see 036e/ZWW. there's a pattern here + u16 Unk07; // 0x07 | unknown, in zelda always 0x0010 + u16 SoundType; // 0x08 | Sound type: so far in zww: 0x0d00 for music, 0x4861 for sfx + u32 volumeRight; // 0x09 | Right Volume + u16 Unk0B[2]; // 0x0B | unknown + u32 volumeLeft; // 0x0D | Left Volume + u16 Unk0F[0x8]; // 0x0F | unknown // Buffer / something, see 036e/ZWW. there's a pattern here u16 Unk18[0x10]; // 0x18 | unknown u16 Unk28; // 0x28 | unknown u16 Unk29; // 0x29 | unknown // multiplied by 0x2a @ 0d21/ZWW diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Voice.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Voice.cpp index bce5f0e3f2..04e9621917 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Voice.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Voice.cpp @@ -303,6 +303,11 @@ void CUCode_Zelda::MixAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _RightBu case 0x0005: // AFC with extra low bitrate (32:5 compression). Not yet seen. WARN_LOG(DSPHLE, "5 byte AFC - does it work?"); case 0x0009: // AFC with normal bitrate (32:9 compression). + + // Use this to disable music (GREAT for testing) + //if(PB.SoundType == 0x0d00) + // break; + MixAddVoice_AFC(PB, m_TempBuffer, _Size); break; @@ -334,10 +339,10 @@ void CUCode_Zelda::MixAddVoice(ZeldaVoicePB &PB, s32* _LeftBuffer, s32* _RightBu if (left < -32768) left = -32768; if (left > 32767) left = 32767; - _LeftBuffer[i] = left; + _LeftBuffer[i] = left; //(s32)(((float)left * (float)PB.volumeLeft) / 1000.f); if (right < -32768) right = -32768; if (right > 32767) right = 32767; - _RightBuffer[i] = right; + _RightBuffer[i] = right; //(s32)(((float)right * (float)PB.volumeRight) / 1000.0f); } }