feat(libSceNpTrophy): add sceNpTrophyAbortHandle #9871

Merged
ntamas94 merged 4 commits from upstream-pr/9871 into main 2026-10-26 12:38:34 +00:00
ntamas94 commented 2026-10-22 20:08:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ntamas94 on 2026-10-22T20:08:15Z.


What

Adds sceNpTrophyAbortHandle, which both measured PS4 titles (CUSA04865, CUSA12435) import and which the library did not export. On a PS4 Pro with firmware 10.71 a live handle answers 0 and an unknown or destroyed handle 0x80551608 (NP_TROPHY_ERROR_INVALID_HANDLE). After an abort the calls that use the handle answer 0x80551607 (NP_TROPHY_ERROR_ABORT), ahead of the not-registered check, until the handle is destroyed, and sceNpTrophyRegisterContext answers it ahead of a missing trophy package; aborting again answers 0. sceNpTrophyRegisterContext, sceNpTrophyGetTrophyUnlockState and sceNpTrophyGetGameIcon are measured; the other calls follow the same rule, as the firmware 10.71 libSceNpTrophy.sprx maps the service's abort answer to 0x80551607 on the request path they share (recorded in docs/dev/debt/libSceNpTrophy.md). The guest test gains rows for a live handle, the handles 999 and -1, a destroyed handle, the calls through an aborted handle, a second abort, and a second handle that keeps working.

Tested

Windows 11: guest_np_trophy passed. The return values were measured on a PS4 Pro (firmware 10.71) with a homebrew probe: live handle 0, unknown handle 0x80551608, and after an abort 0x80551607 from sceNpTrophyRegisterContext, sceNpTrophyGetTrophyUnlockState and sceNpTrophyGetGameIcon where a second, live handle gets 0x80551626 and 0x8055160F (the probe app has an NP title id from its nptitle.dat, as a title does); guest_np_trophy aborts on the abort rows without the change. The same probe compiled against this branch on the host gives the same three rows. Not run with a title.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4973433640 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9871). Originally posted by [ntamas94](https://github.com/ntamas94) on 2026-10-22T20:08:15Z. --- ### What Adds `sceNpTrophyAbortHandle`, which both measured PS4 titles (CUSA04865, CUSA12435) import and which the library did not export. On a PS4 Pro with firmware 10.71 a live handle answers 0 and an unknown or destroyed handle 0x80551608 (`NP_TROPHY_ERROR_INVALID_HANDLE`). After an abort the calls that use the handle answer 0x80551607 (`NP_TROPHY_ERROR_ABORT`), ahead of the not-registered check, until the handle is destroyed, and `sceNpTrophyRegisterContext` answers it ahead of a missing trophy package; aborting again answers 0. `sceNpTrophyRegisterContext`, `sceNpTrophyGetTrophyUnlockState` and `sceNpTrophyGetGameIcon` are measured; the other calls follow the same rule, as the firmware 10.71 `libSceNpTrophy.sprx` maps the service's abort answer to 0x80551607 on the request path they share (recorded in `docs/dev/debt/libSceNpTrophy.md`). The guest test gains rows for a live handle, the handles 999 and -1, a destroyed handle, the calls through an aborted handle, a second abort, and a second handle that keeps working. ### Tested Windows 11: `guest_np_trophy` passed. The return values were measured on a PS4 Pro (firmware 10.71) with a homebrew probe: live handle 0, unknown handle 0x80551608, and after an abort 0x80551607 from `sceNpTrophyRegisterContext`, `sceNpTrophyGetTrophyUnlockState` and `sceNpTrophyGetGameIcon` where a second, live handle gets 0x80551626 and 0x8055160F (the probe app has an NP title id from its `nptitle.dat`, as a title does); `guest_np_trophy` aborts on the abort rows without the change. The same probe compiled against this branch on the host gives the same three rows. Not run with a title. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-22 20:10:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T20:10:49Z.

Review: DISMISSED


I compared the change with the checked-in libSceNpTrophy implementation and its registered guest test. The live-handle behavior is internally consistent: sceNpTrophyAbortHandle locks the same mutex and checks the same handle map used by create/destroy, and the test covers live, unknown, negative, and destroyed handles. The PR reports a PS4 Pro firmware 10.71 probe for those return values, which is useful hardware evidence.

I could not independently run guest_np_trophy in this Linux checkout: there is no configured build directory, and the hosted PR run skipped the Linux and Windows product jobs. The passing checks are conventions, eligibility, intake, labels and report only. Please attach or link the probe procedure/output (without private console data) and arrange the focused guest test on a supported build before merge; state the result on the final head. The report says both titles import the export, but says neither has a Game bring-up discussion yet, so please use Unblocks: none unless the required discussion exists. The PR currently checks that checklist item despite no discussion being identified.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5620226278 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9871#pullrequestreview-5620226278). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T20:10:49Z. **Review:** DISMISSED --- I compared the change with the checked-in `libSceNpTrophy` implementation and its registered guest test. The live-handle behavior is internally consistent: `sceNpTrophyAbortHandle` locks the same mutex and checks the same handle map used by create/destroy, and the test covers live, unknown, negative, and destroyed handles. The PR reports a PS4 Pro firmware 10.71 probe for those return values, which is useful hardware evidence. I could not independently run `guest_np_trophy` in this Linux checkout: there is no configured build directory, and the hosted PR run skipped the Linux and Windows product jobs. The passing checks are conventions, eligibility, intake, labels and report only. Please attach or link the probe procedure/output (without private console data) and arrange the focused guest test on a supported build before merge; state the result on the final head. The report says both titles import the export, but says neither has a Game bring-up discussion yet, so please use `Unblocks: none` unless the required discussion exists. The PR currently checks that checklist item despite no discussion being identified.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!9871
No description provided.