feat(libSceInvitationDialog): finish the PS4 invitation dialog as canceled without a window #11379

Merged
Terminev merged 2 commits from upstream-pr/11379 into main 2026-10-27 08:24:33 +00:00
Terminev commented 2026-10-26 09:57:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Terminev on 2026-10-26T09:57:26Z.


What

Implements the six libSceInvitationDialog (PS4) exports, which all threw, the way libSceNpProfileDialog handles a dialog it cannot show: no window opens and no invitation is sent, the dialog finishes at once as canceled by the user.

  • Initialize, Terminate, UpdateStatus: the common dialog state (NOT_SYSTEM_INITIALIZED, ALREADY_INITIALIZED, BUSY, NOT_INITIALIZED), see below.
  • Open(param): ARG_NULL for a null param, then the dialog goes straight to FINISHED and keeps the param's callbackArg.
  • GetResult(result): NOT_INITIALIZED, NOT_FINISHED, ARG_NULL, then returns 0 with errorCode 0, result USER_CANCELED, the callbackArg of the last Open, and a recipient count of 0 when the result carries a recipient list.
  • Close: NOT_INITIALIZED; otherwise the dialog is never running here, and the error for that is unsettled, so it throws.

Layouts: InvitationDialogParam (144 bytes) and the field names of InvitationDialogResult come from shadPS4's header. They agree with what the debt entry already recorded from libSceInvitationDialog.sprx: the eight bytes copied from the open parameter to 0x00 are callbackArg, and 0x0C is result. The fields are renamed accordingly in include/Api.hpp; the offsets are unchanged and still asserted.

Cases no source settles throw, as in libSceNpProfileDialog: Open before Initialize, a param whose size is not 144 or whose mode is neither send nor receive, Close on a dialog that is not running, and a result with a non-zero reserved byte (the module checks 0x18..0x37, the error is unknown). baseParam, userId and dataParam are not checked. Everything is recorded in docs/dev/debt/libSceInvitationDialog.md; the old "every call throws" entry for Close is replaced.

Initialize checks the common dialog system through libSceCommonDialog, which now records whether a dialog holds it: sceCommonDialogIsUsed returns that instead of always false, and include/DialogUse.hpp declares the host helpers that check, take and free it. Initialize returns NOT_SYSTEM_INITIALIZED before sceCommonDialogInitialize, then ALREADY_INITIALIZED, then BUSY while the system is held, in shadPS4's order, and Terminate frees it. Only this library takes the system so far; both debt files record that.

The library gets a CMakeLists.txt with its test, like libSceNpProfileDialog, and links libSceCommonDialog.

Tested

Linux x86-64 (Intel Xeon @ 2.10GHz with AVX2, FMA, F16C, BMI1, BMI2, LZCNT and MOVBE), GCC 13.3, Release, on aac9d6470 based on main at 5b5d24cb2: ctest -R '^guest_invitation_dialog$', ctest -R '^guest_common_dialog$', the tests of the other dialog libraries and ctest -R public_headers (65/65) pass. The patched libSceInvitationDialog.prx exports the six NIDs shadPS4 lists for these functions and imports the three libSceCommonDialog helpers by name. Breaking the code on purpose (an accepted instead of canceled result, a lost callbackArg, a recipient count left as is, an invalid mode accepted, a second Initialize accepted, the system check, the busy check or the release removed) makes the test fail. SDL was configured with its XRandR and audio checks disabled locally, since that machine lacks those headers; these libraries and their tests do not use SDL. python3 tools/check_conventions.py --base origin/main and git diff --check pass. Not built on Windows. No title tested.

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

🤖 Generated with Claude Code

https://claude.ai/code/session_01RoucYS7mQpV23WDUEwXLuU

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5015457382 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11379). Originally posted by [Terminev](https://github.com/Terminev) on 2026-10-26T09:57:26Z. --- ### What Implements the six libSceInvitationDialog (PS4) exports, which all threw, the way libSceNpProfileDialog handles a dialog it cannot show: no window opens and no invitation is sent, the dialog finishes at once as canceled by the user. - `Initialize`, `Terminate`, `UpdateStatus`: the common dialog state (`NOT_SYSTEM_INITIALIZED`, `ALREADY_INITIALIZED`, `BUSY`, `NOT_INITIALIZED`), see below. - `Open(param)`: `ARG_NULL` for a null param, then the dialog goes straight to `FINISHED` and keeps the param's `callbackArg`. - `GetResult(result)`: `NOT_INITIALIZED`, `NOT_FINISHED`, `ARG_NULL`, then returns 0 with `errorCode` 0, `result` `USER_CANCELED`, the `callbackArg` of the last `Open`, and a recipient count of 0 when the result carries a recipient list. - `Close`: `NOT_INITIALIZED`; otherwise the dialog is never running here, and the error for that is unsettled, so it throws. Layouts: `InvitationDialogParam` (144 bytes) and the field names of `InvitationDialogResult` come from shadPS4's header. They agree with what the debt entry already recorded from `libSceInvitationDialog.sprx`: the eight bytes copied from the open parameter to 0x00 are `callbackArg`, and 0x0C is `result`. The fields are renamed accordingly in `include/Api.hpp`; the offsets are unchanged and still asserted. Cases no source settles throw, as in libSceNpProfileDialog: `Open` before `Initialize`, a param whose `size` is not 144 or whose `mode` is neither send nor receive, `Close` on a dialog that is not running, and a result with a non-zero reserved byte (the module checks 0x18..0x37, the error is unknown). `baseParam`, `userId` and `dataParam` are not checked. Everything is recorded in `docs/dev/debt/libSceInvitationDialog.md`; the old "every call throws" entry for `Close` is replaced. `Initialize` checks the common dialog system through libSceCommonDialog, which now records whether a dialog holds it: `sceCommonDialogIsUsed` returns that instead of always false, and `include/DialogUse.hpp` declares the host helpers that check, take and free it. `Initialize` returns `NOT_SYSTEM_INITIALIZED` before `sceCommonDialogInitialize`, then `ALREADY_INITIALIZED`, then `BUSY` while the system is held, in shadPS4's order, and `Terminate` frees it. Only this library takes the system so far; both debt files record that. The library gets a `CMakeLists.txt` with its test, like libSceNpProfileDialog, and links libSceCommonDialog. ### Tested Linux x86-64 (Intel Xeon @ 2.10GHz with AVX2, FMA, F16C, BMI1, BMI2, LZCNT and MOVBE), GCC 13.3, Release, on aac9d6470 based on main at 5b5d24cb2: `ctest -R '^guest_invitation_dialog$'`, `ctest -R '^guest_common_dialog$'`, the tests of the other dialog libraries and `ctest -R public_headers` (65/65) pass. The patched `libSceInvitationDialog.prx` exports the six NIDs shadPS4 lists for these functions and imports the three libSceCommonDialog helpers by name. Breaking the code on purpose (an accepted instead of canceled result, a lost `callbackArg`, a recipient count left as is, an invalid mode accepted, a second `Initialize` accepted, the system check, the busy check or the release removed) makes the test fail. SDL was configured with its XRandR and audio checks disabled locally, since that machine lacks those headers; these libraries and their tests do not use SDL. `python3 tools/check_conventions.py --base origin/main` and `git diff --check` pass. Not built on Windows. No title tested. ### 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 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01RoucYS7mQpV23WDUEwXLuU
MarcZX10 commented 2026-10-26 10:00:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T10:00:01Z.

Review: CHANGES_REQUESTED


The parameter layout and callback/result offsets are supported by the supplied module analysis, and the exact-head test report exercises the canceled-result and state transitions. I found one blocking mismatch with the repository’s implementation rule in AGENTS.md: the PR’s own Functional debt entry says Initialize does not return NOT_SYSTEM_INITIALIZED or BUSY, but sceInvitationDialogInitialize() unconditionally succeeds whenever this dialog’s local status is NONE. The current CommonDialog implementation has separate initialization state and sceCommonDialogIsUsed() currently always returns false, so this PR cannot safely infer that the common-dialog system is ready or available. Please either add a shared state/query that models those preconditions and test uninitialized/busy calls, or keep the unsupported initialization path throwing and documented instead of reporting success. The Close path after Open remains an explicitly documented unknown and throws; I have not treated its unmeasured return code as an implementation defect. Hosted conventions, intake, eligibility, labels and report checks pass; product jobs are path-skipped. My local configure did not reach the target test: system-deps configuration lacks SDL2, and bundled configuration stops because the SDL2 submodule is absent and XRandR is unavailable. The reported Linux focused test is therefore the available execution result.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5650217115 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11379#pullrequestreview-5650217115). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-26T10:00:01Z. **Review:** CHANGES_REQUESTED --- The parameter layout and callback/result offsets are supported by the supplied module analysis, and the exact-head test report exercises the canceled-result and state transitions. I found one blocking mismatch with the repository’s implementation rule in `AGENTS.md`: the PR’s own Functional debt entry says `Initialize` does not return `NOT_SYSTEM_INITIALIZED` or `BUSY`, but `sceInvitationDialogInitialize()` unconditionally succeeds whenever this dialog’s local status is `NONE`. The current CommonDialog implementation has separate initialization state and `sceCommonDialogIsUsed()` currently always returns false, so this PR cannot safely infer that the common-dialog system is ready or available. Please either add a shared state/query that models those preconditions and test uninitialized/busy calls, or keep the unsupported initialization path throwing and documented instead of reporting success. The `Close` path after `Open` remains an explicitly documented unknown and throws; I have not treated its unmeasured return code as an implementation defect. Hosted conventions, intake, eligibility, labels and report checks pass; product jobs are path-skipped. My local configure did not reach the target test: system-deps configuration lacks SDL2, and bundled configuration stops because the SDL2 submodule is absent and XRandR is unavailable. The reported Linux focused test is therefore the available execution result.
MarcZX10 commented 2026-10-26 10:18:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T10:18:00Z.

Review: APPROVED


Reviewed updated head aac9d6470c76921edf91260c929fa1c96f4aa191. The previous blocker is resolved: Initialize now checks common-system initialization, returns BUSY when the shared acquire fails, and records local state only after acquiring; Terminate releases the shared state. GuestInvitationDialog covers the uninitialized, occupied, acquired and released paths, and GuestCommonDialog checks the shared state transitions. The debt notes accurately limit the current shared-state coverage to this dialog. Hosted eligibility, conventions, labels and progress-report checks pass; product jobs are path-skipped.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5650464482 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11379#pullrequestreview-5650464482). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-26T10:18:00Z. **Review:** APPROVED --- Reviewed updated head `aac9d6470c76921edf91260c929fa1c96f4aa191`. The previous blocker is resolved: `Initialize` now checks common-system initialization, returns BUSY when the shared acquire fails, and records local state only after acquiring; `Terminate` releases the shared state. `GuestInvitationDialog` covers the uninitialized, occupied, acquired and released paths, and `GuestCommonDialog` checks the shared state transitions. The debt notes accurately limit the current shared-state coverage to this dialog. Hosted eligibility, conventions, labels and progress-report checks pass; product jobs are path-skipped.
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!11379
No description provided.