feat(libSceNpTrophy2): implement sceNpTrophy2GetRewardIcon #8218
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8218"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by jagrat04 on 2026-10-20T03:58:43Z.
What
Implement
sceNpTrophy2GetRewardIconincore/libs/prx/libSceNpTrophy2/src/Context.cpp:SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND(-2141898479 /0x80553911).(int context, int handle, int reward_id, void* buffer, size_t* size)signature and two-stage query pattern follow PPSA06888 (Media/Plugins/PSNCore.prx) and SharpProspero (NpTrophy2.cs). ReturningSCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUNDwhen icons are unavailable offline is inferred from sibling calls (sceNpTrophy2GetGameIcon,sceNpTrophy2GetGroupIcon,sceNpTrophy2GetTrophyIcon) in KytyPS5 (src/libs/libTrophy.cpp:464/483/502).Media/Plugins/PSNCore.prx), this reward notification path specifically invokessceNpTrophy2GetRewardIconwithout calling the other icon functions in that sequence. Aligning the sibling functions (GetGameIcon,GetGroupIcon,GetTrophyIcon) to return this error code instead of throwing will follow in a separate PR per the one-topic-per-PR guideline.core/libs/tests/GuestNpTrophy2.cppverifying that callingsceNpTrophy2GetRewardIconsets size to 0 and returnsSCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND.docs/dev/debt/libSceNpTrophy2.mdunderSilent stubs.Tested
ninja -C build libSceNpTrophy2 guest_nptrophy2_testsbuilt cleanly;ctest --test-dir build -V -R guest_nptrophy2passed (1/1 tests passed 100%).ninja -C build-linux libSceNpTrophy2 guest_nptrophy2_testsbuilt cleanly;ctest --test-dir build-linux -V -R guest_nptrophy2passed (1/1 tests passed 100%).python tools/check_conventions.py --base origin/main: passed with 0 violations.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T03:59:28Z.
Progress report (
dce41a8→36bc227)📈 System libraries: 42.34% (+0.01%, +1 implemented functions)
✅ 1 implemented
sceNpTrophy2GetRewardIconImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T01:31:42Z.
@jagrat04 thanks for looking at this one. As written it isn't an implementation yet:
sceNpTrophy2GetRewardIconstill throws on every call, so a title that calls it stops exactly as before. The only differences are that the message now looks like a missing-file error, and the unimplemented path no longer usesNotImplemented_nid_no_patch, which CONTRIBUTING asks for so these paths stay easy to find.Two ways forward:
NotImplemented_nid_no_patchuntil that behaviour is known.Imported from boykopovar/AnyPS5. Originally posted by jagrat04 on 2026-10-21T10:02:05Z.
@oneandonlydean Thanks for the feedback! I went with Option 1:
std::runtime_error. When icons are missing or unavailable offline, the API returnsSCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND(-2141898479/0x80553911) and zeroes*size = 0. This is the authentic behavior defined in KytyPS5 (src/libs/libTrophy.cppline 25:NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND = -2141898479) and matches AnyPS5's existingSCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUNDinNpTrophy2Constants.hpp. Returning this error code allows titles like PPSA06888 to gracefully handle missing icons instead of terminating.(int context, int handle, int reward_id, void* buffer, size_t* size)from the call sites inMedia/Plugins/PSNCore.prx(PPSA06888) and SharpProsperoNpTrophy2.cs.GuestNpTrophy2.cppto assertSCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUNDandsize == 0, and documented it underSilent stubsindocs/dev/debt/libSceNpTrophy2.md.main.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-21T10:11:44Z.
@jagrat04 thanks, the code matches what we asked for:
*sizeis zeroed, the error is returned, and both the size andnullptrcases are tested.Two things before CI:
NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUNDfromGetGameIcon,GetGroupIconandGetTrophyIcon(libTrophy.cpp:464/483/502), but it doesn't implementsceNpTrophy2GetRewardIcon, so the reward-icon result is inferred from those three. Here, those three still throw after zeroingsize(GameInfo.cpp:66, GroupInfo.cpp:111, TrophyInfo.cpp:117). Does the title (PPSA06888) call any of them as well? If it does, it will still stop at the first one, and the three probably want the same change as this one, in this PR or a follow-up. If it only calls the reward icon, please say so in the description, and say that the value comes from the sibling calls.mainindocs/dev/debt/libSceNpTrophy2.md(703 commits behind). Could you merge or rebase currentmainagain?Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-21T10:42:06Z.
Review: CHANGES_REQUESTED
Following up on @oneandonlydean's open points, which are still unanswered:
ICON_FILE_NOT_FOUNDreturn "follows KytyPS5", but KytyPS5 has nosceNpTrophy2GetRewardIcon; it returns that code only fromGetGameIcon/GetGroupIcon/GetTrophyIcon(libTrophy.cpp:464/483/502). Please say in the description and indocs/dev/debt/libSceNpTrophy2.mdthat the value is inferred from those sibling calls.GetGameIcon,GetGroupIconandGetTrophyIconstill throw after zeroingsize(GameInfo.cpp:66, GroupInfo.cpp:111, TrophyInfo.cpp:117). Does PPSA06888 call any of them? If so it still stops at the first, and they likely want the same change here or in a follow-up.mainindocs/dev/debt/libSceNpTrophy2.md; please rebase.The code and the test (
*sizezeroed, both the size andnullptrcases) look right otherwise.Imported from boykopovar/AnyPS5. Originally posted by jagrat04 on 2026-10-21T14:51:06Z.
@adriadam10 @oneandonlydean Thanks for the reviews!
docs/dev/debt/libSceNpTrophy2.mdto clarify thatSCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUNDis inferred from the sibling calls (sceNpTrophy2GetGameIcon,sceNpTrophy2GetGroupIcon,sceNpTrophy2GetTrophyIcon) in KytyPS5 (libTrophy.cpp:464/483/502), as KytyPS5 does not havesceNpTrophy2GetRewardIcon. PPSA06888 specifically callssceNpTrophy2GetRewardIconthroughPSNCore.prx. Aligning those three sibling calls to returnSCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUNDinstead of throwing will follow in a separate PR to keep this PR strictly scoped to implementingsceNpTrophy2GetRewardIcon(one topic per PR).origin/mainindocs/dev/debt/libSceNpTrophy2.mdand rebased onto latestmain. All conventions and guest unit tests continue to pass cleanly.Imported from boykopovar/AnyPS5. Originally posted by jagrat04 on 2026-10-22T08:17:45Z.
@adriadam10 @oneandonlydean Thanks for the review and feedback!
docs/dev/debt/libSceNpTrophy2.mdto explicitly state that returningSCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND(-2141898479/0x80553911) is inferred from the sibling calls (sceNpTrophy2GetGameIcon,sceNpTrophy2GetGroupIcon,sceNpTrophy2GetTrophyIcon) in KytyPS5 (libTrophy.cpp:464/483/502).Media/Plugins/PSNCore.prx), this trophy reward notification path specifically queriessceNpTrophy2GetRewardIcon(first withnullptrto retrieve size, then with allocated buffer). It does not invokeGetGameIcon,GetGroupIcon, orGetTrophyIconduring that sequence. Updating those sibling calls to return this error code instead of throwing is definitely a sensible improvement and will follow in a separate PR per the one-topic-per-PR rule.main(36bc227284), all merge conflicts resolved, conventions verified, and tests passed 100%.