From da29f8cf3fdd35e995f0eaab34e430f22a5493bb Mon Sep 17 00:00:00 2001 From: MarcZX10 <67475268+MarcZX10@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:47:54 +0000 Subject: [PATCH 1/3] fix(libSceNpTrophy2): return the icon error code instead of throwing sceNpTrophy2GetGameIcon, sceNpTrophy2GetGroupIcon and sceNpTrophy2GetTrophyIcon throw std::runtime_error when no icon is read. A throw escapes the C ABI and stops the title, while the sibling sceNpTrophy2GetRewardIcon zeroes the size and returns SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND, which the technical debt entry for libSceNpTrophy2 cites as the expected result of these calls. The three functions now zero the size and return the same error code. --- core/libs/prx/libSceNpTrophy2/src/GameInfo.cpp | 2 +- core/libs/prx/libSceNpTrophy2/src/GroupInfo.cpp | 2 +- core/libs/prx/libSceNpTrophy2/src/TrophyInfo.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/libs/prx/libSceNpTrophy2/src/GameInfo.cpp b/core/libs/prx/libSceNpTrophy2/src/GameInfo.cpp index 4e7c77100317..0a31bae46a03 100644 --- a/core/libs/prx/libSceNpTrophy2/src/GameInfo.cpp +++ b/core/libs/prx/libSceNpTrophy2/src/GameInfo.cpp @@ -71,7 +71,7 @@ int APS5_VABI sceNpTrophy2GetGameIcon(int context, int handle, void* buffer, siz if (size != nullptr) { *size = NP_TROPHY2_ICON_SIZE_NONE; } - throw std::runtime_error(std::string(__func__) + ": icon file not found"); + return SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND; } int APS5_VABI sceNpTrophy2RegisterUnlockCallback(void* callback, void* userdata) { diff --git a/core/libs/prx/libSceNpTrophy2/src/GroupInfo.cpp b/core/libs/prx/libSceNpTrophy2/src/GroupInfo.cpp index d06dc60177cd..bfcf3829aa60 100644 --- a/core/libs/prx/libSceNpTrophy2/src/GroupInfo.cpp +++ b/core/libs/prx/libSceNpTrophy2/src/GroupInfo.cpp @@ -117,7 +117,7 @@ int APS5_VABI sceNpTrophy2GetGroupIcon(int context, int handle, int group_id, vo if (size != nullptr) { *size = NP_TROPHY2_ICON_SIZE_NONE; } - throw std::runtime_error(std::string(__func__) + ": icon file not found"); + return SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND; } } diff --git a/core/libs/prx/libSceNpTrophy2/src/TrophyInfo.cpp b/core/libs/prx/libSceNpTrophy2/src/TrophyInfo.cpp index 1cabae19e7b6..81a2b5cc3a39 100644 --- a/core/libs/prx/libSceNpTrophy2/src/TrophyInfo.cpp +++ b/core/libs/prx/libSceNpTrophy2/src/TrophyInfo.cpp @@ -121,7 +121,7 @@ int APS5_VABI sceNpTrophy2GetTrophyIcon(int context, int handle, int trophy_id, if (size != nullptr) { *size = NP_TROPHY2_ICON_SIZE_NONE; } - throw std::runtime_error(std::string(__func__) + ": icon file not found"); + return SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND; } } From 96a5aaec7d7af072aa8acd18aea2308c81833a5f Mon Sep 17 00:00:00 2001 From: MarcZX10 <67475268+MarcZX10@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:47:55 +0000 Subject: [PATCH 2/3] test(libSceNpTrophy2): cover the game, group and trophy icon error codes The guest test checks that the three icon queries that have no icon file return SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND with a zero size, which the throwing versions did not satisfy. --- core/libs/tests/GuestNpTrophy2.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/libs/tests/GuestNpTrophy2.cpp b/core/libs/tests/GuestNpTrophy2.cpp index 923c21abd201..835504b1741a 100644 --- a/core/libs/tests/GuestNpTrophy2.cpp +++ b/core/libs/tests/GuestNpTrophy2.cpp @@ -58,6 +58,16 @@ int main() { Require(sceNpTrophy2GetRewardIcon(1, 1, 1, nullptr, &iconSize) == SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND); Require(iconSize == 0); Require(sceNpTrophy2GetRewardIcon(1, 1, 1, nullptr, nullptr) == SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND); + std::size_t gameIconSize = 1234; + Require(sceNpTrophy2GetGameIcon(1, 1, nullptr, &gameIconSize) == SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND); + Require(gameIconSize == 0); + std::size_t groupIconSize = 1234; + Require(sceNpTrophy2GetGroupIcon(1, 1, 2, nullptr, &groupIconSize) == SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND); + Require(groupIconSize == 0); + std::size_t trophyIconSize = 1234; + Require(sceNpTrophy2GetTrophyIcon(1, 1, 3, nullptr, &trophyIconSize) == SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND); + Require(trophyIconSize == 0); + Require(sceNpTrophy2GetTrophyIcon(1, 1, 3, nullptr, nullptr) == SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND); int handle = -1; Require(sceNpTrophy2CreateHandle(&handle) == SCE_NP_TROPHY2_OK); From a06a91ae53144a79426b006fb4c64b6d765dba0b Mon Sep 17 00:00:00 2001 From: MarcZX100 Date: Mon, 23 Nov 2026 23:42:42 +0100 Subject: [PATCH 3/3] docs(libSceNpTrophy2): record the unconditional icon error answers Co-Authored-By: Claude Haiku 5.5 --- docs/dev/debt/libSceNpTrophy2.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/dev/debt/libSceNpTrophy2.md b/docs/dev/debt/libSceNpTrophy2.md index 18b4250235a8..b2cc150cb3ed 100644 --- a/docs/dev/debt/libSceNpTrophy2.md +++ b/docs/dev/debt/libSceNpTrophy2.md @@ -2,6 +2,7 @@ ### Silent stubs +- [sceNpTrophy2GetGameIcon](../../../core/libs/prx/libSceNpTrophy2/src/GameInfo.cpp), [sceNpTrophy2GetGroupIcon](../../../core/libs/prx/libSceNpTrophy2/src/GroupInfo.cpp) and [sceNpTrophy2GetTrophyIcon](../../../core/libs/prx/libSceNpTrophy2/src/TrophyInfo.cpp) (libSceNpTrophy2) - zero the size and return `SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND` (-2141898479, 0x80553911) whether or not an icon exists: no file is read, and the context, handle, id and buffer are ignored. The error value is inferred from the sibling calls in KytyPS5 (libTrophy.cpp:464/483/502), as for the entry below; the console's answer is not measured. - [sceNpTrophy2GetRewardIcon](../../../core/libs/prx/libSceNpTrophy2/src/Context.cpp) (libSceNpTrophy2) - zeroes size and returns `SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND` (-2141898479): the `(int context, int handle, int reward_id, void* buffer, size_t* size)` signature and two-stage query pattern follow the bundled `Media/Plugins/PSNCore.prx` of PPSA06888 and SharpProspero; returning -2141898479 (0x80553911) when icons are unavailable is inferred from sibling calls (sceNpTrophy2GetGameIcon, sceNpTrophy2GetGroupIcon, sceNpTrophy2GetTrophyIcon) in KytyPS5 (libTrophy.cpp:464/483/502) - [libSceNpTrophy2](../../../core/libs/prx/libSceNpTrophy2/src/GameInfo.cpp): `sceNpTrophy2RegisterUnlockCallback` accepts a callback that is never called, as the callback's signature and when the console calls it are not known, `sceNpTrophy2UnregisterUnlockCallback` only returns success, and `sceNpTrophy2ShowTrophyList` returns success without showing a list (there is no system trophy UI; seen on PPSA15552). - [sceNpTrophy2RegisterContext](../../../core/libs/prx/libSceNpTrophy2/src/Context.cpp) (libSceNpTrophy2) - returns `SCE_NP_TROPHY2_OK` and ignores its arguments: it checks neither the context nor the handle and records nothing. Eight titles in my set call it.