Skip to content

feat(np): answer and declare the PS4 NP, trophy and GNM imports of CUSA03312 - #2

Closed
savvaniss wants to merge 3 commits into
Get-fix:ps4/limbo-gpufrom
savvaniss:fix/ps4-np-imports
Closed

savvaniss wants to merge 3 commits into
Get-fix:ps4/limbo-gpufrom
savvaniss:fix/ps4-np-imports

Conversation

@savvaniss

@savvaniss savvaniss commented Oct 19, 2026 •

Copy link
Copy Markdown

What

On Windows a converted PS4 executable loads only when every import resolves. Risk and Monopoly Plus from CUSA03312 (Hasbro Family Fun Pack) import functions that this branch's PS4 libraries do not export yet, and call a few of them while they start. This targets boykopovar#6977's branch, beside #1, because these libraries exist only here.

Implemented, following the signed-out model the NP libraries already use:

  • sceNpCmpOnlineId (libSceNpCommon) compares the first 16 characters of two online ids. Equal ids return 0, others SCE_NP_UTIL_ERROR_NOT_MATCH (0x80550609), and a null id returns INVALID_ARGUMENT, as shadPS4's np_common.cpp does.
  • sceNpCmpNpId (libSceNpCommon) matches two NpIds when their online ids match as above and their opt and reserved bytes are equal, with the same results. NpId takes the SDK's 36-byte layout (online id, 8 opt bytes, 8 reserved bytes); it was 24 bytes. UnityNpToolkit in Boggle and Trivial Pursuit Live! zeroes a 36-byte NpId, fills it with sceNpGetNpId and compares it with this function.
  • sceNpMatching2Initialize and sceNpMatching2Terminate keep the library state. Initialization checks the parameter's size field (0x28, or 0x30 with an SSL pool) and returns ALREADY_INITIALIZED a second time; termination returns NOT_INITIALIZED when nothing was initialized. No thread starts and no server is reached. Monopoly Plus initializes it at startup.
  • sceNpSignalingInitialize and sceNpSignalingTerminate keep the library state the same way, with ALREADY_INITIALIZED and NOT_INITIALIZED. Monopoly Plus initializes it at startup.
  • sceNpTrophyGetGameInfo, sceNpTrophyGetGroupInfo and sceNpTrophyGetTrophyInfo (libSceNpTrophy) answer for a registered context from the trophy package the library already opens. They threw not implemented. UnityNpToolkit in Boggle and Trivial Pursuit Live! asks for the game info when it registers its trophy context and allocates one request per trophy from numTrophies, so a count of 0 leaves it reading an unset request. The configuration TROPCONF.ESFM is encrypted, so the trophy count is the number of TROPnnn.PNG icons, the group count the number of GRnnn.PNG icons, and unlocks come from the stored trophy state. Grades are reported as unknown, names and descriptions are empty, and progress is unlocked trophies over all trophies. A size field other than the SDK's (0x4a0, 0x20, 0x4a0, 0x28, 0x498 and 0x18) or two null outputs return INVALID_ARGUMENT, an unregistered context NOT_REGISTERED, and an id past the package INVALID_TROPHY_ID or INVALID_GROUP_ID. The base game group (-1) is answered with the game's counts; an existing group, and trophy info in a package with groups, still throw, because group membership is listed only in the configuration. The debt file records each of these.
  • sceNpLookupCreateTitleCtx returns SCE_NP_ERROR_SIGNED_OUT, or SCE_NP_COMMUNITY_ERROR_INSUFFICIENT_ARGUMENT for a null NP id: a lookup context belongs to a signed-in user, and none is. Monopoly Plus creates one from the NP id sceNpGetNpId left zeroed, and goes on without it.

Declared, each throwing NotImplemented_nid_no_patch:

  • sceNpMatching2AbortContextStart, GrantRoomOwner, SignalingGetConnectionStatus and SignalingGetPingInfo;
  • sceNpSignalingDeactivateConnection;
  • sceNpLookupAbortRequest, CreateAsyncRequest and PollAsync;
  • sceNpTrophyAbortHandle and sceInvitationDialogClose;
  • sceGnmMapComputeQueueWithPriority, sceGnmDrawInitDefaultHardwareState200 and sceGnmUpdate{Ps,Vs,Gs,Hs}Shader.

Risk calls the GNM ones at startup. Locally I run stand-ins for them, which #1 lists; I don't know the 2.00 default-state sequence, or the context-register packets the update functions leave. The debt file of each library records what it gets here.

Tested

Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, on boykopovar#6977's head 93eeee014.

  • guest_np_ps4_imports (new) covers each implemented function, including every error above and an NpId that differs only in opt or only in reserved, and checks that each declared NP function throws <name> not implemented. It passes, and the GNM, NpTrophy and InvitationDialog libraries build.
  • Risk and Monopoly Plus: run on an RX 9070 XT with the same answers in a local stack, together with fix(agc): PS4 display, textures and GCN instructions for CUSA03312 #1. Risk plays a local match. Monopoly Plus goes through sceNpSignalingInitialize, sceNpMatching2Initialize and sceNpLookupCreateTitleCtx to its loading screen.
  • The test also writes a trophy package with three trophy icons and no group icons. It checks the game, base group and trophy answers before and after an unlock (progress 0, then 33), and each error above.
  • Boggle: its UnityNpToolkit plugin stopped at sceNpCmpNpId not implemented; with the comparison it goes on to render its first scene (the next stop is a multisampled color target).
  • Trivial Pursuit Live!: with the trophy info it goes past Begin Game to profile creation and character select; with a count of 0 its UnityNpToolkit crashed there.
  • tools/check_conventions.py --base 93eeee014 passes.

Checklist

🤖 Generated with Claude Code

sceNpCmpOnlineId compares online ids; NpMatching2 and NpSignaling keep
their initialized state; sceNpLookupCreateTitleCtx reports a signed-out
user. The other imports these titles need from the libraries this branch
adds are declared and throw.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
savvaniss and others added 2 commits October 20, 2026 03:09
sceNpCmpNpId matches two NpIds when their online ids match and their
opt and reserved bytes are equal. NpId takes the SDK's 36-byte layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e trophy package

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Get-fix

Get-fix commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Thanks @savvaniss. boykopovar#6977 is now a draft integration branch, and its own work is split into boykopovar#9429 to boykopovar#9433 (details). The maintainers asked that the branch not land anything without its own review, so could you open this upstream against main, on top of boykopovar#9433 (the GNM declarations on boykopovar#9432), with Depends on? Once it's open, I'll merge it into ps4/limbo-gpu, list it as a member and run Limbo with it. ps4/limbo-gpu now moves to the split branches, so this pull request may show conflicts here.

AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

@savvaniss

Copy link
Copy Markdown
Author

Moved upstream as boykopovar#9896, on main now that boykopovar#9433 has merged. It keeps the NpMatching2 state, the trophy info calls and two declarations. The rest is covered by other open pull requests now, so it dropped out:

Closing this one.

@savvaniss savvaniss closed this Oct 22, 2026
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