diff --git a/Core/HLE/scePsmf.cpp b/Core/HLE/scePsmf.cpp index 94d623823..6a45a07f4 100644 --- a/Core/HLE/scePsmf.cpp +++ b/Core/HLE/scePsmf.cpp @@ -1213,11 +1213,32 @@ int scePsmfPlayerStart(u32 psmfPlayer, u32 psmfPlayerData, int initPts) return ERROR_PSMFPLAYER_INVALID_PARAM; } + if (psmfplayer->totalAudioStreams > 0) { + if (playerData->audioCodec != 0x0F && playerData->audioCodec != 0x01) { + ERROR_LOG_REPORT(ME, "scePsmfPlayerStart(%08x, %08x, %d): invalid audio codec %02x", psmfPlayer, psmfPlayerData, initPts, playerData->audioCodec); + return ERROR_PSMFPLAYER_INVALID_STREAM; + } + if (playerData->audioStreamNum >= psmfplayer->totalAudioStreams) { + ERROR_LOG_REPORT(ME, "scePsmfPlayerStart(%08x, %08x, %d): unable to change audio stream to %d", psmfPlayer, psmfPlayerData, initPts, playerData->audioStreamNum); + return ERROR_PSMFPLAYER_INVALID_CONFIG; + } + } + if (playerData->videoCodec != 0x0E && playerData->videoCodec != 0x00) { + ERROR_LOG_REPORT(ME, "scePsmfPlayerStart(%08x, %08x, %d): invalid video codec %02x", psmfPlayer, psmfPlayerData, initPts, playerData->videoCodec); + return ERROR_PSMFPLAYER_INVALID_STREAM; + } + if (playerData->videoStreamNum < 0 || playerData->videoStreamNum >= psmfplayer->totalVideoStreams) { + ERROR_LOG_REPORT(ME, "scePsmfPlayerStart(%08x, %08x, %d): unable to change video stream to %d", psmfPlayer, psmfPlayerData, initPts, playerData->videoStreamNum); + return ERROR_PSMFPLAYER_INVALID_CONFIG; + } + WARN_LOG(ME, "scePsmfPlayerStart(%08x, %08x, %d)", psmfPlayer, psmfPlayerData, initPts); + psmfplayer->mediaengine->setVideoStream(playerData->videoStreamNum); psmfplayer->videoCodec = playerData->videoCodec; psmfplayer->videoStreamNum = playerData->videoStreamNum; if (!psmfplayer->mediaengine->IsNoAudioData()) { + psmfplayer->mediaengine->setAudioStream(playerData->audioStreamNum); psmfplayer->audioCodec = playerData->audioCodec; psmfplayer->audioStreamNum = playerData->audioStreamNum; }