From 2e53d2f9f955566bcdbeb98fa57dba6fef8fc883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 1 Nov 2024 20:10:10 +0100 Subject: [PATCH] NPDRM: Logging cleanup, remove assert (turn into debug assert) --- Core/FileSystems/BlockDevices.cpp | 6 ++++-- Core/HLE/scePspNpDrm_user.cpp | 36 ++++++++++++------------------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/Core/FileSystems/BlockDevices.cpp b/Core/FileSystems/BlockDevices.cpp index 4b968722d7..8a7f55be88 100644 --- a/Core/FileSystems/BlockDevices.cpp +++ b/Core/FileSystems/BlockDevices.cpp @@ -428,10 +428,12 @@ NPDRMDemoBlockDevice::NPDRMDemoBlockDevice(FileLoader *fileLoader) memcpy(psarStr, &psar_id, 4); // Protect against a badly decrypted header, and send information through the assert about what's being played (implicitly). - _assert_msg_(blockLBAs_ <= 4096, "Bad blockLBAs in header: %08x (%s) psar: %s", blockLBAs_, fileLoader->GetPath().ToVisualString().c_str(), psarStr); + _dbg_assert_msg_(blockLBAs_ <= 4096, "Bad blockLBAs in header: %08x (%s) psar: %s", blockLBAs_, fileLoader->GetPath().ToVisualString().c_str(), psarStr); // When we remove the above assert, let's just try to survive. if (blockLBAs_ > 4096) { + ERROR_LOG(Log::Loader, "Bad blockLBAs in header: %08x (%s) psar: %s", blockLBAs_, fileLoader->GetPath().ToVisualString().c_str(), psarStr); + // We'll end up displaying an error message since ReadBlock will fail. return; } @@ -447,7 +449,7 @@ NPDRMDemoBlockDevice::NPDRMDemoBlockDevice(FileLoader *fileLoader) table_ = new table_info[numBlocks_]; readSize = fileLoader_->ReadAt(psarOffset + tableOffset_, 1, tableSize_, table_); - if (readSize!=tableSize_){ + if (readSize != tableSize_){ ERROR_LOG(Log::Loader, "Invalid NPUMDIMG table!"); } diff --git a/Core/HLE/scePspNpDrm_user.cpp b/Core/HLE/scePspNpDrm_user.cpp index b81d92a601..d8194c8904 100644 --- a/Core/HLE/scePspNpDrm_user.cpp +++ b/Core/HLE/scePspNpDrm_user.cpp @@ -4,27 +4,23 @@ #include "Core/HLE/FunctionWrappers.h" #include "Core/HLE/sceIo.h" -static int sceNpDrmSetLicenseeKey(u32 npDrmKeyAddr) -{ - INFO_LOG(Log::HLE, "call sceNpDrmSetLicenseeKey(%08x)", npDrmKeyAddr); +static int sceNpDrmSetLicenseeKey(u32 npDrmKeyAddr) { + WARN_LOG(Log::HLE, "UNIMPL: sceNpDrmSetLicenseeKey(%08x)", npDrmKeyAddr); return 0; } -static int sceNpDrmClearLicenseeKey() -{ - INFO_LOG(Log::HLE, "call sceNpDrmClearLicenseeKey()"); +static int sceNpDrmClearLicenseeKey() { + WARN_LOG(Log::HLE, "UNIMPL: sceNpDrmClearLicenseeKey()"); return 0; } -static int sceNpDrmRenameCheck(const char *filename) -{ - INFO_LOG(Log::HLE, "call sceNpDrmRenameCheck(%s)", filename); +static int sceNpDrmRenameCheck(const char *filename) { + WARN_LOG(Log::HLE, "UNIMPL: sceNpDrmRenameCheck(%s)", filename); return 0; } -static int sceNpDrmEdataSetupKey(u32 edataFd) -{ - INFO_LOG(Log::HLE, "call sceNpDrmEdataSetupKey %x", edataFd); +static int sceNpDrmEdataSetupKey(u32 edataFd) { + INFO_LOG(Log::HLE, "sceNpDrmEdataSetupKey(%x)", edataFd); int usec = 0; // set PGD offset int retval = __IoIoctl(edataFd, 0x04100002, 0x90, 0, 0, 0, usec); @@ -37,20 +33,17 @@ static int sceNpDrmEdataSetupKey(u32 edataFd) return hleDelayResult(retval, "io ctrl command", usec); } -static int sceNpDrmEdataGetDataSize(u32 edataFd) -{ - INFO_LOG(Log::HLE, "call sceNpDrmEdataGetDataSize %x", edataFd); +static int sceNpDrmEdataGetDataSize(u32 edataFd) { + INFO_LOG(Log::HLE, "sceNpDrmEdataGetDataSize %x", edataFd); return sceIoIoctl(edataFd, 0x04100010, 0, 0, 0, 0); } -static int sceNpDrmOpen() -{ - ERROR_LOG(Log::HLE, "UNIMPL sceNpDrmOpen"); +static int sceNpDrmOpen() { + ERROR_LOG(Log::HLE, "UNIMPL: sceNpDrmOpen()"); return 0; } -const HLEFunction sceNpDrm[] = -{ +const HLEFunction sceNpDrm[] = { {0XA1336091, &WrapI_U, "sceNpDrmSetLicenseeKey", 'i', "x"}, {0X9B745542, &WrapI_V, "sceNpDrmClearLicenseeKey", 'i', "" }, {0X275987D1, &WrapI_C, "sceNpDrmRenameCheck", 'i', "s"}, @@ -59,8 +52,7 @@ const HLEFunction sceNpDrm[] = {0X2BAA4294, &WrapI_V, "sceNpDrmOpen", 'i', "" }, }; -void Register_sceNpDrm() -{ +void Register_sceNpDrm() { RegisterModule("sceNpDrm", ARRAY_SIZE(sceNpDrm), sceNpDrm); RegisterModule("scePspNpDrm_user", ARRAY_SIZE(sceNpDrm), sceNpDrm); }