AuCtx: Accept a savestate with an MP3 handle reserved without parameters

sceMp3ReserveMp3Handle(0) gives a context with no buffers, which the PCM
buffer size check added to AuCtx::DoState rejected, failing the load partway
through.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-21 07:52:21 +02:00
1 parent deb9693f6a
commit 7f70918def
1 file changed
+4 -2
+4 -2
View File
@@ -696,9 +696,11 @@ void AuCtx::DoState(PointerWrap &p) {
Do(p, dummy);
Do(p, FrameNum);
// The decoder writes a whole frame into each half. The game side requires at least this much.
// The decoder writes a whole frame into each half. The game side requires at least this much,
// except for an MP3 handle reserved without parameters, which has no buffers at all.
const u32 minPCMBufSize = audioType == PSP_CODEC_AAC ? 8192 : 9216;
if (p.mode == p.MODE_READ && PCMBufSize < minPCMBufSize) {
const bool noBuffers = PCMBuf == 0 && PCMBufSize == 0;
if (p.mode == p.MODE_READ && PCMBufSize < minPCMBufSize && !noBuffers) {
ERROR_LOG(Log::SaveState, "AuCtx: PCM buffer of %d bytes in savestate is too small", PCMBufSize);
p.SetError(p.ERROR_FAILURE);
return;