mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
More error code consolidation
This commit is contained in:
@@ -299,8 +299,9 @@ enum : u32 {
|
||||
SCE_ERROR_UTILITY_INVALID_STATUS = 0x80110001,
|
||||
SCE_ERROR_UTILITY_INVALID_PARAM_SIZE = 0x80110004,
|
||||
SCE_ERROR_UTILITY_WRONG_TYPE = 0x80110005,
|
||||
SCE_ERROR_UTILITY_INVALID_ADHOC_CHANNEL = 0x80110104,
|
||||
SCE_ERROR_UTILITY_STRING_TOO_LONG = 0x80110102,
|
||||
SCE_ERROR_UTILITY_INVALID_SYSTEM_PARAM_ID = 0x80110103,
|
||||
SCE_ERROR_UTILITY_INVALID_ADHOC_CHANNEL = 0x80110104,
|
||||
|
||||
SCE_ERROR_AUDIO_CHANNEL_NOT_INIT = 0x80260001,
|
||||
SCE_ERROR_AUDIO_CHANNEL_BUSY = 0x80260002,
|
||||
@@ -314,4 +315,6 @@ enum : u32 {
|
||||
SCE_ERROR_AUDIO_INVALID_FREQUENCY = 0x8026000A,
|
||||
SCE_ERROR_AUDIO_INVALID_VOLUME = 0x8026000B,
|
||||
SCE_ERROR_AUDIO_CHANNEL_ALREADY_RESERVED = 0x80268002,
|
||||
|
||||
SCE_ERROR_UMD_NOT_READY = 0x80210001,
|
||||
};
|
||||
|
||||
+7
-7
@@ -272,18 +272,18 @@ static u32 sceUmdGetDiscInfo(u32 infoAddr) {
|
||||
if (Memory::IsValidAddress(infoAddr)) {
|
||||
auto info = PSPPointer<PspUmdInfo>::Create(infoAddr);
|
||||
if (info->size != 8)
|
||||
return hleLogError(Log::sceIo, PSP_ERROR_UMD_INVALID_PARAM);
|
||||
return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT);
|
||||
|
||||
info->type = PSP_UMD_TYPE_GAME;
|
||||
return hleLogDebug(Log::sceIo, 0);
|
||||
} else {
|
||||
return hleLogError(Log::sceIo, PSP_ERROR_UMD_INVALID_PARAM);
|
||||
return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT);
|
||||
}
|
||||
}
|
||||
|
||||
static int sceUmdActivate(u32 mode, const char *name) {
|
||||
if (mode < 1 || mode > 2)
|
||||
return hleLogWarning(Log::sceIo, PSP_ERROR_UMD_INVALID_PARAM);
|
||||
return hleLogWarning(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT);
|
||||
|
||||
__KernelUmdActivate();
|
||||
|
||||
@@ -297,7 +297,7 @@ static int sceUmdDeactivate(u32 mode, const char *name)
|
||||
{
|
||||
// Why 18? No idea.
|
||||
if (mode > 18)
|
||||
return hleLogError(Log::sceIo, PSP_ERROR_UMD_INVALID_PARAM);
|
||||
return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT);
|
||||
|
||||
__KernelUmdDeactivate();
|
||||
|
||||
@@ -312,9 +312,9 @@ static u32 sceUmdRegisterUMDCallBack(u32 cbId)
|
||||
{
|
||||
int retVal = 0;
|
||||
|
||||
// TODO: If the callback is invalid, return PSP_ERROR_UMD_INVALID_PARAM.
|
||||
// TODO: If the callback is invalid, return SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT.
|
||||
if (!kernelObjects.IsValid(cbId)) {
|
||||
retVal = PSP_ERROR_UMD_INVALID_PARAM;
|
||||
retVal = SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT;
|
||||
} else {
|
||||
// There's only ever one.
|
||||
driveCBId = cbId;
|
||||
@@ -325,7 +325,7 @@ static u32 sceUmdRegisterUMDCallBack(u32 cbId)
|
||||
static int sceUmdUnRegisterUMDCallBack(int cbId)
|
||||
{
|
||||
if (cbId != driveCBId) {
|
||||
return hleLogError(Log::sceIo, PSP_ERROR_UMD_INVALID_PARAM);
|
||||
return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT);
|
||||
} else {
|
||||
int retVal;
|
||||
if (sceKernelGetCompiledSdkVersion() > 0x3000000) {
|
||||
|
||||
@@ -29,11 +29,6 @@ enum pspUmdState {
|
||||
PSP_UMD_READABLE = 0x20,
|
||||
};
|
||||
|
||||
enum pspUmdError {
|
||||
PSP_ERROR_UMD_NOT_READY = 0x80210001,
|
||||
PSP_ERROR_UMD_INVALID_PARAM = 0x80010016,
|
||||
};
|
||||
|
||||
enum pspUmdType {
|
||||
PSP_UMD_TYPE_GAME = 0x10,
|
||||
PSP_UMD_TYPE_VIDEO = 0x20,
|
||||
|
||||
@@ -1055,11 +1055,10 @@ static u32 sceUtilitySetSystemParamString(u32 id, u32 strPtr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 sceUtilityGetSystemParamString(u32 id, u32 destAddr, int destSize)
|
||||
{
|
||||
static u32 sceUtilityGetSystemParamString(u32 id, u32 destAddr, int destSize) {
|
||||
if (!Memory::IsValidRange(destAddr, destSize)) {
|
||||
// TODO: What error code?
|
||||
return -1;
|
||||
return hleLogError(Log::sceUtility, -1);
|
||||
}
|
||||
DEBUG_LOG(Log::sceUtility, "sceUtilityGetSystemParamString(%i, %08x, %i)", id, destAddr, destSize);
|
||||
char *buf = (char *)Memory::GetPointerWriteUnchecked(destAddr);
|
||||
@@ -1067,16 +1066,16 @@ static u32 sceUtilityGetSystemParamString(u32 id, u32 destAddr, int destSize)
|
||||
case PSP_SYSTEMPARAM_ID_STRING_NICKNAME:
|
||||
// If there's not enough space for the string and null terminator, fail.
|
||||
if (destSize <= (int)g_Config.sNickName.length())
|
||||
return PSP_SYSTEMPARAM_RETVAL_STRING_TOO_LONG;
|
||||
return SCE_ERROR_UTILITY_STRING_TOO_LONG;
|
||||
// TODO: should we zero-pad the output as strncpy does? And what are the semantics for the terminating null if destSize == length?
|
||||
strncpy(buf, g_Config.sNickName.c_str(), destSize);
|
||||
break;
|
||||
|
||||
default:
|
||||
return PSP_SYSTEMPARAM_RETVAL_FAIL;
|
||||
return hleLogError(Log::sceUtility, SCE_ERROR_UTILITY_INVALID_SYSTEM_PARAM_ID);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return hleLogDebug(Log::sceUtility, 0);
|
||||
}
|
||||
|
||||
static u32 sceUtilitySetSystemParamInt(u32 id, u32 value) {
|
||||
@@ -1144,7 +1143,7 @@ static u32 sceUtilityGetSystemParamInt(u32 id, u32 destaddr) {
|
||||
param = g_Config.iLockParentalLevel;
|
||||
break;
|
||||
default:
|
||||
return hleLogError(Log::sceUtility, PSP_SYSTEMPARAM_RETVAL_FAIL);
|
||||
return hleLogError(Log::sceUtility, SCE_ERROR_UTILITY_INVALID_SYSTEM_PARAM_ID);
|
||||
}
|
||||
|
||||
Memory::Write_U32(param, destaddr);
|
||||
|
||||
@@ -50,8 +50,6 @@ class PointerWrap;
|
||||
|
||||
// Return values for the SystemParam functions
|
||||
#define PSP_SYSTEMPARAM_RETVAL_OK 0
|
||||
#define PSP_SYSTEMPARAM_RETVAL_STRING_TOO_LONG 0x80110102
|
||||
#define PSP_SYSTEMPARAM_RETVAL_FAIL 0x80110103
|
||||
|
||||
// Valid values for PSP_SYSTEMPARAM_ID_INT_ADHOC_CHANNEL
|
||||
#define PSP_SYSTEMPARAM_ADHOC_CHANNEL_AUTOMATIC 0
|
||||
|
||||
Reference in New Issue
Block a user