mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Attempt scePsmfPlayerSelectSpecific*().
These functions seem buggy on a real PSP... and they return a weird variety of error codes.
This commit is contained in:
parent
891764d8ee
commit
9b4f8b1a99
1 changed files with 49 additions and 16 deletions
|
@ -1598,40 +1598,73 @@ u32 scePsmfPlayerSelectSpecificVideo(u32 psmfPlayer, int videoCodec, int videoSt
|
|||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
ERROR_LOG(ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): invalid psmf player", psmfPlayer, videoCodec, videoStreamNum);
|
||||
return ERROR_PSMF_NOT_FOUND;
|
||||
}
|
||||
|
||||
bool isInitialized = isInitializedStatus(psmfplayer->status);
|
||||
if (!isInitialized) {
|
||||
ERROR_LOG(ME, "scePsmfPlayerSelectSpecificVideo(%08x): not initialized", psmfPlayer);
|
||||
return ERROR_PSMFPLAYER_INVALID_STATUS;
|
||||
}
|
||||
if (psmfplayer->status != PSMF_PLAYER_STATUS_PLAYING) {
|
||||
ERROR_LOG(ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): not playing", psmfPlayer, videoCodec, videoStreamNum);
|
||||
return ERROR_PSMFPLAYER_INVALID_STATUS;
|
||||
}
|
||||
if (psmfplayer->totalVideoStreams < 2) {
|
||||
ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): unable to change stream", psmfPlayer, videoCodec, videoStreamNum);
|
||||
return ERROR_PSMFPLAYER_INVALID_STREAM;
|
||||
}
|
||||
if (videoStreamNum < 0 || videoStreamNum >= psmfplayer->totalVideoStreams) {
|
||||
ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): bad stream num param", psmfPlayer, videoCodec, videoStreamNum);
|
||||
return ERROR_PSMFPLAYER_INVALID_CONFIG;
|
||||
}
|
||||
if (videoCodec != 0x0E && videoCodec != 0x00) {
|
||||
ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): invalid codec", psmfPlayer, videoCodec, videoStreamNum);
|
||||
return ERROR_PSMFPLAYER_INVALID_STREAM;
|
||||
}
|
||||
if (psmfplayer->totalVideoStreams < 2 || !psmfplayer->mediaengine->setVideoStream(videoStreamNum)) {
|
||||
ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): unable to change stream", psmfPlayer, videoCodec, videoStreamNum);
|
||||
return ERROR_PSMFPLAYER_INVALID_STREAM;
|
||||
}
|
||||
|
||||
ERROR_LOG(ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i)", psmfPlayer, videoCodec, videoStreamNum);
|
||||
WARN_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i)", psmfPlayer, videoCodec, videoStreamNum);
|
||||
if (psmfplayer->videoStreamNum != videoStreamNum) {
|
||||
hleDelayResult(0, "psmf select video", 100);
|
||||
}
|
||||
psmfplayer->videoCodec = videoCodec;
|
||||
psmfplayer->videoStreamNum = videoStreamNum;
|
||||
psmfplayer->mediaengine->setVideoStream(videoStreamNum);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// WARNING: This function appears to be buggy in most libraries.
|
||||
u32 scePsmfPlayerSelectSpecificAudio(u32 psmfPlayer, int audioCodec, int audioStreamNum)
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
ERROR_LOG(ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): invalid psmf player", psmfPlayer, audioCodec, audioStreamNum);
|
||||
return ERROR_PSMF_NOT_FOUND;
|
||||
}
|
||||
|
||||
bool isInitialized = isInitializedStatus(psmfplayer->status);
|
||||
if (!isInitialized) {
|
||||
ERROR_LOG(ME, "scePsmfPlayerSelectSpecificAudio(%08x): not initialized", psmfPlayer);
|
||||
return ERROR_PSMFPLAYER_INVALID_STATUS;
|
||||
}
|
||||
if (psmfplayer->status != PSMF_PLAYER_STATUS_PLAYING) {
|
||||
ERROR_LOG(ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): not playing", psmfPlayer, audioCodec, audioStreamNum);
|
||||
return ERROR_PSMFPLAYER_INVALID_STATUS;
|
||||
}
|
||||
if (psmfplayer->totalAudioStreams < 2) {
|
||||
ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): unable to change stream", psmfPlayer, audioCodec, audioStreamNum);
|
||||
return ERROR_PSMFPLAYER_INVALID_STREAM;
|
||||
}
|
||||
if (audioStreamNum < 0 || audioStreamNum >= psmfplayer->totalAudioStreams) {
|
||||
ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): bad stream num param", psmfPlayer, audioCodec, audioStreamNum);
|
||||
return ERROR_PSMFPLAYER_INVALID_CONFIG;
|
||||
}
|
||||
if (audioCodec != 0x0F && audioCodec != 0x01) {
|
||||
ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): invalid codec", psmfPlayer, audioCodec, audioStreamNum);
|
||||
return ERROR_PSMFPLAYER_INVALID_STREAM;
|
||||
}
|
||||
if (psmfplayer->totalAudioStreams < 2 || !psmfplayer->mediaengine->setAudioStream(audioStreamNum)) {
|
||||
ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): unable to change stream", psmfPlayer, audioCodec, audioStreamNum);
|
||||
return ERROR_PSMFPLAYER_INVALID_STREAM;
|
||||
}
|
||||
|
||||
ERROR_LOG(ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i)", psmfPlayer, audioCodec, audioStreamNum);
|
||||
WARN_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i)", psmfPlayer, audioCodec, audioStreamNum);
|
||||
if (psmfplayer->audioStreamNum != audioStreamNum) {
|
||||
hleDelayResult(0, "psmf select audio", 100);
|
||||
}
|
||||
psmfplayer->audioCodec = audioCodec;
|
||||
psmfplayer->audioStreamNum = audioStreamNum;
|
||||
psmfplayer->mediaengine->setAudioStream(audioStreamNum);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue