From c45dfd156f6be4cb2b692f1a70af52d696103ade Mon Sep 17 00:00:00 2001 From: hrydgard Date: Sun, 12 Jul 2009 20:14:21 +0000 Subject: [PATCH] DSPHLE: Fix 1 potential and 2 actual crash bugs affecting 32-bit. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3768 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_DSP_HLE/Src/MailHandler.h | 11 ++++++++++- .../Plugin_DSP_HLE/Src/UCodes/UCode_Zelda_Voice.cpp | 9 +++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/MailHandler.h b/Source/Plugins/Plugin_DSP_HLE/Src/MailHandler.h index 69ffacb862..b7bb13a63b 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/MailHandler.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/MailHandler.h @@ -37,7 +37,16 @@ public: u16 ReadDSPMailboxLow(); void Update(); - u32 GetNextMail() { return m_Mails.front(); } + u32 GetNextMail() + { + if (m_Mails.size()) + return m_Mails.front(); + else + { + WARN_LOG(DSPHLE, "GetNextMail: No mails"); + return 0; // + } + } private: // mail handler 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 944a2111fd..aa933414c2 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 @@ -312,7 +312,7 @@ void CUCode_Zelda::RenderVoice_Raw(ZeldaVoicePB &PB, s16 *_Buffer, int _Size) if (PB.RemLength < _RealSize) { - WARN_LOG(VIDEO, "Raw: END"); + WARN_LOG(DSPHLE, "Raw: END"); // Let's ignore this entire case since it doesn't seem to happen // in Zelda, since Length is set to 0xF0000000 // blah @@ -526,7 +526,7 @@ ContinueWithBlock: AX1L = m_MiscTable[0x200 + AX1L]; AX1H = m_MiscTable[0x200 + AX1H]; - short b00[16]; + short b00[20]; b00[0] = AX1L * AX1H >> 16; b00[1] = AX0L * AX1H >> 16; b00[2] = AX0H * AX1L >> 16; @@ -646,9 +646,10 @@ ContinueWithBlock: // size is in stereo samples. void CUCode_Zelda::MixAdd(short *_Buffer, int _Size) { + // PanicAlert("mixadd"); // Safety check - if (_Size > 256 * 1024) - _Size = 256 * 1024; + if (_Size > 256 * 1024 - 8) + _Size = 256 * 1024 - 8; // Final mix buffers memset(m_LeftBuffer, 0, _Size * sizeof(s32));