sceVaudioChReserve: accept the MP3 frame sizes

The channel took only 256, 1024 and 2048 samples, so a game that hands it MP3
frames got SCE_KERNEL_ERROR_INVALID_SIZE and no music. Dead or Alive Paradise
does exactly that from its music player: sceVaudioChReserve(1152, 44100, 2),
1152 being the MPEG-1 Layer III frame size.

The format check moves below the sample count check to match: the module
returns 0x80000104 for a bad count before it ever looks at the format, so a
call with both wrong got the wrong error out of us. The two error codes we
already returned are the ones it uses.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5 committed 2026-09-08 15:52:10 -06:00
1 parent 4d795f5130
commit ed9078b055
1 file changed
+9 -6
+9 -6
View File
@@ -42,16 +42,19 @@ void __VaudioDoState(PointerWrap &p) {
}
static u32 sceVaudioChReserve(int sampleCount, int freq, int format) {
// The vaudio channel is pickier than the normal ones: only three sample counts, stereo only,
// and the same set of sample rates the SRC channel takes.
// The vaudio channel is pickier than the normal ones: a fixed set of sample counts, stereo
// only, and the same set of sample rates the SRC channel takes. It tests
// 256/576/1024/1152 and then 2048, returning 0x80000104, before it looks at the format at all.
// 576 and 1152 are the MPEG-2/2.5 and MPEG-1 Layer III frame sizes, so leaving them out broke
// games that feed MP3 frames straight to the vaudio channel.
if (sampleCount != 256 && sampleCount != 576 && sampleCount != 1024 && sampleCount != 1152 && sampleCount != 2048) {
ERROR_LOG(Log::sceAudio, "sceVaudioChReserve(%i, %i, %i) - invalid sample count", sampleCount, freq, format);
return SCE_KERNEL_ERROR_INVALID_SIZE;
}
if (format != 2) {
ERROR_LOG(Log::sceAudio, "sceVaudioChReserve(%i, %i, %i) - unexpected format", sampleCount, freq, format);
return SCE_KERNEL_ERROR_INVALID_FORMAT;
}
if (sampleCount != 256 && sampleCount != 1024 && sampleCount != 2048) {
ERROR_LOG(Log::sceAudio, "sceVaudioChReserve(%i, %i, %i) - invalid sample count", sampleCount, freq, format);
return SCE_KERNEL_ERROR_INVALID_SIZE;
}
if (freq != 0 && !SRCFrequencyAllowed(freq)) {
ERROR_LOG(Log::sceAudio, "sceVaudioChReserve(%i, %i, %i) - invalid frequency", sampleCount, freq, format);
return SCE_ERROR_AUDIO_INVALID_FREQUENCY;