fix(libSceNpTrophy2): return errors instead of throwing across the C ABI #15019
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15019"
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 MarcZX10 on 2026-11-02T10:34:44Z.
What
Three
extern "C"trophy exports let C++ exceptions cross the C ABI into the title. Two are real defects and are fixed here; the third was checked and dropped.NpTrophy2RecordUnlockwith a negative trophy id reachedTrophyStore::Unlock, which throwsstd::invalid_argument. With no trophy package loaded the posted-unlock check is skipped, so this was reachable without trophy data. Fix: refuse negative ids in the export and returnfalse(commite65aec5, test95ac706).NpTrophy2RemoveUnlockListenerthrewstd::invalid_argumentfor an id that is not registered. The export isvoid, so there is no status to return. Fix: an unknown id is a no-op (commitad7a9b9, test81de924). The existing store test pinned the throw; it now checks that the second removal does not throw.Dropped:
TitleTrophies.cppfile_sizemay throwfilesystem_error.filesystem_errorderives fromstd::system_error, which derives fromstd::runtime_error, andloadTitleFilecatchesstd::runtime_error, so the exception does not escape.Commits:
e65aec5fix(libSceNpTrophy2): return false for a negative trophy id instead of throwing95ac706test(libSceNpTrophy2): cover a negative trophy id in NpTrophy2RecordUnlockad7a9b9fix(libSceNpTrophy2): ignore an unknown listener id in RemoveUnlockListener81de924test(libSceNpTrophy2): expect no throw when a listener is removed twiceTested
Linux archive build on this host (kernel 6.1), run through the shared build lock with
run_tests.sh '^np_trophy2_store$' np_trophy2_store_tests:BUILD-EXIT 0,1/1 Test #2459: np_trophy2_store ... Passed, 100% passed.python3 tools/check_conventions.py --base upstream/mainclean;git diff --check upstream/mainclean.Not run against the unfixed code (no negative control was executed). Not run:
guest_nptrophy2, Windows, macOS, a title.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 mashingaan on 2026-11-02T11:36:26Z.
Review: APPROVED
Reviewed head
81de9243d2. Both changed C ABI paths now avoid exceptions for invalid trophy IDs and repeated listener removal, and the added cases cover both regressions. Hosted Windows and required workflow checks pass on this exact head.