From 790c570e67374c051b3c80a7b4bf8ac072ffabb4 Mon Sep 17 00:00:00 2001 From: raven02 Date: Sat, 29 Mar 2014 12:16:57 +0800 Subject: [PATCH 1/2] Fix crash and wrong mp3 playback in Downstream Panic ULUS10322 --- Core/HLE/sceMp3.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/HLE/sceMp3.cpp b/Core/HLE/sceMp3.cpp index 983c9fe3aa..334711b301 100644 --- a/Core/HLE/sceMp3.cpp +++ b/Core/HLE/sceMp3.cpp @@ -577,8 +577,8 @@ int sceMp3NotifyAddStreamData(u32 mp3, int size) { ctx->bufferAvailable += size; ctx->bufferWrite += size; - if (ctx->bufferWrite == ctx->mp3BufSize) - ctx->bufferWrite = 0; + if (ctx->bufferWrite >= ctx->mp3BufSize) + ctx->bufferWrite -= ctx->mp3BufSize; if (ctx->readPosition >= ctx->mp3StreamEnd && ctx->mp3LoopNum != 0) { ctx->readPosition = ctx->mp3StreamStart; From 7577481d6e0f1d551100278c905513e2c35cfee6 Mon Sep 17 00:00:00 2001 From: raven02 Date: Sat, 29 Mar 2014 12:37:33 +0800 Subject: [PATCH 2/2] Change it to ctx->bufferWrite %= ctx->mp3BufSize; --- Core/HLE/sceMp3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/HLE/sceMp3.cpp b/Core/HLE/sceMp3.cpp index 334711b301..3d3468ccb9 100644 --- a/Core/HLE/sceMp3.cpp +++ b/Core/HLE/sceMp3.cpp @@ -578,7 +578,7 @@ int sceMp3NotifyAddStreamData(u32 mp3, int size) { ctx->bufferWrite += size; if (ctx->bufferWrite >= ctx->mp3BufSize) - ctx->bufferWrite -= ctx->mp3BufSize; + ctx->bufferWrite %= ctx->mp3BufSize; if (ctx->readPosition >= ctx->mp3StreamEnd && ctx->mp3LoopNum != 0) { ctx->readPosition = ctx->mp3StreamStart;