From fbbd37d707e32aaa3d00bcfd36de6d1cb75d5fce Mon Sep 17 00:00:00 2001 From: raven02 Date: Tue, 15 Apr 2014 15:11:44 +0800 Subject: [PATCH] Delay thread for sceMp3Decode() --- Core/HLE/sceMp3.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Core/HLE/sceMp3.cpp b/Core/HLE/sceMp3.cpp index 25339506c..d9d51d75d 100644 --- a/Core/HLE/sceMp3.cpp +++ b/Core/HLE/sceMp3.cpp @@ -82,7 +82,7 @@ public: static std::map mp3Map_old; static std::map mp3Map; - +static const int mp3DecodeDelay = 4000; AuCtx *getMp3Ctx(u32 mp3) { if (mp3Map.find(mp3) == mp3Map.end()) @@ -145,8 +145,13 @@ int sceMp3Decode(u32 mp3, u32 outPcmPtr) { ERROR_LOG(ME, "%s: bad mp3 handle %08x", __FUNCTION__, mp3); return -1; } - - return ctx->AuDecode(outPcmPtr); + + int pcmBytes = ctx->AuDecode(outPcmPtr); + if (!pcmBytes) { + // decode data successfully, delay thread + hleDelayResult(pcmBytes, "mp3 decode", mp3DecodeDelay); + } + return pcmBytes; } int sceMp3ResetPlayPosition(u32 mp3) {