mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-18 03:44:32 +01:00
Merge pull request #20140 from hrydgard/more-error-enum
Move more error codes to the big enum
This commit is contained in:
54 files changed
+442
-366
No files matched your search
@@ -19,6 +19,7 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Serialize/Serializer.h"
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/ELF/ParamSFO.h"
|
||||
#include "Core/MemMapHelpers.h"
|
||||
#include "Core/Reporting.h"
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include "Core/Dialog/PSPDialog.h"
|
||||
#include "Core/Dialog/SavedataParam.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
|
||||
struct SceUtilityGamedataInstallParam {
|
||||
pspUtilityDialogCommon common;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "Core/MemMapHelpers.h"
|
||||
#include "Core/Util/PPGeDraw.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/sceKernelMemory.h"
|
||||
#include "Core/HLE/sceCtrl.h"
|
||||
#include "Core/HLE/sceUtility.h"
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "Core/HLE/sceCtrl.h"
|
||||
#include "Core/HLE/sceUtility.h"
|
||||
#include "Core/HLE/sceNp.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/Dialog/PSPNpSigninDialog.h"
|
||||
#include "Common/Data/Encoding/Utf8.h"
|
||||
#include "Core/Reporting.h"
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "Core/Dialog/PSPDialog.h"
|
||||
#include "Core/Dialog/PSPScreenshotDialog.h"
|
||||
#include "Core/HLE/sceKernel.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/Reporting.h"
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "Core/ELF/ElfReader.h"
|
||||
#include "Core/Debugger/MemBlockInfo.h"
|
||||
#include "Core/Debugger/SymbolMap.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/sceKernelMemory.h"
|
||||
#include "Core/HLE/sceKernelModule.h"
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "Common.h"
|
||||
#include "Common/File/Path.h"
|
||||
#include "Core/HLE/sceKernel.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
|
||||
enum FileAccess {
|
||||
FILEACCESS_NONE = 0,
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "Core/MemMapHelpers.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/sceAtrac.h"
|
||||
#include "Core/HLE/AtracCtx.h"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "Common/Log.h"
|
||||
#include "Core/MemMapHelpers.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/HLE/AtracCtx2.h"
|
||||
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
|
||||
u32 DecodeData(u8 *outbuf, u32 outbufPtr, int *SamplesNum, int *finish, int *remains) override;
|
||||
int DecodeLowLevel(const u8 *srcData, int *bytesConsumed, s16 *dstData, int *bytesWritten) override;
|
||||
void DecodeForSas(s16 *dstData, int *bytesWritten, int *finish);
|
||||
void DecodeForSas(s16 *dstData, int *bytesWritten, int *finish) override;
|
||||
|
||||
u32 GetNextSamples() override;
|
||||
|
||||
|
||||
@@ -407,4 +407,64 @@ 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_NO_DATA = 0x80618001,
|
||||
SCE_MPEG_ERROR_BAD_VERSION = 0x80610002,
|
||||
SCE_MPEG_ERROR_INVALID_ADDR = 0x80610103,
|
||||
SCE_MPEG_ERROR_ALREADY_INIT = 0x80618005,
|
||||
SCE_MPEG_ERROR_NOT_YET_INIT = 0x80618009,
|
||||
SCE_MPEG_ERROR_NO_MEMORY = 0x80610022,
|
||||
SCE_MPEG_ERROR_INVALID_VALUE = 0x806101fe,
|
||||
SCE_MPEG_ERROR_AVC_INVALID_VALUE = 0x806201fe,
|
||||
SCE_MPEG_ERROR_AVC_DECODE_FATAL = 0x80628002,
|
||||
|
||||
SCE_PSMF_ERROR_NOT_INITIALIZED = 0x80615001,
|
||||
SCE_PSMF_ERROR_BAD_VERSION = 0x80615002,
|
||||
SCE_PSMF_ERROR_NOT_FOUND = 0x80615025,
|
||||
SCE_PSMF_ERROR_INVALID_ID = 0x80615100,
|
||||
SCE_PSMF_ERROR_INVALID_VALUE = 0x806151fe,
|
||||
SCE_PSMF_ERROR_INVALID_TIMESTAMP = 0x80615500,
|
||||
SCE_PSMF_ERROR_INVALID_PSMF = 0x80615501,
|
||||
|
||||
SCE_PSMFPLAYER_ERROR_INVALID_STATUS = 0x80616001,
|
||||
SCE_PSMFPLAYER_ERROR_INVALID_STREAM = 0x80616003,
|
||||
SCE_PSMFPLAYER_ERROR_BUFFER_SIZE = 0x80616005,
|
||||
SCE_PSMFPLAYER_ERROR_INVALID_CONFIG = 0x80616006,
|
||||
SCE_PSMFPLAYER_ERROR_INVALID_PARAM = 0x80616008,
|
||||
SCE_PSMFPLAYER_ERROR_NO_MORE_DATA = 0x8061600c,
|
||||
|
||||
SCE_JPEG_ERROR_INVALID_DATA = 0x80650004,
|
||||
SCE_JPEG_ERROR_INVALID_COLORSPACE = 0x80650013,
|
||||
SCE_JPEG_ERROR_INVALID_SIZE = 0x80650020,
|
||||
SCE_JPEG_ERROR_NO_SOI = 0x80650023,
|
||||
SCE_JPEG_ERROR_INVALID_STATE = 0x80650039,
|
||||
SCE_JPEG_ERROR_OUT_OF_MEMORY = 0x80650041,
|
||||
SCE_JPEG_ERROR_ALREADY_INIT = 0x80650042,
|
||||
SCE_JPEG_ERROR_INVALID_VALUE = 0x80650051,
|
||||
|
||||
SCE_FONT_ERROR_OUT_OF_MEMORY = 0x80460001,
|
||||
SCE_FONT_ERROR_INVALID_LIBID = 0x80460002,
|
||||
SCE_FONT_ERROR_INVALID_PARAMETER = 0x80460003,
|
||||
SCE_FONT_ERROR_HANDLER_OPEN_FAILED = 0x80460005,
|
||||
SCE_FONT_ERROR_TOO_MANY_OPEN_FONTS = 0x80460009,
|
||||
SCE_FONT_ERROR_INVALID_FONT_DATA = 0x8046000a,
|
||||
|
||||
SCE_MUTEX_ERROR_NO_SUCH_MUTEX = 0x800201C3,
|
||||
SCE_MUTEX_ERROR_TRYLOCK_FAILED = 0x800201C4,
|
||||
SCE_MUTEX_ERROR_NOT_LOCKED = 0x800201C5,
|
||||
SCE_MUTEX_ERROR_LOCK_OVERFLOW = 0x800201C6,
|
||||
SCE_MUTEX_ERROR_UNLOCK_UNDERFLOW = 0x800201C7,
|
||||
SCE_MUTEX_ERROR_ALREADY_LOCKED = 0x800201C8,
|
||||
|
||||
SCE_LWMUTEX_ERROR_NO_SUCH_LWMUTEX = 0x800201CA ,// Note: Only used for firmware 600+
|
||||
SCE_LWMUTEX_ERROR_TRYLOCK_FAILED = 0x800201CB,
|
||||
SCE_LWMUTEX_ERROR_NOT_LOCKED = 0x800201CC,
|
||||
SCE_LWMUTEX_ERROR_LOCK_OVERFLOW = 0x800201CD,
|
||||
SCE_LWMUTEX_ERROR_UNLOCK_UNDERFLOW = 0x800201CE,
|
||||
SCE_LWMUTEX_ERROR_ALREADY_LOCKED = 0x800201CF,
|
||||
|
||||
SCE_SSL_ERROR_NOT_INIT = 0x80435001,
|
||||
SCE_SSL_ERROR_ALREADY_INIT = 0x80435020,
|
||||
SCE_SSL_ERROR_OUT_OF_MEMORY = 0x80435022,
|
||||
SCE_SSL_ERROR_INVALID_PARAMETER = 0x804351FE,
|
||||
};
|
||||
+2
-1
@@ -36,6 +36,7 @@
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/MIPS/MIPSCodeUtils.h"
|
||||
#include "Core/HLE/HLETables.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/sceKernelThread.h"
|
||||
#include "Core/HLE/sceKernelInterrupt.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
@@ -1033,7 +1034,7 @@ void hleDoLogInternal(Log t, LogLevel level, u64 res, const char *file, int line
|
||||
case 'I':
|
||||
if ((int)res < 0 && (errStr = KernelErrorToString((u32)res))) {
|
||||
// It's a known syscall error code, let's display it as string.
|
||||
fmt = "%sSCE_KERNEL_ERROR_%s=%s(%s)%s";
|
||||
fmt = "%s%s=%s(%s)%s";
|
||||
} else {
|
||||
fmt = "%s%lld=%s(%s)%s";
|
||||
errStr = nullptr; // We check errstr later to determine which format to use.
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Core/MemMapHelpers.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/HLEHelperThread.h"
|
||||
#include "Core/HLE/KernelWaitHelpers.h"
|
||||
#include "Core/HLE/sceKernelThread.h"
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/HLE/sceKernelThread.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
|
||||
namespace HLEKernel
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/HLE/NetInetConstants.h"
|
||||
#include "Core/HLE/sceKernel.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#ifdef __MINGW32__
|
||||
#include <mswsock.h>
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <algorithm>
|
||||
|
||||
#include "Common/Common.h"
|
||||
#include "Common/File/Path.h"
|
||||
#include "Common/Serialize/Serializer.h"
|
||||
@@ -25,17 +26,17 @@
|
||||
#include "Common/Data/Collections/FixedSizeQueue.h"
|
||||
#include "Common/System/System.h"
|
||||
#include "Common/Math/SIMDHeaders.h"
|
||||
#include "Common/StringUtils.h"
|
||||
|
||||
#include "Core/Config.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/MemMapHelpers.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/System.h"
|
||||
#ifndef MOBILE_DEVICE
|
||||
#include "Core/WaveFile.h"
|
||||
#include "Core/ELF/ParamSFO.h"
|
||||
#include "Core/HLE/sceKernelTime.h"
|
||||
#include "StringUtils.h"
|
||||
#endif
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/__sceAudio.h"
|
||||
#include "Core/HLE/sceAudio.h"
|
||||
#include "Core/HLE/sceKernel.h"
|
||||
@@ -283,7 +284,7 @@ u32 __AudioEnqueue(AudioChannel &chan, int chanNum, bool blocking) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline void __AudioWakeThreads(AudioChannel &chan, int result, int step) {
|
||||
void __AudioWakeThreads(AudioChannel &chan, int result, int step) {
|
||||
u32 error;
|
||||
bool wokeThreads = false;
|
||||
for (size_t w = 0; w < chan.waitingThreads.size(); ++w) {
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "Common/Serialize/Serializer.h"
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/sceKernelThread.h"
|
||||
#include "Core/HLE/sceAudio.h"
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "Common/Math/math_util.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/sceCtrl.h"
|
||||
#include "Core/HLE/sceKernel.h"
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "Core/Core.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/sceDisplay.h"
|
||||
#include "Core/HLE/sceKernel.h"
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "Core/MemMapHelpers.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/sceDmac.h"
|
||||
#include "Core/HLE/sceKernel.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
|
||||
+52
-62
@@ -1,5 +1,3 @@
|
||||
#include "sceFont.h"
|
||||
|
||||
#include "Common/TimeUtil.h"
|
||||
|
||||
#include <cmath>
|
||||
@@ -11,6 +9,7 @@
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Common/Serialize/SerializeMap.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/sceFont.h"
|
||||
#include "Core/HLE/sceKernel.h"
|
||||
@@ -24,15 +23,6 @@
|
||||
#include "Core/System.h"
|
||||
#include "Core/Font/PGF.h"
|
||||
|
||||
enum {
|
||||
ERROR_FONT_OUT_OF_MEMORY = 0x80460001,
|
||||
ERROR_FONT_INVALID_LIBID = 0x80460002,
|
||||
ERROR_FONT_INVALID_PARAMETER = 0x80460003,
|
||||
ERROR_FONT_HANDLER_OPEN_FAILED = 0x80460005,
|
||||
ERROR_FONT_TOO_MANY_OPEN_FONTS = 0x80460009,
|
||||
ERROR_FONT_INVALID_FONT_DATA = 0x8046000a,
|
||||
};
|
||||
|
||||
constexpr int MAX_FONT_REFS = 4;
|
||||
|
||||
// For the save states.
|
||||
@@ -623,12 +613,12 @@ public:
|
||||
foundFontIndex = FindFreeIndex();
|
||||
|
||||
if (foundFontIndex < 0 || fontRefCount_[foundFontIndex] >= MAX_FONT_REFS) {
|
||||
error = ERROR_FONT_TOO_MANY_OPEN_FONTS;
|
||||
error = SCE_FONT_ERROR_TOO_MANY_OPEN_FONTS;
|
||||
ERROR_LOG(Log::sceFont, "OpenFont: Too many fonts opened in FontLib");
|
||||
return nullptr;
|
||||
}
|
||||
if (!font->IsValid()) {
|
||||
error = ERROR_FONT_INVALID_FONT_DATA;
|
||||
error = SCE_FONT_ERROR_INVALID_FONT_DATA;
|
||||
ERROR_LOG(Log::sceFont, "OpenFont: Invalid font data");
|
||||
return nullptr;
|
||||
}
|
||||
@@ -795,7 +785,7 @@ void PostAllocCallback::run(MipsCall &call) {
|
||||
if (v0 == 0) {
|
||||
// TODO: Who deletes fontLib?
|
||||
if (errorCodePtr_)
|
||||
Memory::Write_U32(ERROR_FONT_OUT_OF_MEMORY, errorCodePtr_);
|
||||
Memory::Write_U32(SCE_FONT_ERROR_OUT_OF_MEMORY, errorCodePtr_);
|
||||
call.setReturnValue(0);
|
||||
} else {
|
||||
_dbg_assert_(fontLibID_ >= 0);
|
||||
@@ -827,7 +817,7 @@ void PostCharInfoAllocCallback::run(MipsCall &call) {
|
||||
FontLib *fontLib = fontLibList[fontLibID_];
|
||||
u32 v0 = currentMIPS->r[MIPS_REG_V0];
|
||||
if (v0 == 0) {
|
||||
call.setReturnValue(ERROR_FONT_OUT_OF_MEMORY); // From JPCSP, if alloc size is 0, still this error value?
|
||||
call.setReturnValue(SCE_FONT_ERROR_OUT_OF_MEMORY); // From JPCSP, if alloc size is 0, still this error value?
|
||||
} else {
|
||||
fontLib->SetCharInfoBitmapAddress(v0);
|
||||
}
|
||||
@@ -1031,7 +1021,7 @@ static u32 sceFontNewLib(u32 paramPtr, u32 errorCodePtr) {
|
||||
|
||||
if (!Memory::IsValidAddress(params->allocFuncAddr) || !Memory::IsValidAddress(params->freeFuncAddr)) {
|
||||
ERROR_LOG_REPORT(Log::sceFont, "sceFontNewLib(%08x, %08x): missing alloc func", paramPtr, errorCodePtr);
|
||||
*errorCode = ERROR_FONT_INVALID_PARAMETER;
|
||||
*errorCode = SCE_FONT_ERROR_INVALID_PARAMETER;
|
||||
return hleLogError(Log::sceFont, 0);
|
||||
}
|
||||
|
||||
@@ -1065,11 +1055,11 @@ static u32 sceFontOpen(u32 libHandle, u32 index, u32 mode, u32 errorCodePtr) {
|
||||
|
||||
FontLib *fontLib = GetFontLib(libHandle);
|
||||
if (!fontLib) {
|
||||
*errorCode = ERROR_FONT_INVALID_LIBID;
|
||||
*errorCode = SCE_FONT_ERROR_INVALID_LIBID;
|
||||
return hleLogWarning(Log::sceFont, 0, "invalid font lib");
|
||||
}
|
||||
if (index >= internalFonts.size()) {
|
||||
*errorCode = ERROR_FONT_INVALID_PARAMETER;
|
||||
*errorCode = SCE_FONT_ERROR_INVALID_PARAMETER;
|
||||
return hleLogWarning(Log::sceFont, 0, "invalid font index");
|
||||
}
|
||||
|
||||
@@ -1092,17 +1082,17 @@ static u32 sceFontOpenUserMemory(u32 libHandle, u32 memoryFontPtr, u32 memoryFon
|
||||
return hleReportError(Log::sceFont, -1, "invalid error address");
|
||||
}
|
||||
if (!Memory::IsValidAddress(memoryFontPtr)) {
|
||||
*errorCode = ERROR_FONT_INVALID_PARAMETER;
|
||||
*errorCode = SCE_FONT_ERROR_INVALID_PARAMETER;
|
||||
return hleReportError(Log::sceFont, 0, "invalid address");
|
||||
}
|
||||
|
||||
FontLib *fontLib = GetFontLib(libHandle);
|
||||
if (!fontLib) {
|
||||
*errorCode = ERROR_FONT_INVALID_LIBID;
|
||||
*errorCode = SCE_FONT_ERROR_INVALID_LIBID;
|
||||
return hleReportError(Log::sceFont, 0, "invalid font lib");
|
||||
}
|
||||
if (memoryFontLength == 0) {
|
||||
*errorCode = ERROR_FONT_INVALID_PARAMETER;
|
||||
*errorCode = SCE_FONT_ERROR_INVALID_PARAMETER;
|
||||
return hleReportError(Log::sceFont, 0, "invalid size");
|
||||
}
|
||||
|
||||
@@ -1128,17 +1118,17 @@ static u32 sceFontOpenUserMemory(u32 libHandle, u32 memoryFontPtr, u32 memoryFon
|
||||
static u32 sceFontOpenUserFile(u32 libHandle, const char *fileName, u32 mode, u32 errorCodePtr) {
|
||||
auto errorCode = PSPPointer<s32_le>::Create(errorCodePtr);
|
||||
if (!errorCode.IsValid()) {
|
||||
return hleReportError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "invalid error address");
|
||||
return hleReportError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "invalid error address");
|
||||
}
|
||||
|
||||
if (!fileName) {
|
||||
*errorCode = ERROR_FONT_INVALID_PARAMETER;
|
||||
*errorCode = SCE_FONT_ERROR_INVALID_PARAMETER;
|
||||
return hleReportError(Log::sceFont, 0, "invalid filename");
|
||||
}
|
||||
|
||||
FontLib *fontLib = GetFontLib(libHandle);
|
||||
if (!fontLib) {
|
||||
*errorCode = ERROR_FONT_INVALID_LIBID;
|
||||
*errorCode = SCE_FONT_ERROR_INVALID_LIBID;
|
||||
return hleReportError(Log::sceFont, 0, "invalid font lib");
|
||||
}
|
||||
|
||||
@@ -1149,7 +1139,7 @@ static u32 sceFontOpenUserFile(u32 libHandle, const char *fileName, u32 mode, u3
|
||||
|
||||
std::vector<u8> buffer;
|
||||
if (pspFileSystem.ReadEntireFile(fileName, buffer) != 0) {
|
||||
*errorCode = ERROR_FONT_HANDLER_OPEN_FAILED;
|
||||
*errorCode = SCE_FONT_ERROR_HANDLER_OPEN_FAILED;
|
||||
return hleLogError(Log::sceFont, 0, "file does not exist");
|
||||
}
|
||||
|
||||
@@ -1187,13 +1177,13 @@ static int sceFontFindOptimumFont(u32 libHandle, u32 fontStylePtr, u32 errorCode
|
||||
|
||||
FontLib *fontLib = GetFontLib(libHandle);
|
||||
if (!fontLib) {
|
||||
*errorCode = ERROR_FONT_INVALID_LIBID;
|
||||
*errorCode = SCE_FONT_ERROR_INVALID_LIBID;
|
||||
return hleReportError(Log::sceFont, 0, "invalid font lib");
|
||||
}
|
||||
|
||||
if (!Memory::IsValidAddress(fontStylePtr)) {
|
||||
// Yes, actually. Must've been a typo in the library.
|
||||
*errorCode = ERROR_FONT_INVALID_LIBID;
|
||||
*errorCode = SCE_FONT_ERROR_INVALID_LIBID;
|
||||
return hleReportError(Log::sceFont, 0, "invalid style address");
|
||||
}
|
||||
|
||||
@@ -1266,13 +1256,13 @@ static int sceFontFindFont(u32 libHandle, u32 fontStylePtr, u32 errorCodePtr) {
|
||||
FontLib *fontLib = GetFontLib(libHandle);
|
||||
if (!fontLib) {
|
||||
ERROR_LOG_REPORT(Log::sceFont, "sceFontFindFont(%08x, %08x, %08x): invalid font lib", libHandle, fontStylePtr, errorCodePtr);
|
||||
*errorCode = ERROR_FONT_INVALID_LIBID;
|
||||
*errorCode = SCE_FONT_ERROR_INVALID_LIBID;
|
||||
return hleNoLog(0);
|
||||
}
|
||||
|
||||
if (!Memory::IsValidAddress(fontStylePtr)) {
|
||||
ERROR_LOG_REPORT(Log::sceFont, "sceFontFindFont(%08x, %08x, %08x): invalid style address", libHandle, fontStylePtr, errorCodePtr);
|
||||
*errorCode = ERROR_FONT_INVALID_PARAMETER;
|
||||
*errorCode = SCE_FONT_ERROR_INVALID_PARAMETER;
|
||||
return hleNoLog(0);
|
||||
}
|
||||
|
||||
@@ -1306,11 +1296,11 @@ static int sceFontFindFont(u32 libHandle, u32 fontStylePtr, u32 errorCodePtr) {
|
||||
|
||||
static int sceFontGetFontInfo(u32 fontHandle, u32 fontInfoPtr) {
|
||||
if (!Memory::IsValidAddress(fontInfoPtr)) {
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "bad fontInfo pointer");
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "bad fontInfo pointer");
|
||||
}
|
||||
LoadedFont *font = GetLoadedFont(fontHandle, true);
|
||||
if (!font) {
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "bad font");
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "bad font");
|
||||
}
|
||||
|
||||
auto fi = PSPPointer<PGFFontInfo>::Create(fontInfoPtr);
|
||||
@@ -1324,14 +1314,14 @@ static int sceFontGetFontInfoByIndexNumber(u32 libHandle, u32 fontInfoPtr, u32 i
|
||||
auto fontStyle = PSPPointer<PGFFontStyle>::Create(fontInfoPtr);
|
||||
FontLib *fl = GetFontLib(libHandle);
|
||||
if (!fl || fl->handle() == 0) {
|
||||
int error = !fl ? ERROR_FONT_INVALID_LIBID : ERROR_FONT_INVALID_PARAMETER;
|
||||
int error = !fl ? SCE_FONT_ERROR_INVALID_LIBID : SCE_FONT_ERROR_INVALID_PARAMETER;
|
||||
return hleLogError(Log::sceFont, error, "invalid font lib");
|
||||
}
|
||||
if (index >= internalFonts.size()) {
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "invalid font index");
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "invalid font index");
|
||||
}
|
||||
if (!fontStyle.IsValid()) {
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "invalid info pointer");
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "invalid info pointer");
|
||||
}
|
||||
|
||||
auto font = internalFonts[index];
|
||||
@@ -1343,12 +1333,12 @@ static int sceFontGetFontInfoByIndexNumber(u32 libHandle, u32 fontInfoPtr, u32 i
|
||||
static int sceFontGetCharInfo(u32 fontHandle, u32 charCode, u32 charInfoPtr) {
|
||||
charCode &= 0xffff;
|
||||
if (!Memory::IsValidAddress(charInfoPtr)) {
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "bad charInfo pointer");
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "bad charInfo pointer");
|
||||
}
|
||||
LoadedFont *font = GetLoadedFont(fontHandle, true);
|
||||
if (!font) {
|
||||
// The PSP crashes, but we assume it'd work like sceFontGetFontInfo(), and not touch charInfo.
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "bad font");
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "bad font");
|
||||
}
|
||||
|
||||
DEBUG_LOG(Log::sceFont, "sceFontGetCharInfo(%08x, %i, %08x)", fontHandle, charCode, charInfoPtr);
|
||||
@@ -1382,11 +1372,11 @@ static int sceFontGetCharInfo(u32 fontHandle, u32 charCode, u32 charInfoPtr) {
|
||||
static int sceFontGetShadowInfo(u32 fontHandle, u32 charCode, u32 charInfoPtr) {
|
||||
charCode &= 0xffff;
|
||||
if (!Memory::IsValidAddress(charInfoPtr)) {
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "bad charInfo pointer");
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "bad charInfo pointer");
|
||||
}
|
||||
LoadedFont *font = GetLoadedFont(fontHandle, true);
|
||||
if (!font) {
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "bad font");
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "bad font");
|
||||
}
|
||||
|
||||
DEBUG_LOG(Log::sceFont, "sceFontGetShadowInfo(%08x, %i, %08x)", fontHandle, charCode, charInfoPtr);
|
||||
@@ -1401,10 +1391,10 @@ static int sceFontGetCharImageRect(u32 fontHandle, u32 charCode, u32 charRectPtr
|
||||
auto charRect = PSPPointer<FontImageRect>::Create(charRectPtr);
|
||||
LoadedFont *font = GetLoadedFont(fontHandle, true);
|
||||
if (!font) {
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "bad font");
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "bad font");
|
||||
}
|
||||
if (!charRect.IsValid()) {
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "invalid rect pointer");
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "invalid rect pointer");
|
||||
}
|
||||
|
||||
PGFCharInfo charInfo;
|
||||
@@ -1419,10 +1409,10 @@ static int sceFontGetShadowImageRect(u32 fontHandle, u32 charCode, u32 charRectP
|
||||
auto charRect = PSPPointer<FontImageRect>::Create(charRectPtr);
|
||||
LoadedFont *font = GetLoadedFont(fontHandle, true);
|
||||
if (!font) {
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "bad font");
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "bad font");
|
||||
}
|
||||
if (!charRect.IsValid()) {
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "invalid rect pointer");
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "invalid rect pointer");
|
||||
}
|
||||
|
||||
PGFCharInfo charInfo;
|
||||
@@ -1436,11 +1426,11 @@ static int sceFontGetCharGlyphImage(u32 fontHandle, u32 charCode, u32 glyphImage
|
||||
charCode &= 0xffff;
|
||||
if (!Memory::IsValidAddress(glyphImagePtr)) {
|
||||
ERROR_LOG(Log::sceFont, "sceFontGetCharGlyphImage(%x, %x, %x): bad glyphImage pointer", fontHandle, charCode, glyphImagePtr);
|
||||
return ERROR_FONT_INVALID_PARAMETER;
|
||||
return SCE_FONT_ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
LoadedFont *font = GetLoadedFont(fontHandle, true);
|
||||
if (!font) {
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "bad font");
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "bad font");
|
||||
}
|
||||
|
||||
auto glyph = PSPPointer<const GlyphImage>::Create(glyphImagePtr);
|
||||
@@ -1451,11 +1441,11 @@ static int sceFontGetCharGlyphImage(u32 fontHandle, u32 charCode, u32 glyphImage
|
||||
static int sceFontGetCharGlyphImage_Clip(u32 fontHandle, u32 charCode, u32 glyphImagePtr, int clipXPos, int clipYPos, int clipWidth, int clipHeight) {
|
||||
charCode &= 0xffff;
|
||||
if (!Memory::IsValidAddress(glyphImagePtr)) {
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "bad glyphImage pointer");
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "bad glyphImage pointer");
|
||||
}
|
||||
LoadedFont *font = GetLoadedFont(fontHandle, true);
|
||||
if (!font) {
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "bad font");
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "bad font");
|
||||
}
|
||||
|
||||
auto glyph = PSPPointer<const GlyphImage>::Create(glyphImagePtr);
|
||||
@@ -1468,7 +1458,7 @@ static int sceFontSetAltCharacterCode(u32 fontLibHandle, u32 charCode) {
|
||||
FontLib *fl = GetFontLib(fontLibHandle);
|
||||
if (!fl) {
|
||||
ERROR_LOG_REPORT(Log::sceFont, "sceFontSetAltCharacterCode(%08x, %08x): invalid font lib", fontLibHandle, charCode);
|
||||
return hleNoLog(ERROR_FONT_INVALID_LIBID);
|
||||
return hleNoLog(SCE_FONT_ERROR_INVALID_LIBID);
|
||||
}
|
||||
|
||||
fl->SetAltCharCode(charCode & 0xFFFF);
|
||||
@@ -1479,7 +1469,7 @@ static int sceFontFlush(u32 fontHandle) {
|
||||
LoadedFont *font = GetLoadedFont(fontHandle, true);
|
||||
if (!font) {
|
||||
ERROR_LOG_REPORT(Log::sceFont, "sceFontFlush(%08x): bad font", fontHandle);
|
||||
return hleNoLog(ERROR_FONT_INVALID_PARAMETER);
|
||||
return hleNoLog(SCE_FONT_ERROR_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
if (font->GetFontLib()) {
|
||||
@@ -1495,11 +1485,11 @@ static int sceFontGetFontList(u32 fontLibHandle, u32 fontStylePtr, int numFonts)
|
||||
FontLib *fl = GetFontLib(fontLibHandle);
|
||||
if (!fl) {
|
||||
ERROR_LOG_REPORT(Log::sceFont, "sceFontGetFontList(%08x, %08x, %i): invalid font lib", fontLibHandle, fontStylePtr, numFonts);
|
||||
return ERROR_FONT_INVALID_LIBID;
|
||||
return SCE_FONT_ERROR_INVALID_LIBID;
|
||||
}
|
||||
if (!fontStyles.IsValid()) {
|
||||
ERROR_LOG_REPORT(Log::sceFont, "sceFontGetFontList(%08x, %08x, %i): invalid style pointer", fontLibHandle, fontStylePtr, numFonts);
|
||||
return ERROR_FONT_INVALID_PARAMETER;
|
||||
return SCE_FONT_ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
DEBUG_LOG(Log::sceFont, "sceFontGetFontList(%08x, %08x, %i)", fontLibHandle, fontStylePtr, numFonts);
|
||||
@@ -1515,11 +1505,11 @@ static int sceFontGetFontList(u32 fontLibHandle, u32 fontStylePtr, int numFonts)
|
||||
static int sceFontGetNumFontList(u32 fontLibHandle, u32 errorCodePtr) {
|
||||
auto errorCode = PSPPointer<s32_le>::Create(errorCodePtr);
|
||||
if (!errorCode.IsValid()) {
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "invalid error address");
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "invalid error address");
|
||||
}
|
||||
FontLib *fl = GetFontLib(fontLibHandle);
|
||||
if (!fl) {
|
||||
*errorCode = ERROR_FONT_INVALID_LIBID;
|
||||
*errorCode = SCE_FONT_ERROR_INVALID_LIBID;
|
||||
return hleLogError(Log::sceFont, 0, "invalid font lib");
|
||||
}
|
||||
*errorCode = 0;
|
||||
@@ -1529,10 +1519,10 @@ static int sceFontGetNumFontList(u32 fontLibHandle, u32 errorCodePtr) {
|
||||
static int sceFontSetResolution(u32 fontLibHandle, float hRes, float vRes) {
|
||||
FontLib *fl = GetFontLib(fontLibHandle);
|
||||
if (!fl) {
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_LIBID, "invalid font lib");
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_LIBID, "invalid font lib");
|
||||
}
|
||||
if (hRes <= 0.0f || vRes <= 0.0f) {
|
||||
return hleLogError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "negative value in hRes %f or vRes %f", hRes, vRes);
|
||||
return hleLogError(Log::sceFont, SCE_FONT_ERROR_INVALID_PARAMETER, "negative value in hRes %f or vRes %f", hRes, vRes);
|
||||
}
|
||||
fl->SetResolution(hRes, vRes);
|
||||
return hleLogInfo(Log::sceFont, 0);
|
||||
@@ -1547,7 +1537,7 @@ static float sceFontPixelToPointH(int fontLibHandle, float fontPixelsH, u32 erro
|
||||
FontLib *fl = GetFontLib(fontLibHandle);
|
||||
if (!fl) {
|
||||
ERROR_LOG_REPORT(Log::sceFont, "sceFontPixelToPointH(%08x, %f, %08x): invalid font lib", fontLibHandle, fontPixelsH, errorCodePtr);
|
||||
*errorCode = ERROR_FONT_INVALID_LIBID;
|
||||
*errorCode = SCE_FONT_ERROR_INVALID_LIBID;
|
||||
return 0.0f;
|
||||
}
|
||||
DEBUG_LOG(Log::sceFont, "sceFontPixelToPointH(%08x, %f, %08x)", fontLibHandle, fontPixelsH, errorCodePtr);
|
||||
@@ -1564,7 +1554,7 @@ static float sceFontPixelToPointV(int fontLibHandle, float fontPixelsV, u32 erro
|
||||
FontLib *fl = GetFontLib(fontLibHandle);
|
||||
if (!fl) {
|
||||
ERROR_LOG_REPORT(Log::sceFont, "sceFontPixelToPointV(%08x, %f, %08x): invalid font lib", fontLibHandle, fontPixelsV, errorCodePtr);
|
||||
*errorCode = ERROR_FONT_INVALID_LIBID;
|
||||
*errorCode = SCE_FONT_ERROR_INVALID_LIBID;
|
||||
return 0.0f;
|
||||
}
|
||||
DEBUG_LOG(Log::sceFont, "sceFontPixelToPointV(%08x, %f, %08x)", fontLibHandle, fontPixelsV, errorCodePtr);
|
||||
@@ -1581,7 +1571,7 @@ static float sceFontPointToPixelH(int fontLibHandle, float fontPointsH, u32 erro
|
||||
FontLib *fl = GetFontLib(fontLibHandle);
|
||||
if (!fl) {
|
||||
ERROR_LOG_REPORT(Log::sceFont, "sceFontPointToPixelH(%08x, %f, %08x): invalid font lib", fontLibHandle, fontPointsH, errorCodePtr);
|
||||
*errorCode = ERROR_FONT_INVALID_LIBID;
|
||||
*errorCode = SCE_FONT_ERROR_INVALID_LIBID;
|
||||
return 0.0f;
|
||||
}
|
||||
DEBUG_LOG(Log::sceFont, "sceFontPointToPixelH(%08x, %f, %08x)", fontLibHandle, fontPointsH, errorCodePtr);
|
||||
@@ -1598,7 +1588,7 @@ static float sceFontPointToPixelV(int fontLibHandle, float fontPointsV, u32 erro
|
||||
FontLib *fl = GetFontLib(fontLibHandle);
|
||||
if (!fl) {
|
||||
ERROR_LOG_REPORT(Log::sceFont, "sceFontPointToPixelV(%08x, %f, %08x): invalid font lib", fontLibHandle, fontPointsV, errorCodePtr);
|
||||
*errorCode = ERROR_FONT_INVALID_LIBID;
|
||||
*errorCode = SCE_FONT_ERROR_INVALID_LIBID;
|
||||
return 0.0f;
|
||||
}
|
||||
DEBUG_LOG(Log::sceFont, "sceFontPointToPixelV(%08x, %f, %08x)", fontLibHandle, fontPointsV, errorCodePtr);
|
||||
@@ -1615,12 +1605,12 @@ static int sceFontGetShadowGlyphImage(u32 fontHandle, u32 charCode, u32 glyphIma
|
||||
charCode &= 0xffff;
|
||||
if (!Memory::IsValidAddress(glyphImagePtr)) {
|
||||
ERROR_LOG(Log::sceFont, "sceFontGetShadowGlyphImage(%x, %x, %x): bad glyphImage pointer", fontHandle, charCode, glyphImagePtr);
|
||||
return hleNoLog(ERROR_FONT_INVALID_PARAMETER);
|
||||
return hleNoLog(SCE_FONT_ERROR_INVALID_PARAMETER);
|
||||
}
|
||||
LoadedFont *font = GetLoadedFont(fontHandle, true);
|
||||
if (!font) {
|
||||
ERROR_LOG_REPORT(Log::sceFont, "sceFontGetShadowGlyphImage(%x, %x, %x): bad font", fontHandle, charCode, glyphImagePtr);
|
||||
return hleNoLog(ERROR_FONT_INVALID_PARAMETER);
|
||||
return hleNoLog(SCE_FONT_ERROR_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
auto glyph = PSPPointer<const GlyphImage>::Create(glyphImagePtr);
|
||||
@@ -1632,12 +1622,12 @@ static int sceFontGetShadowGlyphImage_Clip(u32 fontHandle, u32 charCode, u32 gly
|
||||
charCode &= 0xffff;
|
||||
if (!Memory::IsValidAddress(glyphImagePtr)) {
|
||||
ERROR_LOG(Log::sceFont, "sceFontGetShadowGlyphImage_Clip(%08x, %i, %08x, %i, %i, %i, %i): bad glyphImage pointer", fontHandle, charCode, glyphImagePtr, clipXPos, clipYPos, clipWidth, clipHeight);
|
||||
return hleNoLog(ERROR_FONT_INVALID_PARAMETER);
|
||||
return hleNoLog(SCE_FONT_ERROR_INVALID_PARAMETER);
|
||||
}
|
||||
LoadedFont *font = GetLoadedFont(fontHandle, true);
|
||||
if (!font) {
|
||||
ERROR_LOG_REPORT(Log::sceFont, "sceFontGetShadowGlyphImage_Clip(%08x, %i, %08x, %i, %i, %i, %i): bad font", fontHandle, charCode, glyphImagePtr, clipXPos, clipYPos, clipWidth, clipHeight);
|
||||
return hleNoLog(ERROR_FONT_INVALID_PARAMETER);
|
||||
return hleNoLog(SCE_FONT_ERROR_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
auto glyph = PSPPointer<const GlyphImage>::Create(glyphImagePtr);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "Common/Serialize/SerializeMap.h"
|
||||
#include "Common/Data/Collections/ThreadSafeList.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/CoreParameter.h"
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/sceKernelMemory.h"
|
||||
#include "Core/HLE/sceHeap.h"
|
||||
|
||||
+29
-39
@@ -23,6 +23,7 @@
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Core/Debugger/MemBlockInfo.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/sceJpeg.h"
|
||||
#include "Core/HLE/sceKernel.h"
|
||||
@@ -56,17 +57,6 @@ void __JpegInit() {
|
||||
mjpegHeight = 0;
|
||||
}
|
||||
|
||||
enum : uint32_t {
|
||||
ERROR_JPEG_INVALID_DATA = 0x80650004,
|
||||
ERROR_JPEG_INVALID_COLORSPACE = 0x80650013,
|
||||
ERROR_JPEG_INVALID_SIZE = 0x80650020,
|
||||
ERROR_JPEG_NO_SOI = 0x80650023,
|
||||
ERROR_JPEG_INVALID_STATE = 0x80650039,
|
||||
ERROR_JPEG_OUT_OF_MEMORY = 0x80650041,
|
||||
ERROR_JPEG_ALREADY_INIT = 0x80650042,
|
||||
ERROR_JPEG_INVALID_VALUE = 0x80650051,
|
||||
};
|
||||
|
||||
void __JpegDoState(PointerWrap &p) {
|
||||
auto s = p.Section("sceJpeg", 1, 2);
|
||||
if (!s)
|
||||
@@ -112,7 +102,7 @@ static u32 convertYCbCrToABGR(int y, int cb, int cr) {
|
||||
|
||||
static int JpegCsc(u32 imageAddr, u32 yCbCrAddr, int widthHeight, int bufferWidth, uint32_t chroma, int &usec) {
|
||||
if ((chroma & 0x000FFFFF) != 0x00020202 && (chroma & 0x000FFFFF) != 0x00020201 && (chroma & 0x000FFFFF) != 0x00020101)
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_COLORSPACE, "invalid colorspace");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_COLORSPACE, "invalid colorspace");
|
||||
if (bufferWidth < 0)
|
||||
bufferWidth = 0;
|
||||
|
||||
@@ -128,9 +118,9 @@ static int JpegCsc(u32 imageAddr, u32 yCbCrAddr, int widthHeight, int bufferWidt
|
||||
|
||||
uint64_t destSize = ((uint64_t)bufferWidth * (height - 1) + width) * 4;
|
||||
if (destSize > 0x3FFFFFFF || !Memory::IsValidRange(imageAddr, (uint32_t)destSize))
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_VALUE, "invalid dest address or size");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_VALUE, "invalid dest address or size");
|
||||
if (sizeY > 0x3FFFFFFF || !Memory::IsValidRange(yCbCrAddr, sizeY + sizeCb + sizeCb))
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_VALUE, "invalid src address or size");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_VALUE, "invalid src address or size");
|
||||
|
||||
u32_le *imageBuffer = (u32_le *)Memory::GetPointerWriteUnchecked(imageAddr);
|
||||
const u8 *Y = (const u8 *)Memory::GetPointerUnchecked(yCbCrAddr);
|
||||
@@ -188,9 +178,9 @@ static int JpegMJpegCsc(u32 imageAddr, u32 yCbCrAddr, int widthHeight, int buffe
|
||||
int sizeCb = sizeY >> 2;
|
||||
|
||||
if (width > 720 || height > 480)
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_SIZE, "invalid size, max 720x480");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_SIZE, "invalid size, max 720x480");
|
||||
if (bufferWidth > 1024)
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_SIZE, "invalid stride, max 1024");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_SIZE, "invalid stride, max 1024");
|
||||
uint32_t destSize = (bufferWidth * (height - 1) + width) * 4;
|
||||
if (!Memory::IsValidRange(imageAddr, destSize))
|
||||
return hleLogError(Log::ME, SCE_KERNEL_ERROR_INVALID_POINTER, "invalid dest address or size");
|
||||
@@ -271,15 +261,15 @@ static u32 convertARGBtoABGR(u32 argb) {
|
||||
|
||||
static int DecodeJpeg(u32 jpegAddr, int jpegSize, u32 imageAddr, int &usec) {
|
||||
if (!Memory::IsValidRange(jpegAddr, jpegSize))
|
||||
return hleLogError(Log::ME, ERROR_JPEG_NO_SOI, "invalid jpeg address");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_NO_SOI, "invalid jpeg address");
|
||||
if (jpegSize == 0)
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_DATA, "invalid jpeg data");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_DATA, "invalid jpeg data");
|
||||
|
||||
NotifyMemInfo(MemBlockFlags::READ, jpegAddr, jpegSize, "JpegDecodeMJpeg");
|
||||
|
||||
const u8 *buf = Memory::GetPointerUnchecked(jpegAddr);
|
||||
if (jpegSize < 2 || buf[0] != 0xFF || buf[1] != 0xD8)
|
||||
return hleLogError(Log::ME, ERROR_JPEG_NO_SOI, "no SOI found, invalid data");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_NO_SOI, "no SOI found, invalid data");
|
||||
|
||||
int width, height, actual_components;
|
||||
unsigned char *jpegBuf = jpgd::decompress_jpeg_image_from_memory(buf, jpegSize, &width, &height, &actual_components, 3);
|
||||
@@ -292,7 +282,7 @@ static int DecodeJpeg(u32 jpegAddr, int jpegSize, u32 imageAddr, int &usec) {
|
||||
}
|
||||
|
||||
if (jpegBuf == nullptr) {
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_DATA, "unable to decompress jpeg");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_DATA, "unable to decompress jpeg");
|
||||
}
|
||||
|
||||
usec += (width * height) / 14;
|
||||
@@ -304,7 +294,7 @@ static int DecodeJpeg(u32 jpegAddr, int jpegSize, u32 imageAddr, int &usec) {
|
||||
// Note: even if you Delete, the size is still allowed.
|
||||
if (width > mjpegWidth || height > mjpegHeight) {
|
||||
free(jpegBuf);
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_SIZE, "invalid output address");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_SIZE, "invalid output address");
|
||||
}
|
||||
if (mjpegInited == 0) {
|
||||
// If you finish after setting the size, then call this - you get an interesting error.
|
||||
@@ -368,15 +358,15 @@ static int getYCbCrBufferSize(int w, int h) {
|
||||
|
||||
static int JpegGetOutputInfo(u32 jpegAddr, int jpegSize, u32 colourInfoAddr) {
|
||||
if (!Memory::IsValidRange(jpegAddr, jpegSize))
|
||||
return hleLogError(Log::ME, ERROR_JPEG_NO_SOI, "invalid jpeg address");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_NO_SOI, "invalid jpeg address");
|
||||
if (jpegSize == 0)
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_DATA, "invalid jpeg data");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_DATA, "invalid jpeg data");
|
||||
|
||||
NotifyMemInfo(MemBlockFlags::READ, jpegAddr, jpegSize, "JpegGetOutputInfo");
|
||||
|
||||
const u8 *buf = Memory::GetPointerUnchecked(jpegAddr);
|
||||
if (jpegSize < 2 || buf[0] != 0xFF || buf[1] != 0xD8)
|
||||
return hleLogError(Log::ME, ERROR_JPEG_NO_SOI, "no SOI found, invalid data");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_NO_SOI, "no SOI found, invalid data");
|
||||
|
||||
int width, height, actual_components;
|
||||
unsigned char *jpegBuf = jpgd::decompress_jpeg_image_from_memory(buf, jpegSize, &width, &height, &actual_components, 3);
|
||||
@@ -389,7 +379,7 @@ static int JpegGetOutputInfo(u32 jpegAddr, int jpegSize, u32 colourInfoAddr) {
|
||||
}
|
||||
|
||||
if (jpegBuf == nullptr) {
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_DATA, "unable to decompress jpeg");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_DATA, "unable to decompress jpeg");
|
||||
}
|
||||
|
||||
free(jpegBuf);
|
||||
@@ -506,15 +496,15 @@ static int JpegConvertRGBToYCbCr(const void *data, u8 *output, int width, int he
|
||||
|
||||
static int JpegDecodeMJpegYCbCr(u32 jpegAddr, int jpegSize, u32 yCbCrAddr, int yCbCrSize, int &usec) {
|
||||
if (!Memory::IsValidRange(jpegAddr, jpegSize))
|
||||
return hleLogError(Log::ME, ERROR_JPEG_NO_SOI, "invalid jpeg address");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_NO_SOI, "invalid jpeg address");
|
||||
if (jpegSize == 0)
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_DATA, "invalid jpeg data");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_DATA, "invalid jpeg data");
|
||||
|
||||
NotifyMemInfo(MemBlockFlags::READ, jpegAddr, jpegSize, "JpegDecodeMJpegYCbCr");
|
||||
|
||||
const u8 *buf = Memory::GetPointerUnchecked(jpegAddr);
|
||||
if (jpegSize < 2 || buf[0] != 0xFF || buf[1] != 0xD8)
|
||||
return hleLogError(Log::ME, ERROR_JPEG_NO_SOI, "no SOI found, invalid data");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_NO_SOI, "no SOI found, invalid data");
|
||||
|
||||
int width, height, actual_components;
|
||||
unsigned char *jpegBuf = jpgd::decompress_jpeg_image_from_memory(buf, jpegSize, &width, &height, &actual_components, 3);
|
||||
@@ -527,12 +517,12 @@ static int JpegDecodeMJpegYCbCr(u32 jpegAddr, int jpegSize, u32 yCbCrAddr, int y
|
||||
}
|
||||
|
||||
if (jpegBuf == nullptr) {
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_DATA, "unable to decompress jpeg");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_DATA, "unable to decompress jpeg");
|
||||
}
|
||||
|
||||
if (yCbCrSize < getYCbCrBufferSize(width, height)) {
|
||||
free(jpegBuf);
|
||||
return hleLogError(Log::ME, ERROR_JPEG_OUT_OF_MEMORY, "buffer not large enough");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_OUT_OF_MEMORY, "buffer not large enough");
|
||||
}
|
||||
|
||||
// Technically, it seems like the PSP doesn't support grayscale, but we might as well.
|
||||
@@ -559,7 +549,7 @@ static int sceJpegDecodeMJpegYCbCr(u32 jpegAddr, int jpegSize, u32 yCbCrAddr, in
|
||||
if ((yCbCrAddr | yCbCrSize | (yCbCrAddr + yCbCrSize)) & 0x80000000)
|
||||
return hleLogError(Log::ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid output address");
|
||||
if (!Memory::IsValidRange(jpegAddr, jpegSize))
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_VALUE, "invalid jpeg address");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_VALUE, "invalid jpeg address");
|
||||
|
||||
int usec = 300;
|
||||
int result = JpegDecodeMJpegYCbCr(jpegAddr, jpegSize, yCbCrAddr, yCbCrSize, usec);
|
||||
@@ -585,11 +575,11 @@ static int sceJpeg_9B36444C() {
|
||||
|
||||
static int sceJpegCreateMJpeg(int width, int height) {
|
||||
if (mjpegInited == 0)
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_STATE, "not yet inited");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_STATE, "not yet inited");
|
||||
if (mjpegInited == 2)
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_STATE, "already created");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_STATE, "already created");
|
||||
if (width > 1024)
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_SIZE, "width outside bounds");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_SIZE, "width outside bounds");
|
||||
|
||||
mjpegInited = 2;
|
||||
mjpegWidth = width;
|
||||
@@ -600,9 +590,9 @@ static int sceJpegCreateMJpeg(int width, int height) {
|
||||
|
||||
static int sceJpegDeleteMJpeg() {
|
||||
if (mjpegInited == 0)
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_STATE, "not yet inited");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_STATE, "not yet inited");
|
||||
if (mjpegInited == 1)
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_STATE, "not yet created");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_STATE, "not yet created");
|
||||
|
||||
mjpegInited = 1;
|
||||
return hleLogInfo(Log::ME, 0);
|
||||
@@ -610,7 +600,7 @@ static int sceJpegDeleteMJpeg() {
|
||||
|
||||
static int sceJpegInitMJpeg() {
|
||||
if (mjpegInited == 1 || mjpegInited == 2)
|
||||
return hleLogError(Log::ME, ERROR_JPEG_ALREADY_INIT, "already inited");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_ALREADY_INIT, "already inited");
|
||||
|
||||
// If it was -1, it's from an old save state, avoid double init error but assume inited.
|
||||
if (mjpegInited == 0)
|
||||
@@ -620,9 +610,9 @@ static int sceJpegInitMJpeg() {
|
||||
|
||||
static int sceJpegFinishMJpeg() {
|
||||
if (mjpegInited == 0)
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_STATE, "already inited");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_STATE, "already inited");
|
||||
if (mjpegInited == 2)
|
||||
return hleLogError(Log::ME, ERROR_JPEG_INVALID_STATE, "mjpeg not deleted");
|
||||
return hleLogError(Log::ME, SCE_JPEG_ERROR_INVALID_STATE, "mjpeg not deleted");
|
||||
|
||||
// Even from an old save state, if we see this we leave compat mode.
|
||||
mjpegInited = 0;
|
||||
|
||||
+52
-12
@@ -25,6 +25,7 @@
|
||||
#include "Core/MemMapHelpers.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/MIPS/MIPSCodeUtils.h"
|
||||
#include "Core/MIPS/MIPSInt.h"
|
||||
@@ -1239,19 +1240,7 @@ const char *KernelErrorToString(u32 err) {
|
||||
case 0x800201c0: return "ILLEGAL_KTLSID";
|
||||
case 0x800201c1: return "KTLS_FULL";
|
||||
case 0x800201c2: return "KTLS_BUSY";
|
||||
case 0x800201c3: return "MUTEX_NOT_FOUND";
|
||||
case 0x800201c4: return "MUTEX_LOCKED";
|
||||
case 0x800201c5: return "MUTEX_UNLOCKED";
|
||||
case 0x800201c6: return "MUTEX_LOCK_OVERFLOW";
|
||||
case 0x800201c7: return "MUTEX_UNLOCK_UNDERFLOW";
|
||||
case 0x800201c8: return "MUTEX_RECURSIVE_NOT_ALLOWED";
|
||||
case 0x800201c9: return "MESSAGEBOX_DUPLICATE_MESSAGE";
|
||||
case 0x800201ca: return "LWMUTEX_NOT_FOUND";
|
||||
case 0x800201cb: return "LWMUTEX_LOCKED";
|
||||
case 0x800201cc: return "LWMUTEX_UNLOCKED";
|
||||
case 0x800201cd: return "LWMUTEX_LOCK_OVERFLOW";
|
||||
case 0x800201ce: return "LWMUTEX_UNLOCK_UNDERFLOW";
|
||||
case 0x800201cf: return "LWMUTEX_RECURSIVE_NOT_ALLOWED";
|
||||
case SCE_KERNEL_ERROR_UNKNOWN_TLSPL_ID: return "UNKNOWN_TLSPL_ID";
|
||||
case SCE_KERNEL_ERROR_TOO_MANY_TLSPL: return "TOO_MANY_TLSPL";
|
||||
case SCE_KERNEL_ERROR_TLSPL_IN_USE: return "TLSPL_IN_USE";
|
||||
@@ -1427,6 +1416,57 @@ 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";
|
||||
|
||||
case SCE_PSMF_ERROR_NOT_INITIALIZED: return "SCE_PSMF_ERROR_NOT_INITIALIZED";
|
||||
case SCE_PSMF_ERROR_BAD_VERSION: return "SCE_PSMF_ERROR_BAD_VERSION";
|
||||
case SCE_PSMF_ERROR_NOT_FOUND: return "SCE_PSMF_ERROR_NOT_FOUND";
|
||||
case SCE_PSMF_ERROR_INVALID_ID: return "SCE_PSMF_ERROR_INVALID_ID";
|
||||
case SCE_PSMF_ERROR_INVALID_VALUE: return "SCE_PSMF_ERROR_INVALID_VALUE";
|
||||
case SCE_PSMF_ERROR_INVALID_TIMESTAMP: return "SCE_PSMF_ERROR_INVALID_TIMESTAMP";
|
||||
case SCE_PSMF_ERROR_INVALID_PSMF: return "SCE_PSMF_ERROR_INVALID_PSMF";
|
||||
|
||||
case SCE_PSMFPLAYER_ERROR_INVALID_STATUS: return "SCE_PSMFPLAYER_ERROR_INVALID_STATUS";
|
||||
case SCE_PSMFPLAYER_ERROR_INVALID_STREAM: return "SCE_PSMFPLAYER_ERROR_INVALID_STREAM";
|
||||
case SCE_PSMFPLAYER_ERROR_BUFFER_SIZE: return "SCE_PSMFPLAYER_ERROR_BUFFER_SIZE";
|
||||
case SCE_PSMFPLAYER_ERROR_INVALID_CONFIG: return "SCE_PSMFPLAYER_ERROR_INVALID_CONFIG";
|
||||
case SCE_PSMFPLAYER_ERROR_INVALID_PARAM: return "SCE_PSMFPLAYER_ERROR_INVALID_PARAM";
|
||||
case SCE_PSMFPLAYER_ERROR_NO_MORE_DATA: return "SCE_PSMFPLAYER_ERROR_NO_MORE_DATA";
|
||||
|
||||
case SCE_FONT_ERROR_OUT_OF_MEMORY: return "SCE_FONT_ERROR_OUT_OF_MEMORY";
|
||||
case SCE_FONT_ERROR_INVALID_LIBID: return "SCE_FONT_ERROR_INVALID_LIBID";
|
||||
case SCE_FONT_ERROR_INVALID_PARAMETER: return "SCE_FONT_ERROR_INVALID_PARAMETER";
|
||||
case SCE_FONT_ERROR_HANDLER_OPEN_FAILED: return "SCE_FONT_ERROR_HANDLER_OPEN_FAILED";
|
||||
case SCE_FONT_ERROR_TOO_MANY_OPEN_FONTS: return "SCE_FONT_ERROR_TOO_MANY_OPEN_FONTS";
|
||||
case SCE_FONT_ERROR_INVALID_FONT_DATA: return "SCE_FONT_ERROR_INVALID_FONT_DATA";
|
||||
|
||||
case SCE_MUTEX_ERROR_NO_SUCH_MUTEX: return "SCE_MUTEX_ERROR_NO_SUCH_MUTEX";
|
||||
case SCE_MUTEX_ERROR_TRYLOCK_FAILED: return "SCE_MUTEX_ERROR_TRYLOCK_FAILED";
|
||||
case SCE_MUTEX_ERROR_NOT_LOCKED: return "SCE_MUTEX_ERROR_NOT_LOCKED";
|
||||
case SCE_MUTEX_ERROR_LOCK_OVERFLOW: return "SCE_MUTEX_ERROR_LOCK_OVERFLOW";
|
||||
case SCE_MUTEX_ERROR_UNLOCK_UNDERFLOW: return "SCE_MUTEX_ERROR_UNLOCK_UNDERFLOW";
|
||||
case SCE_MUTEX_ERROR_ALREADY_LOCKED: return "SCE_MUTEX_ERROR_ALREADY_LOCKED";
|
||||
|
||||
case SCE_LWMUTEX_ERROR_NO_SUCH_LWMUTEX: return "SCE_LWMUTEX_ERROR_NO_SUCH_LWMUTEX";
|
||||
case SCE_LWMUTEX_ERROR_TRYLOCK_FAILED: return "SCE_LWMUTEX_ERROR_TRYLOCK_FAILED";
|
||||
case SCE_LWMUTEX_ERROR_NOT_LOCKED: return "SCE_LWMUTEX_ERROR_NOT_LOCKED";
|
||||
case SCE_LWMUTEX_ERROR_LOCK_OVERFLOW: return "SCE_LWMUTEX_ERROR_LOCK_OVERFLOW";
|
||||
case SCE_LWMUTEX_ERROR_UNLOCK_UNDERFLOW: return "SCE_LWMUTEX_ERROR_UNLOCK_UNDERFLOW";
|
||||
case SCE_LWMUTEX_ERROR_ALREADY_LOCKED: return "SCE_LWMUTEX_ERROR_ALREADY_LOCKED";
|
||||
|
||||
case SCE_SSL_ERROR_NOT_INIT: return "SCE_SSL_ERROR_NOT_INIT";
|
||||
case SCE_SSL_ERROR_ALREADY_INIT: return "SCE_SSL_ERROR_ALREADY_INIT";
|
||||
case SCE_SSL_ERROR_OUT_OF_MEMORY: return "SCE_SSL_ERROR_OUT_OF_MEMORY";
|
||||
case SCE_SSL_ERROR_INVALID_PARAMETER: return "SCE_SSL_ERROR_INVALID_PARAMETER";
|
||||
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
#include "Common/Log.h"
|
||||
#include "Common/Swap.h"
|
||||
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
|
||||
class PointerWrap;
|
||||
|
||||
// If you add to this, make sure to check KernelObjectPool::CreateByIDType().
|
||||
@@ -193,7 +191,7 @@ public:
|
||||
outError = T::GetMissingErrorCode();
|
||||
return nullptr;
|
||||
}
|
||||
outError = SCE_KERNEL_ERROR_OK;
|
||||
outError = 0; // SCE_KERNEL_ERROR_OK but don't want to include the header here.
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "Core/HLE/sceKernelAlarm.h"
|
||||
#include "Core/HLE/sceKernelInterrupt.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/MemMap.h"
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Common/Serialize/SerializeMap.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/MemMapHelpers.h"
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/sceKernel.h"
|
||||
#include "Core/HLE/sceKernelHeap.h"
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
|
||||
#include "Core/Debugger/MemBlockInfo.h"
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "Core/HLE/sceKernelThread.h"
|
||||
#include "Core/HLE/sceKernelMbx.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/MemMapHelpers.h"
|
||||
#include "Core/Reporting.h"
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/Debugger/MemBlockInfo.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/MemMapHelpers.h"
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/MemMapHelpers.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/sceKernel.h"
|
||||
#include "Core/HLE/sceKernelMsgPipe.h"
|
||||
#include "Core/HLE/sceKernelMemory.h"
|
||||
|
||||
+18
-33
@@ -23,6 +23,7 @@
|
||||
#include "Common/Serialize/SerializeMap.h"
|
||||
#include "Core/MemMapHelpers.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/Reporting.h"
|
||||
@@ -36,22 +37,6 @@
|
||||
#define PSP_MUTEX_ATTR_ALLOW_RECURSIVE 0x200
|
||||
#define PSP_MUTEX_ATTR_KNOWN (PSP_MUTEX_ATTR_PRIORITY | PSP_MUTEX_ATTR_ALLOW_RECURSIVE)
|
||||
|
||||
// Not sure about the names of these
|
||||
#define PSP_MUTEX_ERROR_NO_SUCH_MUTEX 0x800201C3
|
||||
#define PSP_MUTEX_ERROR_TRYLOCK_FAILED 0x800201C4
|
||||
#define PSP_MUTEX_ERROR_NOT_LOCKED 0x800201C5
|
||||
#define PSP_MUTEX_ERROR_LOCK_OVERFLOW 0x800201C6
|
||||
#define PSP_MUTEX_ERROR_UNLOCK_UNDERFLOW 0x800201C7
|
||||
#define PSP_MUTEX_ERROR_ALREADY_LOCKED 0x800201C8
|
||||
|
||||
#define PSP_LWMUTEX_ERROR_NO_SUCH_LWMUTEX 0x800201CA
|
||||
// Note: used only for _600.
|
||||
#define PSP_LWMUTEX_ERROR_TRYLOCK_FAILED 0x800201CB
|
||||
#define PSP_LWMUTEX_ERROR_NOT_LOCKED 0x800201CC
|
||||
#define PSP_LWMUTEX_ERROR_LOCK_OVERFLOW 0x800201CD
|
||||
#define PSP_LWMUTEX_ERROR_UNLOCK_UNDERFLOW 0x800201CE
|
||||
#define PSP_LWMUTEX_ERROR_ALREADY_LOCKED 0x800201CF
|
||||
|
||||
struct NativeMutex
|
||||
{
|
||||
SceSize_le size;
|
||||
@@ -69,7 +54,7 @@ struct PSPMutex : public KernelObject
|
||||
const char *GetName() override { return nm.name; }
|
||||
const char *GetTypeName() override { return GetStaticTypeName(); }
|
||||
static const char *GetStaticTypeName() { return "Mutex"; }
|
||||
static u32 GetMissingErrorCode() { return PSP_MUTEX_ERROR_NO_SUCH_MUTEX; }
|
||||
static u32 GetMissingErrorCode() { return SCE_MUTEX_ERROR_NO_SUCH_MUTEX; }
|
||||
static int GetStaticIDType() { return SCE_KERNEL_TMID_Mutex; }
|
||||
int GetIDType() const override { return SCE_KERNEL_TMID_Mutex; }
|
||||
|
||||
@@ -135,7 +120,7 @@ struct LwMutex : public KernelObject
|
||||
const char *GetName() override { return nm.name; }
|
||||
const char *GetTypeName() override { return GetStaticTypeName(); }
|
||||
static const char *GetStaticTypeName() { return "LwMutex"; }
|
||||
static u32 GetMissingErrorCode() { return PSP_LWMUTEX_ERROR_NO_SUCH_LWMUTEX; }
|
||||
static u32 GetMissingErrorCode() { return SCE_LWMUTEX_ERROR_NO_SUCH_LWMUTEX; }
|
||||
static int GetStaticIDType() { return SCE_KERNEL_TMID_LwMutex; }
|
||||
int GetIDType() const override { return SCE_KERNEL_TMID_LwMutex; }
|
||||
|
||||
@@ -378,14 +363,14 @@ static bool __KernelLockMutexCheck(PSPMutex *mutex, int count, u32 &error) {
|
||||
error = SCE_KERNEL_ERROR_ILLEGAL_COUNT;
|
||||
// Two positive ints will always overflow to negative.
|
||||
else if (count + mutex->nm.lockLevel < 0)
|
||||
error = PSP_MUTEX_ERROR_LOCK_OVERFLOW;
|
||||
error = SCE_MUTEX_ERROR_LOCK_OVERFLOW;
|
||||
// Only a recursive mutex can re-lock.
|
||||
else if (mutex->nm.lockThread == __KernelGetCurThread())
|
||||
{
|
||||
if (mutexIsRecursive)
|
||||
return true;
|
||||
|
||||
error = PSP_MUTEX_ERROR_ALREADY_LOCKED;
|
||||
error = SCE_MUTEX_ERROR_ALREADY_LOCKED;
|
||||
}
|
||||
// Otherwise it would lock or wait.
|
||||
else if (mutex->nm.lockLevel == 0)
|
||||
@@ -499,7 +484,7 @@ int sceKernelCancelMutex(SceUID uid, int count, u32 numWaitThreadsPtr)
|
||||
if (!lockable)
|
||||
{
|
||||
// May still be okay. As long as the count/etc. are valid.
|
||||
if (error != 0 && error != PSP_MUTEX_ERROR_LOCK_OVERFLOW && error != PSP_MUTEX_ERROR_ALREADY_LOCKED) {
|
||||
if (error != 0 && error != SCE_MUTEX_ERROR_LOCK_OVERFLOW && error != SCE_MUTEX_ERROR_ALREADY_LOCKED) {
|
||||
return hleLogWarning(Log::sceKernel, error, "invalid count");
|
||||
}
|
||||
}
|
||||
@@ -607,7 +592,7 @@ int sceKernelTryLockMutex(SceUID id, int count) {
|
||||
else if (error)
|
||||
return hleLogError(Log::sceKernel, error);
|
||||
else
|
||||
return hleLogDebug(Log::sceKernel, PSP_MUTEX_ERROR_TRYLOCK_FAILED);
|
||||
return hleLogDebug(Log::sceKernel, SCE_MUTEX_ERROR_TRYLOCK_FAILED);
|
||||
}
|
||||
|
||||
// int sceKernelUnlockMutex(SceUID id, int count)
|
||||
@@ -623,9 +608,9 @@ int sceKernelUnlockMutex(SceUID id, int count)
|
||||
if ((mutex->nm.attr & PSP_MUTEX_ATTR_ALLOW_RECURSIVE) == 0 && count > 1)
|
||||
return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_COUNT);
|
||||
if (mutex->nm.lockLevel == 0 || mutex->nm.lockThread != __KernelGetCurThread())
|
||||
return hleLogDebug(Log::sceKernel, PSP_MUTEX_ERROR_NOT_LOCKED);
|
||||
return hleLogDebug(Log::sceKernel, SCE_MUTEX_ERROR_NOT_LOCKED);
|
||||
if (mutex->nm.lockLevel < count)
|
||||
return hleLogWarning(Log::sceKernel, PSP_MUTEX_ERROR_UNLOCK_UNDERFLOW);
|
||||
return hleLogWarning(Log::sceKernel, SCE_MUTEX_ERROR_UNLOCK_UNDERFLOW);
|
||||
|
||||
// To log before the reschedule.
|
||||
DEBUG_LOG(Log::sceKernel, "0=sceKernelUnlockMutex(%i, %i)", id, count);
|
||||
@@ -772,9 +757,9 @@ static bool __KernelLockLwMutex(NativeLwMutexWorkarea *workarea, int count, u32
|
||||
error = SCE_KERNEL_ERROR_ILLEGAL_COUNT;
|
||||
// Two positive ints will always overflow to negative.
|
||||
else if (count + workarea->lockLevel < 0)
|
||||
error = PSP_LWMUTEX_ERROR_LOCK_OVERFLOW;
|
||||
error = SCE_LWMUTEX_ERROR_LOCK_OVERFLOW;
|
||||
else if (workarea->uid == -1)
|
||||
error = PSP_LWMUTEX_ERROR_NO_SUCH_LWMUTEX;
|
||||
error = SCE_LWMUTEX_ERROR_NO_SUCH_LWMUTEX;
|
||||
}
|
||||
|
||||
if (error)
|
||||
@@ -805,7 +790,7 @@ static bool __KernelLockLwMutex(NativeLwMutexWorkarea *workarea, int count, u32
|
||||
}
|
||||
else
|
||||
{
|
||||
error = PSP_LWMUTEX_ERROR_ALREADY_LOCKED;
|
||||
error = SCE_LWMUTEX_ERROR_ALREADY_LOCKED;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -902,9 +887,9 @@ int sceKernelTryLockLwMutex(u32 workareaPtr, int count)
|
||||
return hleLogDebug(Log::sceKernel, 0);
|
||||
else if (error)
|
||||
// Unlike sceKernelTryLockLwMutex_600, this always returns the same error.
|
||||
return hleLogDebug(Log::sceKernel, PSP_MUTEX_ERROR_TRYLOCK_FAILED);
|
||||
return hleLogDebug(Log::sceKernel, SCE_MUTEX_ERROR_TRYLOCK_FAILED);
|
||||
else
|
||||
return hleLogDebug(Log::sceKernel, PSP_MUTEX_ERROR_TRYLOCK_FAILED);
|
||||
return hleLogDebug(Log::sceKernel, SCE_MUTEX_ERROR_TRYLOCK_FAILED);
|
||||
}
|
||||
|
||||
int sceKernelTryLockLwMutex_600(u32 workareaPtr, int count)
|
||||
@@ -922,7 +907,7 @@ int sceKernelTryLockLwMutex_600(u32 workareaPtr, int count)
|
||||
else if (error)
|
||||
return hleLogDebug(Log::sceKernel, error);
|
||||
else
|
||||
return hleLogDebug(Log::sceKernel, PSP_LWMUTEX_ERROR_TRYLOCK_FAILED);
|
||||
return hleLogDebug(Log::sceKernel, SCE_LWMUTEX_ERROR_TRYLOCK_FAILED);
|
||||
}
|
||||
|
||||
int sceKernelLockLwMutex(u32 workareaPtr, int count, u32 timeoutPtr)
|
||||
@@ -1003,15 +988,15 @@ int sceKernelUnlockLwMutex(u32 workareaPtr, int count)
|
||||
hleEatCycles(28);
|
||||
|
||||
if (workarea->uid == -1)
|
||||
return hleLogError(Log::sceKernel, PSP_LWMUTEX_ERROR_NO_SUCH_LWMUTEX);
|
||||
return hleLogError(Log::sceKernel, SCE_LWMUTEX_ERROR_NO_SUCH_LWMUTEX);
|
||||
else if (count <= 0)
|
||||
return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_COUNT);
|
||||
else if ((workarea->attr & PSP_MUTEX_ATTR_ALLOW_RECURSIVE) == 0 && count > 1)
|
||||
return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_COUNT);
|
||||
else if (workarea->lockLevel == 0 || workarea->lockThread != __KernelGetCurThread())
|
||||
return hleLogDebug(Log::sceKernel, PSP_LWMUTEX_ERROR_NOT_LOCKED);
|
||||
return hleLogDebug(Log::sceKernel, SCE_LWMUTEX_ERROR_NOT_LOCKED);
|
||||
else if (workarea->lockLevel < count)
|
||||
return hleLogDebug(Log::sceKernel, PSP_LWMUTEX_ERROR_UNLOCK_UNDERFLOW);
|
||||
return hleLogDebug(Log::sceKernel, SCE_LWMUTEX_ERROR_UNLOCK_UNDERFLOW);
|
||||
|
||||
VERBOSE_LOG(Log::sceKernel, "sceKernelUnlockLwMutex(%08x, %i)", workareaPtr, count);
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Common/Serialize/SerializeMap.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/MemMapHelpers.h"
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "Common/Serialize/SerializeList.h"
|
||||
#include "Common/Serialize/SerializeMap.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/HLETables.h"
|
||||
#include "Core/MIPS/MIPSAnalyst.h"
|
||||
#include "Core/MIPS/MIPSCodeUtils.h"
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "Core/HLE/sceKernelMemory.h"
|
||||
#include "Core/HLE/sceKernelVTimer.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
|
||||
static int vtimerTimer = -1;
|
||||
static SceUID runningVTimer = 0;
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Debugger/MemBlockInfo.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/sceKernelMemory.h"
|
||||
#include "Core/HLE/sceMp3.h"
|
||||
|
||||
+32
-31
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "Common/Serialize/SerializeMap.h"
|
||||
#include "Common/Data/Format/JSONReader.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/sceKernelMemory.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "Core/MemMapHelpers.h"
|
||||
|
||||
#include "Core/HLE/HLEHelperThread.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/sceKernelThread.h"
|
||||
#include "Core/HLE/sceKernel.h"
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Common/Thread/ThreadUtil.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Core/Core.h"
|
||||
@@ -35,7 +34,9 @@
|
||||
#include "Core/MemMapHelpers.h"
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/sceKernelMemory.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
|
||||
|
||||
std::vector<SceUID> matchingThreads;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/Reporting.h"
|
||||
|
||||
+137
-152
@@ -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"
|
||||
@@ -63,23 +64,6 @@ static u32 psmfPlayerLibcrc = 0;
|
||||
|
||||
int eventPsmfPlayerStatusChange = -1;
|
||||
|
||||
enum PsmfPlayerError {
|
||||
ERROR_PSMF_NOT_INITIALIZED = 0x80615001,
|
||||
ERROR_PSMF_BAD_VERSION = 0x80615002,
|
||||
ERROR_PSMF_NOT_FOUND = 0x80615025,
|
||||
ERROR_PSMF_INVALID_ID = 0x80615100,
|
||||
ERROR_PSMF_INVALID_VALUE = 0x806151fe,
|
||||
ERROR_PSMF_INVALID_TIMESTAMP = 0x80615500,
|
||||
ERROR_PSMF_INVALID_PSMF = 0x80615501,
|
||||
|
||||
ERROR_PSMFPLAYER_INVALID_STATUS = 0x80616001,
|
||||
ERROR_PSMFPLAYER_INVALID_STREAM = 0x80616003,
|
||||
ERROR_PSMFPLAYER_BUFFER_SIZE = 0x80616005,
|
||||
ERROR_PSMFPLAYER_INVALID_CONFIG = 0x80616006,
|
||||
ERROR_PSMFPLAYER_INVALID_PARAM = 0x80616008,
|
||||
ERROR_PSMFPLAYER_NO_MORE_DATA = 0x8061600c,
|
||||
};
|
||||
|
||||
enum PsmfPlayerStatus {
|
||||
PSMF_PLAYER_STATUS_NONE = 0x0,
|
||||
PSMF_PLAYER_STATUS_INIT = 0x1,
|
||||
@@ -763,16 +747,16 @@ static u32 scePsmfSetPsmf(u32 psmfStruct, u32 psmfData) {
|
||||
Psmf *psmf = new Psmf(Memory::GetPointer(psmfData), psmfData);
|
||||
if (psmf->magic != PSMF_MAGIC) {
|
||||
delete psmf;
|
||||
return hleLogError(Log::ME, ERROR_PSMF_INVALID_PSMF, "invalid psmf data");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_INVALID_PSMF, "invalid psmf data");
|
||||
}
|
||||
// Note: devkit 00000000 supports only '0012'(0F), '0013'(1F), and '0014'(2F). 03000310+ supports '0015'(3F.)
|
||||
if (psmf->version == 0) {
|
||||
delete psmf;
|
||||
return hleLogError(Log::ME, ERROR_PSMF_BAD_VERSION, "invalid psmf version");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_BAD_VERSION, "invalid psmf version");
|
||||
}
|
||||
if (psmf->streamOffset == 0) {
|
||||
delete psmf;
|
||||
return hleLogError(Log::ME, ERROR_PSMF_INVALID_VALUE, "invalid psmf version");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_INVALID_VALUE, "invalid psmf version");
|
||||
}
|
||||
|
||||
// Note: this structure changes between versions.
|
||||
@@ -799,7 +783,7 @@ static u32 scePsmfSetPsmf(u32 psmfStruct, u32 psmfData) {
|
||||
static u32 scePsmfGetNumberOfStreams(u32 psmfStruct) {
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_INITIALIZED, "invalid psmf");
|
||||
}
|
||||
return hleLogDebug(Log::ME, psmf->numStreams);
|
||||
}
|
||||
@@ -807,7 +791,7 @@ static u32 scePsmfGetNumberOfStreams(u32 psmfStruct) {
|
||||
static u32 scePsmfGetNumberOfSpecificStreams(u32 psmfStruct, int streamType) {
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_INITIALIZED, "invalid psmf");
|
||||
}
|
||||
|
||||
int streamNum = 0;
|
||||
@@ -823,11 +807,11 @@ static u32 scePsmfGetNumberOfSpecificStreams(u32 psmfStruct, int streamType) {
|
||||
static u32 scePsmfSpecifyStreamWithStreamType(u32 psmfStruct, u32 streamType, u32 channel) {
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_INITIALIZED, "invalid psmf");
|
||||
}
|
||||
if (!psmf->setStreamWithType(psmfStruct, streamType, channel)) {
|
||||
// An invalid type seems to make the stream number invalid, but retain the old type/channel.
|
||||
psmf->setStreamNum(psmfStruct, ERROR_PSMF_INVALID_ID, false);
|
||||
psmf->setStreamNum(psmfStruct, SCE_PSMF_ERROR_INVALID_ID, false);
|
||||
// Also, returns 0 even when no stream found.
|
||||
return hleLogWarning(Log::ME, 0, "no stream found");
|
||||
}
|
||||
@@ -837,11 +821,11 @@ static u32 scePsmfSpecifyStreamWithStreamType(u32 psmfStruct, u32 streamType, u3
|
||||
static u32 scePsmfSpecifyStreamWithStreamTypeNumber(u32 psmfStruct, u32 streamType, u32 typeNum) {
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_INITIALIZED, "invalid psmf");
|
||||
}
|
||||
if (!psmf->setStreamWithTypeNumber(psmfStruct, streamType, typeNum)) {
|
||||
// Don't update stream, just bail out.
|
||||
return hleLogWarning(Log::ME, ERROR_PSMF_INVALID_ID, "no stream found");
|
||||
return hleLogWarning(Log::ME, SCE_PSMF_ERROR_INVALID_ID, "no stream found");
|
||||
}
|
||||
return hleLogDebug(Log::ME, 0);
|
||||
}
|
||||
@@ -849,11 +833,11 @@ static u32 scePsmfSpecifyStreamWithStreamTypeNumber(u32 psmfStruct, u32 streamTy
|
||||
static u32 scePsmfSpecifyStream(u32 psmfStruct, int streamNum) {
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_INITIALIZED, "invalid psmf");
|
||||
}
|
||||
if (!psmf->setStreamNum(psmfStruct, streamNum)) {
|
||||
psmf->setStreamNum(psmfStruct, ERROR_PSMF_NOT_INITIALIZED);
|
||||
return hleLogWarning(Log::ME, ERROR_PSMF_INVALID_ID, "bad stream id");
|
||||
psmf->setStreamNum(psmfStruct, SCE_PSMF_ERROR_NOT_INITIALIZED);
|
||||
return hleLogWarning(Log::ME, SCE_PSMF_ERROR_INVALID_ID, "bad stream id");
|
||||
}
|
||||
return hleLogDebug(Log::ME, 0);
|
||||
}
|
||||
@@ -861,9 +845,9 @@ static u32 scePsmfSpecifyStream(u32 psmfStruct, int streamNum) {
|
||||
static u32 scePsmfGetVideoInfo(u32 psmfStruct, u32 videoInfoAddr) {
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_INITIALIZED, "invalid psmf");
|
||||
} else if (!psmf->isValidCurrentStreamNumber()) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid stream selected");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_INITIALIZED, "invalid stream selected");
|
||||
} else if (!Memory::IsValidRange(videoInfoAddr, 8)) {
|
||||
// Would crash.
|
||||
return hleLogError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad address");
|
||||
@@ -871,7 +855,7 @@ static u32 scePsmfGetVideoInfo(u32 psmfStruct, u32 videoInfoAddr) {
|
||||
|
||||
auto info = psmf->streamMap[psmf->currentStreamNum];
|
||||
if (info->videoWidth_ == PsmfStream::INVALID) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_INVALID_ID, "not a video stream");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_INVALID_ID, "not a video stream");
|
||||
}
|
||||
Memory::Write_U32(info->videoWidth_ == PsmfStream::USE_PSMF ? psmf->videoWidth : info->videoWidth_, videoInfoAddr);
|
||||
Memory::Write_U32(info->videoHeight_ == PsmfStream::USE_PSMF ? psmf->videoHeight : info->videoHeight_, videoInfoAddr + 4);
|
||||
@@ -881,9 +865,9 @@ static u32 scePsmfGetVideoInfo(u32 psmfStruct, u32 videoInfoAddr) {
|
||||
static u32 scePsmfGetAudioInfo(u32 psmfStruct, u32 audioInfoAddr) {
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_INITIALIZED, "invalid psmf");
|
||||
} else if (!psmf->isValidCurrentStreamNumber()) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid stream selected");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_INITIALIZED, "invalid stream selected");
|
||||
} else if (!Memory::IsValidRange(audioInfoAddr, 8)) {
|
||||
// Would crash.
|
||||
return hleLogError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad address");
|
||||
@@ -891,7 +875,7 @@ static u32 scePsmfGetAudioInfo(u32 psmfStruct, u32 audioInfoAddr) {
|
||||
|
||||
auto info = psmf->streamMap[psmf->currentStreamNum];
|
||||
if (info->audioChannels_ == PsmfStream::INVALID) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_INVALID_ID, "not an audio stream");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_INVALID_ID, "not an audio stream");
|
||||
}
|
||||
Memory::Write_U32(info->audioChannels_ == PsmfStream::USE_PSMF ? psmf->audioChannels : info->audioChannels_, audioInfoAddr);
|
||||
Memory::Write_U32(info->audioFrequency_ == PsmfStream::USE_PSMF ? psmf->audioFrequency : info->audioFrequency_, audioInfoAddr + 4);
|
||||
@@ -901,17 +885,17 @@ static u32 scePsmfGetAudioInfo(u32 psmfStruct, u32 audioInfoAddr) {
|
||||
static u32 scePsmfGetCurrentStreamType(u32 psmfStruct, u32 typeAddr, u32 channelAddr) {
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_INITIALIZED, "invalid psmf");
|
||||
}
|
||||
if (psmf->currentStreamNum == (int)ERROR_PSMF_NOT_INITIALIZED) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "no stream set");
|
||||
if (psmf->currentStreamNum == (int)SCE_PSMF_ERROR_NOT_INITIALIZED) {
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_INITIALIZED, "no stream set");
|
||||
}
|
||||
if (!Memory::IsValidAddress(typeAddr) || !Memory::IsValidAddress(channelAddr)) {
|
||||
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);
|
||||
}
|
||||
@@ -920,10 +904,10 @@ static u32 scePsmfGetStreamSize(u32 psmfStruct, u32 sizeAddr)
|
||||
{
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_FOUND, "invalid psmf");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_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 +916,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 +925,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;
|
||||
}
|
||||
@@ -950,10 +934,10 @@ static u32 scePsmfGetHeaderSize(u32 psmfStruct, u32 sizeAddr)
|
||||
{
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_FOUND, "invalid psmf");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_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);
|
||||
}
|
||||
@@ -962,7 +946,7 @@ static u32 scePsmfGetPsmfVersion(u32 psmfStruct)
|
||||
{
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_FOUND, "invalid psmf");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_FOUND, "invalid psmf");
|
||||
}
|
||||
return hleLogDebug(Log::ME, psmf->version);
|
||||
}
|
||||
@@ -971,11 +955,11 @@ static u32 scePsmfVerifyPsmf(u32 psmfAddr)
|
||||
{
|
||||
u32 magic = Memory::Read_U32(psmfAddr);
|
||||
if (magic != PSMF_MAGIC) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_FOUND, "bad magic %08x", magic);
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_FOUND, "bad magic %08x", magic);
|
||||
}
|
||||
int version = Memory::Read_U32(psmfAddr + PSMF_STREAM_VERSION_OFFSET);
|
||||
if (version < 0) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_FOUND, "bad version at %08x: %d", psmfAddr + PSMF_STREAM_VERSION_OFFSET, version);
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_FOUND, "bad version at %08x: %d", psmfAddr + PSMF_STREAM_VERSION_OFFSET, version);
|
||||
}
|
||||
// Kurohyou 2 (at least the demo) uses an uninitialized value that happens to be zero on the PSP.
|
||||
// It appears to be written by scePsmfVerifyPsmf(), so we write some bytes into the stack here.
|
||||
@@ -987,7 +971,7 @@ static u32 scePsmfGetNumberOfEPentries(u32 psmfStruct)
|
||||
{
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_FOUND, "invalid psmf");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_FOUND, "invalid psmf");
|
||||
}
|
||||
return hleLogDebug(Log::ME, psmf->EPMapEntriesNum);
|
||||
}
|
||||
@@ -996,7 +980,7 @@ static u32 scePsmfGetPresentationStartTime(u32 psmfStruct, u32 startTimeAddr)
|
||||
{
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_FOUND, "invalid psmf");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_FOUND, "invalid psmf");
|
||||
}
|
||||
if (Memory::IsValidAddress(startTimeAddr)) {
|
||||
Memory::Write_U32(psmf->presentationStartTime, startTimeAddr);
|
||||
@@ -1009,11 +993,11 @@ static u32 scePsmfGetPresentationEndTime(u32 psmfStruct, u32 endTimeAddr)
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
ERROR_LOG(Log::ME, "scePsmfGetPresentationEndTime(%08x, %08x): invalid psmf", psmfStruct, endTimeAddr);
|
||||
return ERROR_PSMF_NOT_FOUND;
|
||||
return SCE_PSMF_ERROR_NOT_FOUND;
|
||||
}
|
||||
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;
|
||||
}
|
||||
@@ -1021,7 +1005,7 @@ static u32 scePsmfGetPresentationEndTime(u32 psmfStruct, u32 endTimeAddr)
|
||||
static u32 scePsmfGetCurrentStreamNumber(u32 psmfStruct) {
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_INITIALIZED, "invalid psmf");
|
||||
}
|
||||
if (psmf->currentStreamNum < 0) {
|
||||
return hleLogError(Log::ME, psmf->currentStreamNum, "invalid stream");
|
||||
@@ -1034,22 +1018,22 @@ static u32 scePsmfCheckEPMap(u32 psmfStruct)
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
ERROR_LOG(Log::ME, "scePsmfCheckEPMap(%08x): invalid psmf", psmfStruct);
|
||||
return ERROR_PSMF_NOT_FOUND;
|
||||
return SCE_PSMF_ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
DEBUG_LOG(Log::ME, "scePsmfCheckEPMap(%08x)", psmfStruct);
|
||||
return psmf->EPMap.empty() ? ERROR_PSMF_NOT_FOUND : 0;
|
||||
return psmf->EPMap.empty() ? SCE_PSMF_ERROR_NOT_FOUND : 0;
|
||||
}
|
||||
|
||||
static u32 scePsmfGetEPWithId(u32 psmfStruct, int epid, u32 entryAddr)
|
||||
{
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_INITIALIZED, "invalid psmf");
|
||||
}
|
||||
|
||||
if (epid < 0 || epid >= (int)psmf->EPMap.size()) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_FOUND, "invalid id");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_FOUND, "invalid id");
|
||||
}
|
||||
|
||||
auto entry = PSPPointer<PsmfEntry>::Create(entryAddr);
|
||||
@@ -1064,16 +1048,16 @@ static u32 scePsmfGetEPWithTimestamp(u32 psmfStruct, u32 ts, u32 entryAddr)
|
||||
{
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_INITIALIZED, "invalid psmf");
|
||||
}
|
||||
|
||||
if (ts < psmf->presentationStartTime) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_FOUND, "invalid timestamp");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_FOUND, "invalid timestamp");
|
||||
}
|
||||
|
||||
int epid = psmf->FindEPWithTimestamp(ts);
|
||||
if (epid < 0 || epid >= (int)psmf->EPMap.size()) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_FOUND, "invalid id");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_FOUND, "invalid id");
|
||||
}
|
||||
|
||||
auto entry = PSPPointer<PsmfEntry>::Create(entryAddr);
|
||||
@@ -1088,24 +1072,24 @@ static u32 scePsmfGetEPidWithTimestamp(u32 psmfStruct, u32 ts)
|
||||
{
|
||||
Psmf *psmf = getPsmf(psmfStruct);
|
||||
if (!psmf) {
|
||||
return hleLogError(Log::ME, ERROR_PSMF_NOT_FOUND, "invalid psmf");
|
||||
return hleLogError(Log::ME, SCE_PSMF_ERROR_NOT_FOUND, "invalid psmf");
|
||||
}
|
||||
DEBUG_LOG(Log::ME, "scePsmfGetEPidWithTimestamp(%08x, %i)", psmfStruct, ts);
|
||||
|
||||
if (psmf->EPMap.empty()) {
|
||||
ERROR_LOG(Log::ME, "scePsmfGetEPidWithTimestamp(%08x): EPMap is empty", psmfStruct);
|
||||
return ERROR_PSMF_NOT_FOUND;
|
||||
return SCE_PSMF_ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (ts < psmf->presentationStartTime) {
|
||||
ERROR_LOG(Log::ME, "scePsmfGetEPidWithTimestamp(%08x, %i): invalid timestamp", psmfStruct, ts);
|
||||
return ERROR_PSMF_INVALID_TIMESTAMP;
|
||||
return SCE_PSMF_ERROR_INVALID_TIMESTAMP;
|
||||
}
|
||||
|
||||
int epid = psmf->FindEPWithTimestamp(ts);
|
||||
if (epid < 0 || epid >= (int)psmf->EPMap.size()) {
|
||||
ERROR_LOG(Log::ME, "scePsmfGetEPidWithTimestamp(%08x, %i): invalid id", psmfStruct, epid);
|
||||
return ERROR_PSMF_INVALID_ID;
|
||||
return SCE_PSMF_ERROR_INVALID_ID;
|
||||
}
|
||||
|
||||
return epid;
|
||||
@@ -1126,15 +1110,15 @@ static int scePsmfPlayerCreate(u32 psmfPlayer, u32 dataPtr) {
|
||||
}
|
||||
if (data->bufferSize < 0x00285800) {
|
||||
*player = 0;
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_BUFFER_SIZE, "buffer too small %08x", data->bufferSize);
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_BUFFER_SIZE, "buffer too small %08x", data->bufferSize);
|
||||
}
|
||||
if (data->threadPriority < 0x10 || data->threadPriority >= 0x6E) {
|
||||
*player = 0;
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_PARAM, "bad thread priority %02x", data->threadPriority);
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_PARAM, "bad thread priority %02x", data->threadPriority);
|
||||
}
|
||||
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);
|
||||
@@ -1160,10 +1144,10 @@ static int scePsmfPlayerCreate(u32 psmfPlayer, u32 dataPtr) {
|
||||
static int scePsmfPlayerStop(u32 psmfPlayer) {
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "invalid psmf player");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "invalid psmf player");
|
||||
}
|
||||
if (psmfplayer->status < PSMF_PLAYER_STATUS_PLAYING) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "not yet playing");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "not yet playing");
|
||||
}
|
||||
psmfplayer->AbortFinish();
|
||||
|
||||
@@ -1175,7 +1159,7 @@ static int scePsmfPlayerStop(u32 psmfPlayer) {
|
||||
static int scePsmfPlayerBreak(u32 psmfPlayer) {
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "invalid psmf player");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "invalid psmf player");
|
||||
}
|
||||
|
||||
psmfplayer->AbortFinish();
|
||||
@@ -1219,10 +1203,10 @@ static int _PsmfPlayerFillRingbuffer(PsmfPlayer *psmfplayer) {
|
||||
static int _PsmfPlayerSetPsmfOffset(u32 psmfPlayer, const char *filename, int offset, bool docallback) {
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer || psmfplayer->status != PSMF_PLAYER_STATUS_INIT) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "invalid psmf player or status");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "invalid psmf player or status");
|
||||
}
|
||||
if (!filename) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_PARAM, "invalid filename");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_PARAM, "invalid filename");
|
||||
}
|
||||
|
||||
int delayUs = 1100;
|
||||
@@ -1317,7 +1301,7 @@ static int scePsmfPlayerSetPsmfOffsetCB(u32 psmfPlayer, const char *filename, in
|
||||
static int scePsmfPlayerGetAudioOutSize(u32 psmfPlayer) {
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "invalid psmf player");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "invalid psmf player");
|
||||
}
|
||||
return hleLogWarning(Log::ME, audioSamplesBytes);
|
||||
}
|
||||
@@ -1346,10 +1330,10 @@ static int scePsmfPlayerStart(u32 psmfPlayer, u32 psmfPlayerData, int initPts)
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
if (psmfplayer->status == PSMF_PLAYER_STATUS_INIT) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "psmf not yet set");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "psmf not yet set");
|
||||
}
|
||||
|
||||
auto playerData = PSPPointer<PsmfPlayerData>::Create(psmfPlayerData);
|
||||
@@ -1358,29 +1342,29 @@ static int scePsmfPlayerStart(u32 psmfPlayer, u32 psmfPlayerData, int initPts)
|
||||
return hleLogError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad data address");
|
||||
}
|
||||
if (playerData->playMode < 0 || playerData->playMode > (int)PSMF_PLAYER_MODE_REWIND) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_PARAM, "invalid mode");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_PARAM, "invalid mode");
|
||||
}
|
||||
if (initPts >= psmfplayer->mediaengine->getLastTimeStamp()) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_PARAM, "pts is outside video");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_PARAM, "pts is outside video");
|
||||
}
|
||||
|
||||
if (psmfplayer->totalAudioStreams > 0) {
|
||||
if (playerData->audioCodec != 0x0F && playerData->audioCodec != 0x01) {
|
||||
ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): invalid audio codec %02x", psmfPlayer, psmfPlayerData, initPts, playerData->audioCodec);
|
||||
return hleNoLog(ERROR_PSMFPLAYER_INVALID_STREAM);
|
||||
return hleNoLog(SCE_PSMFPLAYER_ERROR_INVALID_STREAM);
|
||||
}
|
||||
if (playerData->audioStreamNum >= psmfplayer->totalAudioStreams) {
|
||||
ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): unable to change audio stream to %d", psmfPlayer, psmfPlayerData, initPts, playerData->audioStreamNum);
|
||||
return hleNoLog(ERROR_PSMFPLAYER_INVALID_CONFIG);
|
||||
return hleNoLog(SCE_PSMFPLAYER_ERROR_INVALID_CONFIG);
|
||||
}
|
||||
}
|
||||
if (playerData->videoCodec != 0x0E && playerData->videoCodec != 0x00) {
|
||||
ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): invalid video codec %02x", psmfPlayer, psmfPlayerData, initPts, playerData->videoCodec);
|
||||
return hleNoLog(ERROR_PSMFPLAYER_INVALID_STREAM);
|
||||
return hleNoLog(SCE_PSMFPLAYER_ERROR_INVALID_STREAM);
|
||||
}
|
||||
if (playerData->videoStreamNum < 0 || playerData->videoStreamNum >= psmfplayer->totalVideoStreams) {
|
||||
ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): unable to change video stream to %d", psmfPlayer, psmfPlayerData, initPts, playerData->videoStreamNum);
|
||||
return hleNoLog(ERROR_PSMFPLAYER_INVALID_CONFIG);
|
||||
return hleNoLog(SCE_PSMFPLAYER_ERROR_INVALID_CONFIG);
|
||||
}
|
||||
|
||||
switch ((PsmfPlayerMode)(s32)playerData->playMode) {
|
||||
@@ -1388,7 +1372,7 @@ static int scePsmfPlayerStart(u32 psmfPlayer, u32 psmfPlayerData, int initPts)
|
||||
case PSMF_PLAYER_MODE_REWIND:
|
||||
if (psmfplayer->playerVersion == PSMF_PLAYER_VERSION_BASIC) {
|
||||
WARN_LOG_REPORT(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): no EP data for FORWARD/REWIND", psmfPlayer, psmfPlayerData, initPts);
|
||||
return ERROR_PSMFPLAYER_INVALID_PARAM;
|
||||
return SCE_PSMFPLAYER_ERROR_INVALID_PARAM;
|
||||
}
|
||||
WARN_LOG_REPORT(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): unsupported playMode", psmfPlayer, psmfPlayerData, initPts);
|
||||
break;
|
||||
@@ -1403,7 +1387,7 @@ static int scePsmfPlayerStart(u32 psmfPlayer, u32 psmfPlayerData, int initPts)
|
||||
}
|
||||
|
||||
if (psmfplayer->playerVersion == PSMF_PLAYER_VERSION_BASIC && initPts != 0) {
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_PARAM, "unable to seek without EPmap");
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_PARAM, "unable to seek without EPmap");
|
||||
}
|
||||
|
||||
psmfplayer->AbortFinish();
|
||||
@@ -1469,10 +1453,11 @@ static int scePsmfPlayerDelete(u32 psmfPlayer)
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
|
||||
delete psmfplayer;
|
||||
|
||||
psmfPlayerMap.erase(Memory::Read_U32(psmfPlayer));
|
||||
Memory::Write_U32(0, psmfPlayer);
|
||||
|
||||
@@ -1483,10 +1468,10 @@ static int scePsmfPlayerUpdate(u32 psmfPlayer)
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
if (psmfplayer->status < PSMF_PLAYER_STATUS_PLAYING) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "not playing yet");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "not playing yet");
|
||||
}
|
||||
|
||||
if (psmfplayer->HasReachedEnd()) {
|
||||
@@ -1506,10 +1491,10 @@ static int scePsmfPlayerReleasePsmf(u32 psmfPlayer)
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
if (psmfplayer->status < PSMF_PLAYER_STATUS_STANDBY) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "not set yet");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "not set yet");
|
||||
}
|
||||
|
||||
psmfplayer->status = PSMF_PLAYER_STATUS_INIT;
|
||||
@@ -1528,10 +1513,10 @@ static int scePsmfPlayerGetVideoData(u32 psmfPlayer, u32 videoDataAddr)
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
if (psmfplayer->status < PSMF_PLAYER_STATUS_PLAYING) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "psmf not playing");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "psmf not playing");
|
||||
}
|
||||
auto videoData = PSPPointer<PsmfVideoData>::Create(videoDataAddr);
|
||||
if (!videoData.IsValid()) {
|
||||
@@ -1548,7 +1533,7 @@ static int scePsmfPlayerGetVideoData(u32 psmfPlayer, u32 videoDataAddr)
|
||||
hleEatCycles(20000);
|
||||
|
||||
if (!__PsmfPlayerContinueSeek(psmfplayer)) {
|
||||
return hleLogDebug(Log::HLE, ERROR_PSMFPLAYER_NO_MORE_DATA, "still seeking");
|
||||
return hleLogDebug(Log::HLE, SCE_PSMFPLAYER_ERROR_NO_MORE_DATA, "still seeking");
|
||||
}
|
||||
|
||||
// On a real PSP, this takes a potentially variable amount of time.
|
||||
@@ -1556,7 +1541,7 @@ static int scePsmfPlayerGetVideoData(u32 psmfPlayer, u32 videoDataAddr)
|
||||
// It should be okay if we start videos quicker, but some games expect the first couple to fail.
|
||||
if (psmfplayer->warmUp < PSMF_PLAYER_WARMUP_FRAMES) {
|
||||
++psmfplayer->warmUp;
|
||||
return hleLogDebug(Log::ME, ERROR_PSMFPLAYER_NO_MORE_DATA, "warming up");
|
||||
return hleLogDebug(Log::ME, SCE_PSMFPLAYER_ERROR_NO_MORE_DATA, "warming up");
|
||||
}
|
||||
// In case we change warm up later, save a high value in savestates - video started.
|
||||
psmfplayer->warmUp = 10000;
|
||||
@@ -1612,10 +1597,10 @@ static int scePsmfPlayerGetAudioData(u32 psmfPlayer, u32 audioDataAddr)
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
if (psmfplayer->status < PSMF_PLAYER_STATUS_PLAYING) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "not yet playing");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "not yet playing");
|
||||
}
|
||||
if (!Memory::IsValidAddress(audioDataAddr)) {
|
||||
return hleLogError(Log::ME, SCE_KERNEL_ERROR_INVALID_POINTER, "invalid audio pointer");
|
||||
@@ -1623,11 +1608,11 @@ static int scePsmfPlayerGetAudioData(u32 psmfPlayer, u32 audioDataAddr)
|
||||
|
||||
// Don't return audio frames before we would return video frames.
|
||||
if (psmfplayer->warmUp < PSMF_PLAYER_WARMUP_FRAMES) {
|
||||
return hleLogDebug(Log::ME, ERROR_PSMFPLAYER_NO_MORE_DATA, "warming up");
|
||||
return hleLogDebug(Log::ME, SCE_PSMFPLAYER_ERROR_NO_MORE_DATA, "warming up");
|
||||
}
|
||||
|
||||
if (psmfplayer->playMode == PSMF_PLAYER_MODE_PAUSE) {
|
||||
return hleLogInfo(Log::HLE, ERROR_PSMFPLAYER_NO_MORE_DATA, "paused mode");
|
||||
return hleLogInfo(Log::HLE, SCE_PSMFPLAYER_ERROR_NO_MORE_DATA, "paused mode");
|
||||
}
|
||||
|
||||
int ret = 0;
|
||||
@@ -1636,7 +1621,7 @@ static int scePsmfPlayerGetAudioData(u32 psmfPlayer, u32 audioDataAddr)
|
||||
// Write zeros for any missing trailing frames so it syncs with the video.
|
||||
Memory::Memset(audioDataAddr, 0, audioSamplesBytes, "PsmfAudioClear");
|
||||
} else {
|
||||
ret = (int)ERROR_PSMFPLAYER_NO_MORE_DATA;
|
||||
ret = (int)SCE_PSMFPLAYER_ERROR_NO_MORE_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1655,10 +1640,10 @@ static int scePsmfPlayerGetCurrentStatus(u32 psmfPlayer)
|
||||
if (!psmfplayer) {
|
||||
// Mana Khemia and other games call this even when not necessary.
|
||||
// It's annoying so the logging is verbose'd out.
|
||||
return hleLogVerbose(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "invalid psmf player");
|
||||
return hleLogVerbose(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "invalid psmf player");
|
||||
}
|
||||
if (psmfplayer->status == PSMF_PLAYER_STATUS_NONE) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "not initialized");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "not initialized");
|
||||
}
|
||||
|
||||
return hleLogDebug(Log::ME, psmfplayer->status);
|
||||
@@ -1668,19 +1653,19 @@ static u32 scePsmfPlayerGetCurrentPts(u32 psmfPlayer, u32 currentPtsAddr)
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
if (psmfplayer->status < PSMF_PLAYER_STATUS_STANDBY) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "not initialized");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "not initialized");
|
||||
}
|
||||
if (psmfplayer->psmfPlayerAvcAu.pts < 0) {
|
||||
return hleLogVerbose(Log::ME, ERROR_PSMFPLAYER_NO_MORE_DATA, "no frame yet");
|
||||
return hleLogVerbose(Log::ME, SCE_PSMFPLAYER_ERROR_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) {
|
||||
@@ -1692,10 +1677,10 @@ static u32 scePsmfPlayerGetPsmfInfo(u32 psmfPlayer, u32 psmfInfoAddr, u32 widthA
|
||||
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
if (psmfplayer->status < PSMF_PLAYER_STATUS_STANDBY) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "psmf not set yet");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "psmf not set yet");
|
||||
}
|
||||
|
||||
// The first frame is at 0, so subtract one frame's duration to get the last frame's timestamp.
|
||||
@@ -1712,10 +1697,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);
|
||||
@@ -1725,14 +1710,14 @@ static u32 scePsmfPlayerGetCurrentPlayMode(u32 psmfPlayer, u32 playModeAddr, u32
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -1741,17 +1726,17 @@ static u32 scePsmfPlayerGetCurrentVideoStream(u32 psmfPlayer, u32 videoCodecAddr
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
if (psmfplayer->status == PSMF_PLAYER_STATUS_INIT) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "psmf not yet set");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "psmf not yet set");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -1760,17 +1745,17 @@ static u32 scePsmfPlayerGetCurrentAudioStream(u32 psmfPlayer, u32 audioCodecAddr
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
if (psmfplayer->status == PSMF_PLAYER_STATUS_INIT) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "psmf not yet set");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "psmf not yet set");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -1779,13 +1764,13 @@ static int scePsmfPlayerSetTempBuf(u32 psmfPlayer, u32 tempBufAddr, u32 tempBufS
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
if (psmfplayer->status != PSMF_PLAYER_STATUS_INIT) {
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "invalid status %x", psmfplayer->status);
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "invalid status %x", psmfplayer->status);
|
||||
}
|
||||
if (tempBufSize < 0x00010000) {
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_PARAM, "buffer too small");
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_PARAM, "buffer too small");
|
||||
}
|
||||
|
||||
// fake it right now, use tempbuf from memory directly
|
||||
@@ -1798,13 +1783,13 @@ static u32 scePsmfPlayerChangePlayMode(u32 psmfPlayer, int playMode, int playSpe
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
if (psmfplayer->status < PSMF_PLAYER_STATUS_PLAYING) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "not playing yet");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "not playing yet");
|
||||
}
|
||||
if (playMode < 0 || playMode > (int)PSMF_PLAYER_MODE_REWIND) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_CONFIG, "invalid mode");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_CONFIG, "invalid mode");
|
||||
}
|
||||
|
||||
switch (playMode) {
|
||||
@@ -1812,7 +1797,7 @@ static u32 scePsmfPlayerChangePlayMode(u32 psmfPlayer, int playMode, int playSpe
|
||||
case PSMF_PLAYER_MODE_REWIND:
|
||||
if (psmfplayer->playerVersion == PSMF_PLAYER_VERSION_BASIC) {
|
||||
ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): no EP data for FORWARD/REWIND", psmfPlayer, playMode, playSpeed);
|
||||
return ERROR_PSMFPLAYER_INVALID_STREAM;
|
||||
return SCE_PSMFPLAYER_ERROR_INVALID_STREAM;
|
||||
}
|
||||
psmfplayer->playSpeed = playSpeed;
|
||||
WARN_LOG_REPORT(Log::ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): unsupported playMode", psmfPlayer, playMode, playSpeed);
|
||||
@@ -1843,10 +1828,10 @@ static u32 scePsmfPlayerSelectAudio(u32 psmfPlayer)
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
if (psmfplayer->status != PSMF_PLAYER_STATUS_PLAYING) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "not playing");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "not playing");
|
||||
}
|
||||
|
||||
int next = psmfplayer->audioStreamNum + 1;
|
||||
@@ -1854,7 +1839,7 @@ static u32 scePsmfPlayerSelectAudio(u32 psmfPlayer)
|
||||
next = 0;
|
||||
|
||||
if (next == psmfplayer->audioStreamNum || !psmfplayer->mediaengine->setAudioStream(next)) {
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_STREAM, "no stream to switch to");
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STREAM, "no stream to switch to");
|
||||
}
|
||||
|
||||
WARN_LOG_REPORT(Log::ME, "scePsmfPlayerSelectAudio(%08x)", psmfPlayer);
|
||||
@@ -1866,10 +1851,10 @@ static u32 scePsmfPlayerSelectVideo(u32 psmfPlayer)
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
if (psmfplayer->status != PSMF_PLAYER_STATUS_PLAYING) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "not playing");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "not playing");
|
||||
}
|
||||
|
||||
int next = psmfplayer->videoStreamNum + 1;
|
||||
@@ -1877,7 +1862,7 @@ static u32 scePsmfPlayerSelectVideo(u32 psmfPlayer)
|
||||
next = 0;
|
||||
|
||||
if (next == psmfplayer->videoStreamNum || !psmfplayer->mediaengine->setVideoStream(next)) {
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_STREAM, "no stream to switch to");
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STREAM, "no stream to switch to");
|
||||
}
|
||||
|
||||
WARN_LOG_REPORT(Log::ME, "scePsmfPlayerSelectVideo(%08x)", psmfPlayer);
|
||||
@@ -1889,22 +1874,22 @@ static u32 scePsmfPlayerSelectSpecificVideo(u32 psmfPlayer, int videoCodec, int
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
if (psmfplayer->status != PSMF_PLAYER_STATUS_PLAYING) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "not playing");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "not playing");
|
||||
}
|
||||
if (psmfplayer->totalVideoStreams < 2) {
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_STREAM, "unable to change stream");
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STREAM, "unable to change stream");
|
||||
}
|
||||
if (videoStreamNum < 0 || videoStreamNum >= psmfplayer->totalVideoStreams) {
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_CONFIG, "bad stream num param");
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_CONFIG, "bad stream num param");
|
||||
}
|
||||
if (videoCodec != 0x0E && videoCodec != 0x00) {
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_STREAM, "invalid codec");
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STREAM, "invalid codec");
|
||||
}
|
||||
if (psmfplayer->totalVideoStreams < 2 || !psmfplayer->mediaengine->setVideoStream(videoStreamNum)) {
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_STREAM, "unable to change stream");
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STREAM, "unable to change stream");
|
||||
}
|
||||
|
||||
bool delay = false;
|
||||
@@ -1925,22 +1910,22 @@ static u32 scePsmfPlayerSelectSpecificAudio(u32 psmfPlayer, int audioCodec, int
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
if (psmfplayer->status != PSMF_PLAYER_STATUS_PLAYING) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "not playing");
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "not playing");
|
||||
}
|
||||
if (psmfplayer->totalAudioStreams < 2) {
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_STREAM, "unable to change stream");
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STREAM, "unable to change stream");
|
||||
}
|
||||
if (audioStreamNum < 0 || audioStreamNum >= psmfplayer->totalAudioStreams) {
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_CONFIG, "bad stream num param");
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_CONFIG, "bad stream num param");
|
||||
}
|
||||
if (audioCodec != 0x0F && audioCodec != 0x01) {
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_STREAM, "invalid codec");
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STREAM, "invalid codec");
|
||||
}
|
||||
if (psmfplayer->totalAudioStreams < 2 || !psmfplayer->mediaengine->setAudioStream(audioStreamNum)) {
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_STREAM, "unable to change stream");
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STREAM, "unable to change stream");
|
||||
}
|
||||
|
||||
bool delay = false;
|
||||
@@ -1960,20 +1945,20 @@ static u32 scePsmfPlayerConfigPlayer(u32 psmfPlayer, int configMode, int configA
|
||||
{
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
// This one works in any status as long as it's created.
|
||||
|
||||
switch (configMode) {
|
||||
case PSMF_PLAYER_CONFIG_MODE_LOOP:
|
||||
if (configAttr != 0 && configAttr != 1) {
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_PARAM, "invalid value");
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_PARAM, "invalid value");
|
||||
}
|
||||
videoLoopStatus = configAttr;
|
||||
break;
|
||||
case PSMF_PLAYER_CONFIG_MODE_PIXEL_TYPE:
|
||||
if (configAttr < -1 || configAttr > 3) {
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_PARAM, "invalid configAttr value");
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_PARAM, "invalid configAttr value");
|
||||
}
|
||||
// Does -1 mean default or something?
|
||||
if (configAttr != -1) {
|
||||
@@ -1984,7 +1969,7 @@ static u32 scePsmfPlayerConfigPlayer(u32 psmfPlayer, int configMode, int configA
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_CONFIG, "unknown parameter");
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_CONFIG, "unknown parameter");
|
||||
}
|
||||
|
||||
return hleLogDebug(Log::ME, 0);
|
||||
@@ -1993,10 +1978,10 @@ static u32 scePsmfPlayerConfigPlayer(u32 psmfPlayer, int configMode, int configA
|
||||
static int __PsmfPlayerFinish(u32 psmfPlayer) {
|
||||
PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer);
|
||||
if (!psmfplayer) {
|
||||
return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS);
|
||||
return hleLogError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS);
|
||||
}
|
||||
if (psmfplayer->status != PSMF_PLAYER_STATUS_PLAYING) {
|
||||
return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "unexpected status %d", psmfplayer->status);
|
||||
return hleReportError(Log::ME, SCE_PSMFPLAYER_ERROR_INVALID_STATUS, "unexpected status %d", psmfplayer->status);
|
||||
}
|
||||
|
||||
psmfplayer->status = PSMF_PLAYER_STATUS_PLAYING_FINISHED;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/Reporting.h"
|
||||
|
||||
+3
-2
@@ -38,13 +38,14 @@
|
||||
#include "Common/Log.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/HW/SasAudio.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/Reporting.h"
|
||||
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/sceSas.h"
|
||||
#include "Core/HLE/sceKernel.h"
|
||||
#include "Core/HLE/sceKernelThread.h"
|
||||
|
||||
+6
-10
@@ -18,15 +18,11 @@
|
||||
#include "Common/Serialize/Serializer.h"
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/HLE/sceSsl.h"
|
||||
|
||||
#define ERROR_SSL_NOT_INIT 0x80435001;
|
||||
#define ERROR_SSL_ALREADY_INIT 0x80435020;
|
||||
#define ERROR_SSL_OUT_OF_MEMORY 0x80435022;
|
||||
#define ERROR_SSL_INVALID_PARAMETER 0x804351FE;
|
||||
|
||||
bool isSslInit;
|
||||
u32 maxMemSize;
|
||||
u32 currentMemSize;
|
||||
@@ -54,11 +50,11 @@ static int sceSslInit(int heapSize)
|
||||
DEBUG_LOG(Log::HLE, "sceSslInit %d", heapSize);
|
||||
if (isSslInit)
|
||||
{
|
||||
return ERROR_SSL_ALREADY_INIT;
|
||||
return SCE_SSL_ERROR_ALREADY_INIT;
|
||||
}
|
||||
if (heapSize <= 0)
|
||||
{
|
||||
return ERROR_SSL_INVALID_PARAMETER;
|
||||
return SCE_SSL_ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
maxMemSize = heapSize;
|
||||
@@ -72,7 +68,7 @@ static int sceSslEnd()
|
||||
DEBUG_LOG(Log::HLE, "sceSslEnd");
|
||||
if (!isSslInit)
|
||||
{
|
||||
return ERROR_SSL_NOT_INIT;
|
||||
return SCE_SSL_ERROR_NOT_INIT;
|
||||
}
|
||||
isSslInit = false;
|
||||
return 0;
|
||||
@@ -83,7 +79,7 @@ static int sceSslGetUsedMemoryMax(u32 maxMemPtr)
|
||||
DEBUG_LOG(Log::HLE, "sceSslGetUsedMemoryMax %d", maxMemPtr);
|
||||
if (!isSslInit)
|
||||
{
|
||||
return ERROR_SSL_NOT_INIT;
|
||||
return SCE_SSL_ERROR_NOT_INIT;
|
||||
}
|
||||
|
||||
if (Memory::IsValidAddress(maxMemPtr))
|
||||
@@ -98,7 +94,7 @@ static int sceSslGetUsedMemoryCurrent(u32 currentMemPtr)
|
||||
DEBUG_LOG(Log::HLE, "sceSslGetUsedMemoryCurrent %d", currentMemPtr);
|
||||
if (!isSslInit)
|
||||
{
|
||||
return ERROR_SSL_NOT_INIT;
|
||||
return SCE_SSL_ERROR_NOT_INIT;
|
||||
}
|
||||
|
||||
if (Memory::IsValidAddress(currentMemPtr))
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "Common/Serialize/SerializeFuncs.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/KernelWaitHelpers.h"
|
||||
#include "Core/HLE/sceKernelThread.h"
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "Core/Config.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/HLEHelperThread.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/FunctionWrappers.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/sceVaudio.h"
|
||||
#include "Core/HLE/sceAudio.h"
|
||||
#include "Core/HLE/__sceAudio.h"
|
||||
|
||||
+5
-2
@@ -1115,10 +1115,13 @@ double g_lastSaveTime = -1.0;
|
||||
case ScreenshotResult::Success:
|
||||
// We might not know if the file write succeeded yet though.
|
||||
callbackResult = Status::SUCCESS;
|
||||
readbackImage = true;
|
||||
break;
|
||||
case ScreenshotResult::FailedToWriteFile:
|
||||
// Can't reach here when we pass in a callback to TakeGameScreenshot.
|
||||
callbackResult = Status::SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
readbackImage = true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/ErrorCodes.h"
|
||||
#include "Core/HLE/sceKernelMemory.h"
|
||||
#include "Core/HLE/sceKernelInterrupt.h"
|
||||
#include "Core/HLE/sceKernelThread.h"
|
||||
|
||||
Reference in new issue
Block a user