Skip to content

feat(libSceNpScoreRanking): model the score requests offline - #9894

Merged
oneandonlydean merged 2 commits into
boykopovar:mainfrom
MarrasFederico:feat/np-score-ranking-offline
Oct 24, 2026
Merged

oneandonlydean merged 2 commits into
boykopovar:mainfrom
MarrasFederico:feat/np-score-ranking-offline

Conversation

@MarrasFederico

Copy link
Copy Markdown
Contributor

What

All 15 libSceNpScoreRanking exports threw. They now follow shadPS4's np_score.cpp offline:

  • Title contexts and requests: sceNpScoreCreateNpTitleCtx refuses the invalid service label 0xFFFFFFFF before a null NpId; more than 32 title contexts or 32 requests is TOO_MANY_OBJECTS; an unknown id is INVALID_ID; deleting a title context deletes its requests. sceNpScoreAbortRequest finishes an unfinished request with ABORTED, which later calls on it return; sceNpScorePollAsync reports running until a request has a result.
  • Record, ranking and board calls, synchronous and asynchronous, run shadPS4's checks in its order: the option, the 189-byte game info limit, 100 ranks or friends and 101 NpIds per request, start rank 0, null and empty arrays, the friend-ranking option (only with includeSelf, size 24, its start rank), and the array sizes (INVALID_ALIGNMENT unless 0x80 per rank, 0x88 per player rank, 36 per NpId, 64 per comment and 200 per game info, the sizes shadPS4 asserts in np_score.h).
  • Offline answer: a valid call returns SCE_NP_ERROR_SIGNED_OUT and finishes its request with it, in both forms. This is what shadPS4 does when the user has no connection: its NpHandler returns SIGNED_OUT, which the call records on the request and returns.

No output is written; shadPS4 clears the rank, comment and info arrays before contacting its server, and that is left out. A null boardInfo throws, because shadPS4 answers it by the title's SDK version. Nothing is measured on a PS5; the new debt file says so.

#9874 declares other libSceNpScoreRanking exports and creates the same debt file; pr_overlap.py finds no conflict in Export.cpp, and whichever lands second keeps both debt sections.

Tested

Ubuntu 26.04.1, kernel 7.0.0-38, GCC 15.2.0, Release, full build with BUILD_TESTING=ON. Windows was not compiled. No title was run.

  • New guest_np_score_offline (core/libs/tests/GuestNpScoreOffline.cpp): the 32-context and 32-request limits, deleting a context with its requests, abort before and after a result, polling, every argument check of the record, range, NpId, friends and board calls with the order between neighbouring checks, the 100, 101 and 102 boundaries, SIGNED_OUT from both forms with the request finished, and no output array or rank written.
  • It aborts on main (sceNpScoreCreateNpTitleCtx not implemented) and passes with this change. 22 mutations of the new code (each limit and boundary, each check order tested, each size check, the friend option rules, abort and result storage, the null poll result) each fail it.
  • tools/check_conventions.py --base upstream/main passes; tools/pr_overlap.py lists only feat(prx): declare exports for 3 inventory-covered NP libraries #9874, described above.

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

The 15 exports threw. They now keep title contexts and requests, run
shadPS4's argument checks in its order, and answer the record, ranking
and board calls with SCE_NP_ERROR_SIGNED_OUT, which also finishes the
request, as shadPS4 does for a user with no connection.
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Progress report (9e568a3 → 5090249)

📈 System libraries: 43.48% (+0.13%, +15 implemented functions)

✅ 15 implemented
Library Name
libSceNpScoreRanking sceNpScoreAbortRequest
libSceNpScoreRanking sceNpScoreCreateNpTitleCtx
libSceNpScoreRanking sceNpScoreCreateRequest
libSceNpScoreRanking sceNpScoreDeleteNpTitleCtx
libSceNpScoreRanking sceNpScoreDeleteRequest
libSceNpScoreRanking sceNpScoreGetBoardInfo
libSceNpScoreRanking sceNpScoreGetFriendsRanking
libSceNpScoreRanking sceNpScoreGetFriendsRankingAsync
libSceNpScoreRanking sceNpScoreGetRankingByNpId
libSceNpScoreRanking sceNpScoreGetRankingByNpIdAsync
libSceNpScoreRanking sceNpScoreGetRankingByRange
libSceNpScoreRanking sceNpScoreGetRankingByRangeAsync
libSceNpScoreRanking sceNpScorePollAsync
libSceNpScoreRanking sceNpScoreRecordScore
libSceNpScoreRanking sceNpScoreRecordScoreAsync

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 9874 docs/dev/debt/libSceNpScoreRanking.md

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 9874 core/libs/prx/libSceNpScoreRanking/Export.cpp
docs/dev/debt/libSceNpScoreRanking.md

@oneandonlydean oneandonlydean self-assigned this Oct 23, 2026
@oneandonlydean
oneandonlydean merged commit 31516f7 into boykopovar:main Oct 24, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants