From a591fbff38d672348180d1572ef6c6f90f18cae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 8 Jan 2026 16:20:50 +0100 Subject: [PATCH] Move two more error codes to the enum --- Core/HLE/ErrorCodes.h | 4 ++++ Core/HLE/sceIo.cpp | 2 +- Core/HLE/sceKernel.cpp | 4 ++++ Core/HLE/scePspNpDrm_user.cpp | 14 ++++---------- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Core/HLE/ErrorCodes.h b/Core/HLE/ErrorCodes.h index fbe2738b42..9d345ed2de 100644 --- a/Core/HLE/ErrorCodes.h +++ b/Core/HLE/ErrorCodes.h @@ -648,4 +648,8 @@ enum PSPErrorCode : u32 { SCE_NET_ADHOCCTL_ERROR_CHANNEL_NOT_MATCH = 0x80410b11, SCE_NET_ADHOCCTL_ERROR_TOO_MANY_HANDLERS = 0x80410b12, SCE_NET_ADHOCCTL_ERROR_STACKSIZE_TOO_SHORT = 0x80410B13, + + // Error codes matching JPCSP + SCE_NPDRM_ERROR_NO_K_LICENSEE_SET = 0x80550901, + SCE_NPDRM_ERROR_INVALID_FILE = 0x80550902, }; diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index ce7b93cd8e..4db3820ff5 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -2589,7 +2589,7 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out key_ptr = nullptr; } - DEBUG_LOG(Log::sceIo, "Decrypting PGD DRM files"); + INFO_LOG(Log::sceIo, "ioctl: Decrypting PGD DRM files from '%s'", f->fullpath.c_str()); pspFileSystem.SeekFile(f->handle, (s32)f->pgd_offset, FILEMOVE_BEGIN); pspFileSystem.ReadFile(f->handle, pgd_header, 0x90); KirkState *kirk = __ChnnlsvKirkState(); diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index 23ac6800b3..71f66b5f0b 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -1633,6 +1633,10 @@ const char *KernelErrorToString(u32 err) { case SCE_NET_ADHOCCTL_ERROR_TOO_MANY_HANDLERS: return "SCE_NET_ADHOCCTL_ERROR_TOO_MANY_HANDLERS"; case SCE_NET_ADHOCCTL_ERROR_STACKSIZE_TOO_SHORT: return "SCE_NET_ADHOCCTL_ERROR_STACKSIZE_TOO_SHORT"; + // NPDRM + case SCE_NPDRM_ERROR_NO_K_LICENSEE_SET: return "SCE_NPDRM_ERROR_NO_K_LICENSEE_SET"; + case SCE_NPDRM_ERROR_INVALID_FILE: return "SCE_NPDRM_ERROR_INVALID_FILE"; + default: return nullptr; } diff --git a/Core/HLE/scePspNpDrm_user.cpp b/Core/HLE/scePspNpDrm_user.cpp index 6e7317ecc2..fad8c9e402 100644 --- a/Core/HLE/scePspNpDrm_user.cpp +++ b/Core/HLE/scePspNpDrm_user.cpp @@ -1,5 +1,4 @@ -#include "scePspNpDrm_user.h" - +#include "Core/HLE/scePspNpDrm_user.h" #include "Core/MemMapHelpers.h" #include "Core/HLE/HLE.h" #include "Core/HLE/FunctionWrappers.h" @@ -13,10 +12,6 @@ static const int PSP_NPDRM_LICENSEE_KEY_LENGTH = 0x10; static u8 licenseeKey[PSP_NPDRM_LICENSEE_KEY_LENGTH]; static bool isLicenseeKeySet = false; -// Error codes matching JPCSP -static const int ERROR_NPDRM_NO_K_LICENSEE_SET = 0x80550901; -static const int ERROR_NPDRM_INVALID_FILE = 0x80550902; - // Check if the file is an encrypted EDAT file by reading the magic number static bool isEncrypted(u32 edataFd) { // Check for "\0PSPEDAT" magic number @@ -67,7 +62,7 @@ static int sceNpDrmSetLicenseeKey(u32 npDrmKeyAddr) { isLicenseeKeySet = true; return hleLogInfo(Log::sceIo, 0); } - return hleLogError(Log::sceIo, ERROR_NPDRM_INVALID_FILE, "Invalid address"); + return hleLogError(Log::sceIo, SCE_NPDRM_ERROR_INVALID_FILE, "Invalid address"); } static int sceNpDrmClearLicenseeKey() { @@ -85,7 +80,7 @@ static int sceNpDrmEdataSetupKey(u32 edataFd) { // Return an error if the key has not been set. // Note: An empty key is valid, as long as it was set with sceNpDrmSetLicenseeKey. if (!isLicenseeKeySet) { - return hleLogError(Log::sceIo, ERROR_NPDRM_NO_K_LICENSEE_SET, "Licensee key not set"); + return hleLogError(Log::sceIo, SCE_NPDRM_ERROR_NO_K_LICENSEE_SET, "Licensee key not set"); } // Get file info to validate the file descriptor @@ -129,8 +124,7 @@ static int sceNpDrmEdataGetDataSize(u32 edataFd) { } static int sceNpDrmOpen() { - ERROR_LOG(Log::sceIo, "UNIMPL: sceNpDrmOpen()"); - return 0; + return hleLogError(Log::sceIo, 0, "UNIMPL: sceNpDrmOpen()"); } const HLEFunction sceNpDrm[] = {