From 9c4173fe510b1f70c64a71ca8eeb975c4ea07ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 7 Sep 2026 17:58:41 -0600 Subject: [PATCH] sceAudiocodec: drop a format check CheckNeedMem doesn't actually do avcodec.prx's sceAudiocodecCheckNeedMem validates the codec id and the pointer, sets the magic and forwards to the ME. It never looks at the format bytes, and the caller isn't obliged to have filled them in yet - the real mpeg.prx calls it with both still zero, and our invented check stopped its audio dead with SCE_AVCODEC_ERROR_INVALID_DATA. Now just a warning when they aren't the pair libatrac3plus writes, which is still worth knowing about. Found by running the real mpeg.prx against our sceAudiocodec, which is exactly what that reference is for. Co-Authored-By: Claude Opus 5 (1M context) --- Core/HLE/sceAudiocodec.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Core/HLE/sceAudiocodec.cpp b/Core/HLE/sceAudiocodec.cpp index 49782e5232..60e9ed883d 100644 --- a/Core/HLE/sceAudiocodec.cpp +++ b/Core/HLE/sceAudiocodec.cpp @@ -394,9 +394,13 @@ static int sceAudiocodecCheckNeedMem(u32 ctxPtr, int codec) { switch (codec) { case 0x1000: ctx->neededMem = 0x7bc0; + // avcodec.prx does no format check here at all - it just forwards to the ME - and the + // caller isn't obliged to have filled these in yet. mpeg.prx calls this with both bytes + // still zero, and rejecting that stopped its audio dead. Only worth a note when they + // aren't the pair libatrac3plus writes. if (ctx->fmt.at3.formatByte1 != 0x28 || ctx->fmt.at3.formatByte2 != 0x5c) { - ctx->err = 0x20f; - return hleLogError(Log::ME, SCE_AVCODEC_ERROR_INVALID_DATA, "Bad format values: %02x %02x", ctx->fmt.at3.formatByte1, ctx->fmt.at3.formatByte2); + WARN_LOG(Log::ME, "sceAudiocodecCheckNeedMem: unfamiliar Atrac3+ format bytes %02x %02x", + ctx->fmt.at3.formatByte1, ctx->fmt.at3.formatByte2); } break; case 0x1001: