feat(libSceNpTrophy2): read the game, group, trophy and reward icons from trophyNN.ucp #19532
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/19532"
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 Superseabas on 2026-11-13T13:44:09Z.
What
sceNpTrophy2GetGameIcon,sceNpTrophy2GetGroupIcon,sceNpTrophy2GetTrophyIconandsceNpTrophy2GetRewardIconnow return the title's own icons fromsce_sys/trophy2/trophyNN.ucp. Onmain, the first three stop the title with "icon file not found", and the reward icon is never found. #7262, which added the package reader, left icons out because the names of the icon files inside the package weren't known.The names. They come from one real package: the decrypted example
trophy00.ucpin PS5TrophyExtract0r (Unlicense). It is NPWR18437_00, whosetropmeta_en-US.jsontitles it "Unity PSN Sample PSN App", so it's Unity's PSN sample app, not a retail game. Its 13 files, listed with this PR's reader:icon0_en-US.pnggr0001_en-US.png0001, the only group intropconf.jsontrop0000.png…trop0007.pngtropconf.jsonlists trophies0000to0007reward0007.png0007's reward; it is the only trophy with"hasReward": truetropconf.json,tropmeta_en-US.jsonmainEvery PNG is 512×512. The game and group icons carry a language tag, and the trophy and reward icons don't. No file is an icon for the base game group (-1). The package itself isn't added to the repository; the tests build their own.
The calls.
en-US, then the package'sdefaultLanguage.SCE_NP_TROPHY2_OK. PPSA06888'sPSNCore.prxasks for the reward icon this way (#8218), and the PS4 trophy icons here work the same.GuestArena::HostWrite, as the PS4 icon copy does, and the size is written.SCE_NP_TROPHY2_ERROR_ICON_FILE_NOT_FOUND, as #15314 does today.sizeis read and written throughGuestCopyIn_nid_no_patchandGuestCopyOut_nid_no_patch. An unreadable or unwritablesizethrowsstd::invalid_argumentnaming the export, asmain's otherlibSceNpTrophy2exports do, including #20612's not-found answer that this PR replaces.NpTrophy2::CopyIconinTitleTrophies.cpp.Unknown, so it throws or is recorded in the debt entry:
The debt changes are a fragment,
docs/dev/debt/changes/feat-trophy2-icons.md. It removes thesceNpTrophy2GetRewardIconentry under Silent stubs, drops "Icons are not read." from Trophy queries, and adds a "Trophy icons" entry under Functional.USAGE.mdnow says where the icons come from.Tested
Setup: Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (
x86_64-ucrt-posix-seh, r3), CMake 4.4.4, Ninja 1.13.2, Release, the full build freshly configured, run from PowerShell. The branch is #15314 merged in, thenmainmerged in, most recentlydba15c40ac.nptrophy2|np_trophy2|np_uds|np_trophy_(unlocks|data|stats)): 9 of 9 pass, in 3 of 3 runs. That'sguest_nptrophy2,np_trophy2_store,np_trophy2_package,np_uds_events,guest_np_trophy_unlocks,guest_np_trophy_data,guest_np_trophy_stats,guest_np_uds_recordsandguest_np_uds_queries.np_trophy2_packagechecks the icon names, the language order and the default-language fallback. It also checks that files which aren't the icon of the game, a group in use or a trophy are left out, such asicon0.png,trop1.png,TROP0002.PNGand a trophy not intropconf.json.guest_np_trophy_datacalls the four exports as a title would:sizefor each export: for an icon that exists, one that is missing, and a copy into a buffer, witherrnokept;guest_np_trophy_datafails with "the game, group 1 or trophy 1 icon was not the package's file". With the package reader from before this PR,np_trophy2_packagefails with "the icons were not read by their names…" andguest_np_trophy_datafails as above. The other 7 tests pass in both. WithCopyIconreading and writing*sizedirectly, as before,guest_np_trophy_datacrashes with0xc0000005at the unwritablesize.mainand merged into this branch (3cd69080dd). Its four not-found bodies are replaced by this PR'sCopyIconcalls, and its new unwritable-sizechecks inguest_nptrophy2pass against this code. The trophy set passes 9 of 9 in 3 of 3 runs on that merge.ParseTrophyPackagein a local probe (not committed), it gives the game icon (11469 bytes, a PNG), the group 1 icon (12604), an icon for each of trophies 0 to 7 (11737 to 16171), the reward icon for trophy 7 only (14960), and no icon for group -1.tools/check_conventions.py --base upstream/mainandtools/debt_fold.py --checkpass. Before #20612 merged,tools/pr_overlap.py --branchreported it, as above. It could not comparedocs/user/USAGE.mdwith 20 open PRs that conflict withmain, norTitleTrophies.cppwith #20315. I compared them by hand: none of theirUSAGE.mdchanges touches trophy text, and #20315'sTitleTrophies.cpphunks are in the file loading, away fromCopyIcon.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T04:36:28Z.
Review: APPROVED
Reviewed — looks good
The changed code and tests support merging the icon loading and query behavior at head
3cd69080ddc4918abed0ddafb4ab91db3e242c89; I found no verified blocking defect.What I ran
TitleTrophies.hpp,TrophyPackage.hpp,Context.cpp,GameInfo.cpp,GroupInfo.cpp,TitleTrophies.cpp,TrophyInfo.cpp,TrophyPackage.cpp,tests/TrophyPackage.cpp,GuestNpTrophy2.cpp,GuestNpTrophyData.cpp,docs/dev/debt/changes/feat-trophy2-icons.md, anddocs/user/USAGE.md.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not run the tests, build, or convention checks. I did not verify behavior on a console, Linux, macOS, or retail trophy packages; these are also identified as untested in the description.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T11:12:25Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this review; the reported Windows checks are author supplied, and the review bundle does not include their output.
What I ran
No tests or build commands were run. I inspected the prepared diff and targeted changed code at head
8f1eea384bdba82485d9cde85e4531225756c42dusingrepo_read.py.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
I did not read every changed line listed in the review manifest, including portions of the guest tests and documentation. I did not independently run the build, tests, platform checks, or console behavior. Files read:
description.md,commits.md,manifest.json,diff.patch,README.md,TitleTrophies.hpp,TrophyPackage.hpp,TitleTrophies.cpp,TrophyPackage.cpp, andGuestNpTrophyData.cpp. The changed files in the manifest not fully read wereContext.cpp,GameInfo.cpp,GroupInfo.cpp,TrophyInfo.cpp,TrophyPackage.cpptests,GuestNpTrophy2.cpp,feat-trophy2-icons.md,libSceNpTrophy2.md, andUSAGE.md.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-27T18:51:25Z.
Review: COMMENTED
Actionable comments posted: 3
6a994c89-8c5b-48ed-a264-c5518d38afb8Reviewing files that changed from the base of the PR and between
9f12ec0e38and2f55e86f54.core/libs/prx/libSceNpTrophy2/include/TitleTrophies.hppcore/libs/prx/libSceNpTrophy2/include/TrophyPackage.hppcore/libs/prx/libSceNpTrophy2/src/Context.cppcore/libs/prx/libSceNpTrophy2/src/GameInfo.cppcore/libs/prx/libSceNpTrophy2/src/GroupInfo.cppcore/libs/prx/libSceNpTrophy2/src/TitleTrophies.cppcore/libs/prx/libSceNpTrophy2/src/TrophyInfo.cppcore/libs/prx/libSceNpTrophy2/src/TrophyPackage.cppcore/libs/prx/libSceNpTrophy2/tests/TrophyPackage.cppcore/libs/tests/GuestNpTrophy2.cppcore/libs/tests/GuestNpTrophyData.cppdocs/dev/debt/changes/feat-trophy2-icons.mddocs/dev/debt/libSceNpTrophy2.mddocs/user/USAGE.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T19:19:41Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the icon lookup, guest-memory handling, and hidden-trophy checks are consistent with the stated behavior.
What I ran
Reviewed head
2f55e86f54cbddfa98c6f6fb96230bdff7f2f2f0using the prepared diff andrepo_read.py. No commands or tests were run; no merged-preview check was performed.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
No test binaries or convention checks were run. The author-reported Windows test results, behavior on Linux and macOS, and behavior with retail trophy packages were not independently verified. The
files.jsonartifact was not available as a review document; the manifest and file listing show all 14 changed files included, and all 14 were read. Excluded files: none indicated.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T19:53:35Z.
Review: COMMENTED
Reviewed — comments
The review covers the icon loading and export paths, but does not verify every changed file or run the reported checks, so a formal approval is not justified.
What I ran
Reviewed head
9982e83b26fc9a0338afc2c0332df5a4ced889a8using the prepared diff andrepo_read.py. No tests or other commands were run.Results
Findings
Blocking
None identified in the inspected code.
Non-blocking
TrophyPackage.cpp:668records arewardNNNN.pngfor every trophy ID found in the package, without checkingTrophyDefinition::hasReward. Consider requiringhasRewardbefore exposing the icon, so an extra reward file cannot make a trophy without a configured reward appear to have one.Not verified
The full text was read for
TitleTrophies.hpp,TrophyPackage.hpp,TitleTrophies.cpp, andTrophyPackage.cpp. The diff was read for all changed files listed in the manifest, and all 14 changed files are marked included there. Full source text for the other 10 changed files was not read. Tests, build, platform behavior, and console behavior were not verified.To get this to a good state
Nothing is required. The reward icon observation is optional.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T13:02:26Z.
Review: COMMENTED
Built the changed sources and ran the dedicated
TrophyPackagefixture on Linux against the existing runtime. The package and icon checks passed. This run covers the package fixture.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.