diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index 2593f3d28a..fb3ad8867a 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -1646,13 +1646,20 @@ static u32 sceMpegChangeGetAuMode(u32 mpeg, int streamUid, int mode) MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { WARN_LOG(ME, "sceMpegChangeGetAuMode(%08x, %i, %i): bad mpeg handle", mpeg, streamUid, mode); - return -1; + return ERROR_MPEG_INVALID_VALUE; + } + if (mode != MPEG_AU_MODE_DECODE && mode != MPEG_AU_MODE_SKIP) { + ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): bad mode", mpeg, streamUid, mode); + return ERROR_MPEG_INVALID_VALUE; } - // NOTE: Where is the info supposed to come from? - StreamInfo info = {0}; - info.sid = streamUid; - if (info.sid) { + auto stream = ctx->streamMap.find(streamUid); + if (stream == ctx->streamMap.end()) { + ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): unknown streamID", mpeg, streamUid, mode); + return ERROR_MPEG_INVALID_VALUE; + } else { + StreamInfo &info = stream->second; + DEBUG_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): changing type=%d", mpeg, streamUid, mode, info.type); switch (info.type) { case MPEG_AVC_STREAM: if (mode == MPEG_AU_MODE_DECODE) { @@ -1677,11 +1684,9 @@ static u32 sceMpegChangeGetAuMode(u32 mpeg, int streamUid, int mode) } break; default: - ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i): unknown streamID", mpeg, streamUid); + ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): unknown streamID", mpeg, streamUid, mode); break; } - } else { - ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i): unknown streamID", mpeg, streamUid); } return 0; }