Add mpeg error codes to the big enum

This commit is contained in:
Henrik Rydgård committed 2025-03-21 20:44:46 +01:00
1 parent 112bd904b8
commit ea198dd593
5 files changed
+72 -62

No files matched your search

+10
View File
@@ -407,4 +407,14 @@ enum PSPErrorCode : u32 {
SCE_ERROR_ATRAC_IS_FOR_SCESAS = 0x80630040,
SCE_ERROR_ATRAC_AA3_INVALID_DATA = 0x80631003,
SCE_ERROR_ATRAC_AA3_SIZE_TOO_SMALL = 0x80631004,
SCE_MPEG_ERROR_BAD_VERSION = 0x80610002,
SCE_MPEG_ERROR_NO_MEMORY = 0x80610022,
SCE_MPEG_ERROR_INVALID_ADDR = 0x80610103,
SCE_MPEG_ERROR_INVALID_VALUE = 0x806101fe,
SCE_MPEG_ERROR_NO_DATA = 0x80618001,
SCE_MPEG_ERROR_ALREADY_INIT = 0x80618005,
SCE_MPEG_ERROR_NOT_YET_INIT = 0x80618009,
SCE_MPEG_ERROR_AVC_INVALID_VALUE = 0x806201fe,
SCE_MPEG_ERROR_AVC_DECODE_FATAL = 0x80628002,
};
+9
View File
@@ -1427,6 +1427,15 @@ const char *KernelErrorToString(u32 err) {
case SCE_ERROR_ATRAC_AA3_SIZE_TOO_SMALL: return "SCE_ERROR_ATRAC_AA3_SIZE_TOO_SMALL";
case SCE_ERROR_ATRAC_BAD_ALIGNMENT: return "SCE_ERROR_ATRAC_BAD_ALIGNMENT";
case SCE_MPEG_ERROR_BAD_VERSION: return "SCE_MPEG_ERROR_BAD_VERSION";
case SCE_MPEG_ERROR_NO_MEMORY: return "SCE_MPEG_ERROR_NO_MEMORY";
case SCE_MPEG_ERROR_INVALID_ADDR: return "SCE_MPEG_ERROR_INVALID_ADDR";
case SCE_MPEG_ERROR_INVALID_VALUE: return "SCE_MPEG_ERROR_INVALID_VALUE";
case SCE_MPEG_ERROR_NO_DATA: return "SCE_MPEG_ERROR_NO_DATA";
case SCE_MPEG_ERROR_ALREADY_INIT: return "SCE_MPEG_ERROR_ALREADY_INIT";
case SCE_MPEG_ERROR_NOT_YET_INIT: return "SCE_MPEG_ERROR_NOT_YET_INIT";
case SCE_MPEG_ERROR_AVC_INVALID_VALUE: return "SCE_MPEG_ERROR_AVC_INVALID_VALUE";
case SCE_MPEG_ERROR_AVC_DECODE_FATAL: return "SCE_MPEG_ERROR_AVC_DECODE_FATAL";
default:
return nullptr;
}
+32 -31
View File
@@ -27,6 +27,7 @@
#include "Core/HLE/sceKernelThread.h"
#include "Core/HLE/HLE.h"
#include "Core/HLE/FunctionWrappers.h"
#include "Core/HLE/ErrorCodes.h"
#include "Core/HW/MediaEngine.h"
#include "Core/MemMapHelpers.h"
#include "Core/Reporting.h"
@@ -441,7 +442,7 @@ static u32 sceMpegInit() {
if (isMpegInit) {
WARN_LOG(Log::ME, "sceMpegInit(): already initialized");
// TODO: Need to properly hook module load/unload for this to work right.
//return ERROR_MPEG_ALREADY_INIT;
//return SCE_MPEG_ERROR_ALREADY_INIT;
} else {
INFO_LOG(Log::ME, "sceMpegInit(), mpegLibVersion 0x%0x, mpegLibcrc %x", mpegLibVersion, mpegLibCrc);
}
@@ -466,13 +467,13 @@ static u32 sceMpegRingbufferConstruct(u32 ringbufferAddr, u32 numPackets, u32 da
if ((int)size < 0) {
ERROR_LOG_REPORT(Log::ME, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): invalid size", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg);
return hleNoLog(ERROR_MPEG_NO_MEMORY);
return hleNoLog(SCE_MPEG_ERROR_NO_MEMORY);
}
if (__MpegRingbufferQueryMemSize(numPackets) > size) {
if (numPackets < 0x00100000) {
ERROR_LOG_REPORT(Log::ME, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): too many packets for buffer", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg);
return hleNoLog(ERROR_MPEG_NO_MEMORY);
return hleNoLog(SCE_MPEG_ERROR_NO_MEMORY);
} else {
// The PSP's firmware allows some cases here, due to a bug in its validation.
ERROR_LOG_REPORT(Log::ME, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): too many packets for buffer, bogus size", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg);
@@ -515,7 +516,7 @@ static u32 sceMpegCreate(u32 mpegAddr, u32 dataPtr, u32 size, u32 ringbufferAddr
}
if (size < MpegRequiredMem()) {
return hleLogWarning(Log::ME, ERROR_MPEG_NO_MEMORY);
return hleLogWarning(Log::ME, SCE_MPEG_ERROR_NO_MEMORY);
}
auto ringbuffer = PSPPointer<SceMpegRingBuffer>::Create(ringbufferAddr);
@@ -626,13 +627,13 @@ static int sceMpegQueryStreamOffset(u32 mpeg, u32 bufferAddr, u32 offsetAddr)
if (ctx->mpegMagic != PSMF_MAGIC) {
Memory::WriteUnchecked_U32(0, offsetAddr);
return hleLogError(Log::ME, ERROR_MPEG_INVALID_VALUE, "Bad PSMF magic");
return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE, "Bad PSMF magic");
} else if (ctx->mpegVersion < 0) {
Memory::WriteUnchecked_U32(0, offsetAddr);
return hleLogError(Log::ME, ERROR_MPEG_BAD_VERSION, "Bad version");
return hleLogError(Log::ME, SCE_MPEG_ERROR_BAD_VERSION, "Bad version");
} else if ((ctx->mpegOffset & 2047) != 0 || ctx->mpegOffset == 0) {
Memory::WriteUnchecked_U32(0, offsetAddr);
return hleLogError(Log::ME, ERROR_MPEG_INVALID_VALUE, "Bad offset");
return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE, "Bad offset");
}
Memory::WriteUnchecked_U32(ctx->mpegOffset, offsetAddr);
@@ -653,10 +654,10 @@ static u32 sceMpegQueryStreamSize(u32 bufferAddr, u32 sizeAddr)
if (ctx.mpegMagic != PSMF_MAGIC) {
Memory::WriteUnchecked_U32(0, sizeAddr);
return hleLogError(Log::ME, ERROR_MPEG_INVALID_VALUE, "Bad PSMF magic");
return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE, "Bad PSMF magic");
} else if ((ctx.mpegOffset & 2047) != 0 ) {
Memory::WriteUnchecked_U32(0, sizeAddr);
return hleLogError(Log::ME, ERROR_MPEG_INVALID_VALUE, "Bad offset %08x", ctx.mpegOffset);
return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE, "Bad offset %08x", ctx.mpegOffset);
}
Memory::WriteUnchecked_U32(ctx.mpegStreamSize, sizeAddr);
@@ -730,7 +731,7 @@ static int sceMpegFreeAvcEsBuf(u32 mpeg, int esBuf)
}
if (esBuf == 0) {
return hleLogError(Log::ME, ERROR_MPEG_INVALID_VALUE);
return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE);
}
if (esBuf >= 1 && esBuf <= MPEG_DATA_ES_BUFFERS) {
@@ -1128,7 +1129,7 @@ static u32 sceMpegAvcDecode(u32 mpeg, u32 auAddr, u32 frameWidth, u32 bufferAddr
}
if (ringbuffer->packetsRead == 0 || ctx->mediaengine->IsVideoEnd()) {
return hleDelayResult(hleLogWarning(Log::ME, ERROR_MPEG_AVC_DECODE_FATAL, "mpeg buffer empty"), "mpeg buffer empty", avcEmptyDelayMs);
return hleDelayResult(hleLogWarning(Log::ME, SCE_MPEG_ERROR_AVC_DECODE_FATAL, "mpeg buffer empty"), "mpeg buffer empty", avcEmptyDelayMs);
}
s32 beforeAvail = ringbuffer->packets - ctx->mediaengine->getRemainSize() / 2048;
@@ -1296,7 +1297,7 @@ static int sceMpegAvcDecodeYCbCr(u32 mpeg, u32 auAddr, u32 bufferAddr, u32 initA
}
if (ringbuffer->packetsRead == 0 || ctx->mediaengine->IsVideoEnd()) {
return hleDelayResult(hleLogWarning(Log::ME, ERROR_MPEG_AVC_DECODE_FATAL, "mpeg buffer empty"), "mpeg buffer empty", avcEmptyDelayMs);
return hleDelayResult(hleLogWarning(Log::ME, SCE_MPEG_ERROR_AVC_DECODE_FATAL, "mpeg buffer empty"), "mpeg buffer empty", avcEmptyDelayMs);
}
s32 beforeAvail = ringbuffer->packets - ctx->mediaengine->getRemainSize() / 2048;
@@ -1415,7 +1416,7 @@ static int sceMpegRingbufferAvailableSize(u32 ringbufferAddr) {
MpegContext *ctx = getMpegCtx(ringbuffer->mpeg);
if (!ctx) {
return hleLogError(Log::ME, ERROR_MPEG_NOT_YET_INIT, "bad mpeg handle");
return hleLogError(Log::ME, SCE_MPEG_ERROR_NOT_YET_INIT, "bad mpeg handle");
}
ctx->mpegRingbufferAddr = ringbufferAddr;
@@ -1463,7 +1464,7 @@ void PostPutAction::run(MipsCall &call) {
// Bail out early - don't accept any of the packets, even the good ones.
// This happens during legit playback at the Burnout Legends menu!
ERROR_LOG(Log::ME, "sceMpegRingbufferPut(): invalid mpeg data");
call.setReturnValue(ERROR_MPEG_INVALID_VALUE);
call.setReturnValue(SCE_MPEG_ERROR_INVALID_VALUE);
if (mpegLibVersion <= 0x0103) {
// Act like they were actually added, but don't increment read pos.
@@ -1571,7 +1572,7 @@ static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr)
if (PSP_CoreParameter().compat.flags().MpegAvcWarmUp) {
if (ctx->mpegwarmUp == 0) {
ctx->mpegwarmUp++;
return hleLogDebug(Log::ME, ERROR_MPEG_NO_DATA, "warming up (%d)", ctx->mpegwarmUp);
return hleLogDebug(Log::ME, SCE_MPEG_ERROR_NO_DATA, "warming up (%d)", ctx->mpegwarmUp);
}
}
@@ -1583,7 +1584,7 @@ static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr)
avcAu.dts = -1;
avcAu.write(auAddr);
// TODO: Does this really reschedule?
return hleDelayResult(hleLogDebug(Log::ME, ERROR_MPEG_NO_DATA), "mpeg get avc", mpegDecodeErrorDelayMs);
return hleDelayResult(hleLogDebug(Log::ME, SCE_MPEG_ERROR_NO_DATA), "mpeg get avc", mpegDecodeErrorDelayMs);
}
auto streamInfo = ctx->streamMap.find(streamId);
@@ -1605,7 +1606,7 @@ static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr)
{
ERROR_LOG(Log::ME, "sceMpegGetAvcAu - video too much ahead");
// TODO: Does this really reschedule?
return hleDelayResult(ERROR_MPEG_NO_DATA, "mpeg get avc", mpegDecodeErrorDelayMs);
return hleDelayResult(SCE_MPEG_ERROR_NO_DATA, "mpeg get avc", mpegDecodeErrorDelayMs);
}*/
int result = 0;
@@ -1617,7 +1618,7 @@ static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr)
INFO_LOG(Log::ME, "video end reach. pts: %i dts: %i", (int)avcAu.pts, (int)ctx->mediaengine->getLastTimeStamp());
ringbuffer->packetsAvail = 0;
result = ERROR_MPEG_NO_DATA;
result = SCE_MPEG_ERROR_NO_DATA;
}
// The avcau struct may have been modified by mediaengine, write it back.
@@ -1638,7 +1639,7 @@ static u32 sceMpegFinish()
if (!isMpegInit) {
WARN_LOG(Log::ME, "sceMpegFinish(...): not initialized");
// TODO: Need to properly hook module load/unload for this to work right.
//return ERROR_MPEG_NOT_YET_INIT;
//return SCE_MPEG_ERROR_NOT_YET_INIT;
} else {
INFO_LOG(Log::ME, "sceMpegFinish()");
__VideoPmpShutdown();
@@ -1681,7 +1682,7 @@ static int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr)
// The audio can end earlier than the video does.
if (ringbuffer->packetsAvail == 0) {
// TODO: Does this really delay?
return hleDelayResult(hleLogError(Log::ME, ERROR_MPEG_NO_DATA), "mpeg get atrac", mpegDecodeErrorDelayMs);
return hleDelayResult(hleLogError(Log::ME, SCE_MPEG_ERROR_NO_DATA), "mpeg get atrac", mpegDecodeErrorDelayMs);
}
// esBuffer is the memory where this au data goes. We don't write the data to memory.
@@ -1701,7 +1702,7 @@ static int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr)
if (!ctx->mediaengine->IsNoAudioData()) {
WARN_LOG_REPORT(Log::ME, "Video end without audio end, potentially skipping some audio?");
}
result = ERROR_MPEG_NO_DATA;
result = SCE_MPEG_ERROR_NO_DATA;
}
if (ctx->atracRegistered && ctx->mediaengine->IsNoAudioData() && !ctx->endOfAudioReached) {
@@ -1709,7 +1710,7 @@ static int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr)
ctx->endOfAudioReached = true;
}
if (ctx->mediaengine->IsNoAudioData()) {
result = ERROR_MPEG_NO_DATA;
result = SCE_MPEG_ERROR_NO_DATA;
}
atracAu.write(auAddr);
@@ -1744,17 +1745,17 @@ static u32 sceMpegChangeGetAuMode(u32 mpeg, int streamUid, int mode)
{
MpegContext *ctx = getMpegCtx(mpeg);
if (!ctx) {
return hleLogError(Log::ME, ERROR_MPEG_INVALID_VALUE, "bad mpeg handle");
return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE, "bad mpeg handle");
}
if (mode != MPEG_AU_MODE_DECODE && mode != MPEG_AU_MODE_SKIP) {
ERROR_LOG(Log::ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): bad mode", mpeg, streamUid, mode);
return ERROR_MPEG_INVALID_VALUE;
return SCE_MPEG_ERROR_INVALID_VALUE;
}
auto stream = ctx->streamMap.find(streamUid);
if (stream == ctx->streamMap.end()) {
ERROR_LOG(Log::ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): unknown streamID", mpeg, streamUid, mode);
return ERROR_MPEG_INVALID_VALUE;
return SCE_MPEG_ERROR_INVALID_VALUE;
} else {
StreamInfo &info = stream->second;
DEBUG_LOG(Log::ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): changing type=%d", mpeg, streamUid, mode, info.type);
@@ -1818,7 +1819,7 @@ static u32 sceMpegGetPcmAu(u32 mpeg, int streamUid, u32 auAddr, u32 attrAddr)
}
if (!Memory::IsValidAddress(streamUid)) {
WARN_LOG(Log::ME, "sceMpegGetPcmAu(%08x, %08x, %08x, %08x): didn't get a fake stream", mpeg, streamUid, auAddr, attrAddr);
return ERROR_MPEG_INVALID_ADDR;
return SCE_MPEG_ERROR_INVALID_ADDR;
}
SceMpegAu atracAu;
atracAu.read(auAddr);
@@ -1996,7 +1997,7 @@ static int sceMpegAvcQueryYCbCrSize(u32 mpeg, u32 mode, u32 width, u32 height, u
{
if ((width & 15) != 0 || (height & 15) != 0 || height > 272 || width > 480) {
ERROR_LOG(Log::ME, "sceMpegAvcQueryYCbCrSize: bad w/h %i x %i", width, height);
return ERROR_MPEG_INVALID_VALUE;
return SCE_MPEG_ERROR_INVALID_VALUE;
}
DEBUG_LOG(Log::ME, "sceMpegAvcQueryYCbCrSize(%08x, %i, %i, %i, %08x)", mpeg, mode, width, height, resultAddr);
@@ -2048,7 +2049,7 @@ static u32 sceMpegAvcResourceGetAvcEsBuf(u32 mpeg)
static u32 sceMpegAvcResourceInit(u32 mpeg)
{
if (mpeg != 1) {
return ERROR_MPEG_INVALID_VALUE;
return SCE_MPEG_ERROR_INVALID_VALUE;
}
ERROR_LOG(Log::ME, "UNIMPL sceMpegAvcResourceInit(%08x)", mpeg);
@@ -2110,14 +2111,14 @@ static int __MpegAvcConvertToYuv420(const void *data, u32 bufferOutputAddr, int
static int sceMpegAvcConvertToYuv420(u32 mpeg, u32 bufferOutputAddr, u32 bufferAddr, int unknown2) {
if (!Memory::IsValidAddress(bufferOutputAddr))
return hleLogError(Log::ME, ERROR_MPEG_INVALID_VALUE, "invalid addresses");
return hleLogError(Log::ME, SCE_MPEG_ERROR_INVALID_VALUE, "invalid addresses");
MpegContext *ctx = getMpegCtx(mpeg);
if (!ctx)
return hleLogWarning(Log::ME, -1, "bad mpeg handle");
if (ctx->mediaengine->m_buffer == 0)
return hleLogWarning(Log::ME, ERROR_MPEG_AVC_INVALID_VALUE, "m_buffer is zero");
return hleLogWarning(Log::ME, SCE_MPEG_ERROR_AVC_INVALID_VALUE, "m_buffer is zero");
const u8 *data = ctx->mediaengine->getFrameImage();
int width = ctx->mediaengine->m_desWidth;
@@ -2145,7 +2146,7 @@ static int sceMpegGetUserdataAu(u32 mpeg, u32 streamUid, u32 auAddr, u32 resultA
// We currently can't demux userdata so this seems like the best thing to return in the meantime..
// Then we probably shouldn't do the above writes? but it works...
return ERROR_MPEG_NO_DATA;
return SCE_MPEG_ERROR_NO_DATA;
}
static u32 sceMpegNextAvcRpAu(u32 mpeg, u32 streamUid)
-12
View File
@@ -22,18 +22,6 @@
class PointerWrap;
enum {
ERROR_MPEG_BAD_VERSION = 0x80610002,
ERROR_MPEG_NO_MEMORY = 0x80610022,
ERROR_MPEG_INVALID_ADDR = 0x80610103,
ERROR_MPEG_INVALID_VALUE = 0x806101fe,
ERROR_MPEG_NO_DATA = 0x80618001,
ERROR_MPEG_ALREADY_INIT = 0x80618005,
ERROR_MPEG_NOT_YET_INIT = 0x80618009,
ERROR_MPEG_AVC_INVALID_VALUE = 0x806201fe,
ERROR_MPEG_AVC_DECODE_FATAL = 0x80628002,
};
// MPEG statics.
static const u32 PSMF_MAGIC = 0x464D5350;
static const int PSMF_STREAM_VERSION_OFFSET = 0x4;
+21 -19
View File
@@ -25,6 +25,7 @@
#include "Core/HLE/HLE.h"
#include "Core/HLE/HLEHelperThread.h"
#include "Core/HLE/FunctionWrappers.h"
#include "Core/HLE/ErrorCodes.h"
#include "Core/HLE/scePsmf.h"
#include "Core/HLE/sceMpeg.h"
#include "Core/HLE/sceKernelMemory.h"
@@ -910,8 +911,8 @@ static u32 scePsmfGetCurrentStreamType(u32 psmfStruct, u32 typeAddr, u32 channel
return hleLogError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad pointers");
}
if (psmf->currentStreamType != -1) {
Memory::Write_U32(psmf->currentStreamType, typeAddr);
Memory::Write_U32(psmf->currentStreamChannel, channelAddr);
Memory::WriteUnchecked_U32(psmf->currentStreamType, typeAddr);
Memory::WriteUnchecked_U32(psmf->currentStreamChannel, channelAddr);
}
return hleLogDebug(Log::ME, 0);
}
@@ -923,7 +924,7 @@ static u32 scePsmfGetStreamSize(u32 psmfStruct, u32 sizeAddr)
return hleLogError(Log::ME, ERROR_PSMF_NOT_FOUND, "invalid psmf");
}
if (Memory::IsValidAddress(sizeAddr)) {
Memory::Write_U32(psmf->streamSize, sizeAddr);
Memory::WriteUnchecked_U32(psmf->streamSize, sizeAddr);
}
return hleLogDebug(Log::ME, 0);
}
@@ -932,7 +933,7 @@ static u32 scePsmfQueryStreamOffset(u32 bufferAddr, u32 offsetAddr)
{
WARN_LOG(Log::ME, "scePsmfQueryStreamOffset(%08x, %08x)", bufferAddr, offsetAddr);
if (Memory::IsValidAddress(offsetAddr)) {
Memory::Write_U32(bswap32(Memory::Read_U32(bufferAddr + PSMF_STREAM_OFFSET_OFFSET)), offsetAddr);
Memory::WriteUnchecked_U32(bswap32(Memory::Read_U32(bufferAddr + PSMF_STREAM_OFFSET_OFFSET)), offsetAddr);
}
return 0;
}
@@ -941,7 +942,7 @@ static u32 scePsmfQueryStreamSize(u32 bufferAddr, u32 sizeAddr)
{
WARN_LOG(Log::ME, "scePsmfQueryStreamSize(%08x, %08x)", bufferAddr, sizeAddr);
if (Memory::IsValidAddress(sizeAddr)) {
Memory::Write_U32(bswap32(Memory::Read_U32(bufferAddr + PSMF_STREAM_SIZE_OFFSET)), sizeAddr);
Memory::WriteUnchecked_U32(bswap32(Memory::Read_U32(bufferAddr + PSMF_STREAM_SIZE_OFFSET)), sizeAddr);
}
return 0;
}
@@ -953,7 +954,7 @@ static u32 scePsmfGetHeaderSize(u32 psmfStruct, u32 sizeAddr)
return hleLogError(Log::ME, ERROR_PSMF_NOT_FOUND, "invalid psmf");
}
if (Memory::IsValidAddress(sizeAddr)) {
Memory::Write_U32(psmf->headerSize, sizeAddr);
Memory::WriteUnchecked_U32(psmf->headerSize, sizeAddr);
}
return hleLogDebug(Log::ME, 0);
}
@@ -1013,7 +1014,7 @@ static u32 scePsmfGetPresentationEndTime(u32 psmfStruct, u32 endTimeAddr)
}
DEBUG_LOG(Log::ME, "scePsmfGetPresentationEndTime(%08x, %08x)", psmfStruct, endTimeAddr);
if (Memory::IsValidAddress(endTimeAddr)) {
Memory::Write_U32(psmf->presentationEndTime, endTimeAddr);
Memory::WriteUnchecked_U32(psmf->presentationEndTime, endTimeAddr);
}
return 0;
}
@@ -1134,7 +1135,7 @@ static int scePsmfPlayerCreate(u32 psmfPlayer, u32 dataPtr) {
}
if (!psmfPlayerMap.empty()) {
*player = 0;
return hleReportError(Log::ME, ERROR_MPEG_ALREADY_INIT, "already have an active player");
return hleReportError(Log::ME, SCE_MPEG_ERROR_ALREADY_INIT, "already have an active player");
}
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
@@ -1473,6 +1474,7 @@ static int scePsmfPlayerDelete(u32 psmfPlayer)
}
delete psmfplayer;
psmfPlayerMap.erase(Memory::Read_U32(psmfPlayer));
Memory::Write_U32(0, psmfPlayer);
@@ -1676,11 +1678,11 @@ static u32 scePsmfPlayerGetCurrentPts(u32 psmfPlayer, u32 currentPtsAddr)
if (psmfplayer->psmfPlayerAvcAu.pts < 0) {
return hleLogVerbose(Log::ME, ERROR_PSMFPLAYER_NO_MORE_DATA, "no frame yet");
}
if (Memory::IsValidAddress(currentPtsAddr)) {
Memory::Write_U32(psmfplayer->psmfPlayerAvcAu.pts, currentPtsAddr);
// TODO: Should this be a 64-bit write?
Memory::WriteUnchecked_U32(psmfplayer->psmfPlayerAvcAu.pts, currentPtsAddr);
}
return hleLogDebug(Log::ME, 0, "pts: %d", psmfplayer->psmfPlayerAvcAu.pts);
return hleLogDebug(Log::ME, 0, "pts: %d", (int)psmfplayer->psmfPlayerAvcAu.pts);
}
static u32 scePsmfPlayerGetPsmfInfo(u32 psmfPlayer, u32 psmfInfoAddr, u32 widthAddr, u32 heightAddr) {
@@ -1712,10 +1714,10 @@ static u32 scePsmfPlayerGetPsmfInfo(u32 psmfPlayer, u32 psmfInfoAddr, u32 widthA
// Can't ask mediaengine for width/height here, it's too early, so we grabbed it from the
// header in scePsmfPlayerSetPsmf.
if (Memory::IsValidAddress(widthAddr) && psmfplayer->videoWidth) {
Memory::Write_U32(psmfplayer->videoWidth, widthAddr);
Memory::WriteUnchecked_U32(psmfplayer->videoWidth, widthAddr);
}
if (Memory::IsValidAddress(heightAddr) && psmfplayer->videoHeight) {
Memory::Write_U32(psmfplayer->videoHeight, heightAddr);
Memory::WriteUnchecked_U32(psmfplayer->videoHeight, heightAddr);
}
}
return hleLogDebug(Log::ME, 0);
@@ -1729,10 +1731,10 @@ static u32 scePsmfPlayerGetCurrentPlayMode(u32 psmfPlayer, u32 playModeAddr, u32
}
if (Memory::IsValidAddress(playModeAddr)) {
Memory::Write_U32(psmfplayer->playMode, playModeAddr);
Memory::WriteUnchecked_U32(psmfplayer->playMode, playModeAddr);
}
if (Memory::IsValidAddress(playSpeedAddr)) {
Memory::Write_U32(psmfplayer->playSpeed, playSpeedAddr);
Memory::WriteUnchecked_U32(psmfplayer->playSpeed, playSpeedAddr);
}
return hleLogDebug(Log::ME, 0);
}
@@ -1748,10 +1750,10 @@ static u32 scePsmfPlayerGetCurrentVideoStream(u32 psmfPlayer, u32 videoCodecAddr
}
if (Memory::IsValidAddress(videoCodecAddr)) {
Memory::Write_U32(psmfplayer->videoCodec == 0x0E ? 0 : psmfplayer->videoCodec, videoCodecAddr);
Memory::WriteUnchecked_U32(psmfplayer->videoCodec == 0x0E ? 0 : psmfplayer->videoCodec, videoCodecAddr);
}
if (Memory::IsValidAddress(videoStreamNumAddr)) {
Memory::Write_U32(psmfplayer->videoStreamNum, videoStreamNumAddr);
Memory::WriteUnchecked_U32(psmfplayer->videoStreamNum, videoStreamNumAddr);
}
return hleLogDebug(Log::ME, 0);
}
@@ -1767,10 +1769,10 @@ static u32 scePsmfPlayerGetCurrentAudioStream(u32 psmfPlayer, u32 audioCodecAddr
}
if (Memory::IsValidAddress(audioCodecAddr)) {
Memory::Write_U32(psmfplayer->audioCodec == 0x0F ? 1 : psmfplayer->audioCodec, audioCodecAddr);
Memory::WriteUnchecked_U32(psmfplayer->audioCodec == 0x0F ? 1 : psmfplayer->audioCodec, audioCodecAddr);
}
if (Memory::IsValidAddress(audioStreamNumAddr)) {
Memory::Write_U32(psmfplayer->audioStreamNum, audioStreamNumAddr);
Memory::WriteUnchecked_U32(psmfplayer->audioStreamNum, audioStreamNumAddr);
}
return hleLogInfo(Log::ME, 0);
}