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) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5 authored and Henrik Rydgård committed 2026-09-12 12:53:13 -06:00
1 parent 00770764a7
commit 9c4173fe51
1 file changed
+6 -2
+6 -2
View File
@@ -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: