feat(logindialog): implement the libSceLoginDialog state machine #559

Merged
Phi1ow merged 2 commits from upstream-pr/559 into main 2026-10-06 22:41:58 +00:00
Phi1ow commented 2026-10-04 20:42:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Phi1ow on 2026-10-04T20:42:38Z.


What

The seven libSceLoginDialog exports were throwing stubs. They now implement the common-dialog
state machine (NONE -> INITIALIZED -> RUNNING -> FINISHED), mirroring the existing
libSceSigninDialog: the local user is always signed in, so the dialog finishes as soon as it
opens and a title waiting on it never blocks.

  • sceLoginDialogInitialize -> INITIALIZED, or 0x80B80004 if already initialized.
  • sceLoginDialogOpen(param) -> requires INITIALIZED/FINISHED (else NOT_INITIALIZED, or
    BUSY while running), rejects a null parameter, then FINISHED.
  • sceLoginDialogUpdateStatus / sceLoginDialogGetStatus -> the status.
  • sceLoginDialogGetResult -> zeroes the result (signed in) once FINISHED; otherwise
    NOT_INITIALIZED / ARG_NULL / NOT_FINISHED.
  • sceLoginDialogClose -> ok, or 0x80B80003 when not initialized.
  • sceLoginDialogTerminate -> NONE, or 0x80B80003 when not initialized.

The status values and the shared common-dialog error codes match libSceSigninDialog and
libSceWebBrowserDialog. Adds a CMakeLists.txt so the library can carry its guest test.

Tested

New test core/libs/tests/GuestLoginDialog.cpp (registered as guest_login_dialog) drives
the whole machine: the not-initialized and already-initialized errors, the argument and
not-finished errors, open / get-result / close and terminate.

Built with MinGW-w64 GCC 15.2.0 (the CI toolchain) on Windows 11; ctest -R guest_login_dialog
passes. On main the seven functions throw not implemented, so the test aborts without the
change.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4737470575 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/559). Originally posted by [Phi1ow](https://github.com/Phi1ow) on 2026-10-04T20:42:38Z. --- ### What The seven `libSceLoginDialog` exports were throwing stubs. They now implement the common-dialog state machine (`NONE -> INITIALIZED -> RUNNING -> FINISHED`), mirroring the existing `libSceSigninDialog`: the local user is always signed in, so the dialog finishes as soon as it opens and a title waiting on it never blocks. - `sceLoginDialogInitialize` -> `INITIALIZED`, or `0x80B80004` if already initialized. - `sceLoginDialogOpen(param)` -> requires `INITIALIZED`/`FINISHED` (else `NOT_INITIALIZED`, or `BUSY` while running), rejects a null parameter, then `FINISHED`. - `sceLoginDialogUpdateStatus` / `sceLoginDialogGetStatus` -> the status. - `sceLoginDialogGetResult` -> zeroes the result (signed in) once `FINISHED`; otherwise `NOT_INITIALIZED` / `ARG_NULL` / `NOT_FINISHED`. - `sceLoginDialogClose` -> ok, or `0x80B80003` when not initialized. - `sceLoginDialogTerminate` -> `NONE`, or `0x80B80003` when not initialized. The status values and the shared common-dialog error codes match `libSceSigninDialog` and `libSceWebBrowserDialog`. Adds a `CMakeLists.txt` so the library can carry its guest test. ### Tested New test `core/libs/tests/GuestLoginDialog.cpp` (registered as `guest_login_dialog`) drives the whole machine: the not-initialized and already-initialized errors, the argument and not-finished errors, open / get-result / close and terminate. Built with MinGW-w64 GCC 15.2.0 (the CI toolchain) on Windows 11; `ctest -R guest_login_dialog` passes. On `main` the seven functions throw `not implemented`, so the test aborts without the change. ### Checklist - [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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes
oneandonlydean commented 2026-10-04 21:19:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T21:19:43Z.


Thanks. The state machine is the same as the existing libSceSigninDialog, and the status values and error codes match it. My concern is sceLoginDialogGetResult:

  1. It zeroes 8 bytes of the caller's buffer, but nothing says the result struct is 8 bytes. If it's smaller, that writes past it. sceWebBrowserDialogGetResult on main only writes the leading int32 result, which every common dialog result starts with. I'd do the same here unless you have a source for the layout.
  2. It reports result 0 (OK, a user logged in). A successful login result would normally also say which user, and a zeroed field gives user id 0 instead of the initial user (0x10000000). Your #560 reports USER_CANCELED for the sign-in dialog, like libSceWebBrowserDialog. Unless the full result layout is known, I'd report USER_CANCELED here too, so a title takes its "no user chosen" path instead of reading an invalid user id.

Please also add the dialog to the "Silent stubs" list in docs/dev/TechnicalDebt.md, since it finishes without any UI. The CI run on this PR still needs approval.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5984498398 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/559#issuecomment-5984498398). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-04T21:19:43Z. --- Thanks. The state machine is the same as the existing `libSceSigninDialog`, and the status values and error codes match it. My concern is `sceLoginDialogGetResult`: 1. It zeroes 8 bytes of the caller's buffer, but nothing says the result struct is 8 bytes. If it's smaller, that writes past it. `sceWebBrowserDialogGetResult` on main only writes the leading `int32` result, which every common dialog result starts with. I'd do the same here unless you have a source for the layout. 2. It reports result 0 (OK, a user logged in). A successful login result would normally also say which user, and a zeroed field gives user id 0 instead of the initial user (0x10000000). Your #560 reports `USER_CANCELED` for the sign-in dialog, like `libSceWebBrowserDialog`. Unless the full result layout is known, I'd report `USER_CANCELED` here too, so a title takes its "no user chosen" path instead of reading an invalid user id. Please also add the dialog to the "Silent stubs" list in docs/dev/TechnicalDebt.md, since it finishes without any UI. The CI run on this PR still needs approval.
github-actions[bot] commented 2026-10-04 22:31:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-04T22:31:40Z.


Progress report (5fc8755 → 0178b65)

📈 System libraries: 87.32% (+0.24%, +7 implemented functions)

✅ 7 implemented
Library Name
libSceLoginDialog sceLoginDialogClose
libSceLoginDialog sceLoginDialogGetResult
libSceLoginDialog sceLoginDialogGetStatus
libSceLoginDialog sceLoginDialogInitialize
libSceLoginDialog sceLoginDialogOpen
libSceLoginDialog sceLoginDialogTerminate
libSceLoginDialog sceLoginDialogUpdateStatus
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5985170409 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/559#issuecomment-5985170409). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-04T22:31:40Z. --- <!-- progress-report --> ### Progress report (5fc8755 → 0178b65) 📈 **System libraries**: 87.32% (+0.24%, +7 implemented functions) <details> <summary>✅ 7 implemented</summary> | Library | Name | | - | - | | libSceLoginDialog | `sceLoginDialogClose` | | libSceLoginDialog | `sceLoginDialogGetResult` | | libSceLoginDialog | `sceLoginDialogGetStatus` | | libSceLoginDialog | `sceLoginDialogInitialize` | | libSceLoginDialog | `sceLoginDialogOpen` | | libSceLoginDialog | `sceLoginDialogTerminate` | | libSceLoginDialog | `sceLoginDialogUpdateStatus` | </details>
Phi1ow commented 2026-10-04 22:34:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Phi1ow on 2026-10-04T22:34:23Z.


Done. sceLoginDialogGetResult now writes only the leading int32 (USER_CANCELED), like sceWebBrowserDialogGetResult and the sign-in dialog, so a title takes its "no user chosen" path instead of reading an invalid user id. Also added the dialog to the "Silent stubs" list.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5985191562 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/559#issuecomment-5985191562). Originally posted by [Phi1ow](https://github.com/Phi1ow) on 2026-10-04T22:34:23Z. --- Done. `sceLoginDialogGetResult` now writes only the leading `int32` (`USER_CANCELED`), like `sceWebBrowserDialogGetResult` and the sign-in dialog, so a title takes its "no user chosen" path instead of reading an invalid user id. Also added the dialog to the "Silent stubs" list.
oneandonlydean commented 2026-10-04 23:43:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-04T23:43:54Z.


Thanks, sceLoginDialogGetResult now writes only the leading int32 with USER_CANCELED, the same as the sign-in and web browser dialogs, and the dialog is in the silent stubs list. guest_login_dialog passes here and CI is green. Ready to merge from my side (the TechnicalDebt line sits next to #558's and #560's, so a one-line rebase may be needed depending on order).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5985701802 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/559#issuecomment-5985701802). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-04T23:43:54Z. --- Thanks, `sceLoginDialogGetResult` now writes only the leading int32 with `USER_CANCELED`, the same as the sign-in and web browser dialogs, and the dialog is in the silent stubs list. `guest_login_dialog` passes here and CI is green. Ready to merge from my side (the TechnicalDebt line sits next to #558's and #560's, so a one-line rebase may be needed depending on order).
oneandonlydean commented 2026-10-05 01:18:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T01:18:17Z.


#558 is on main now, and its libSceErrorDialog line sits where this one goes in the silent stubs list of docs/dev/TechnicalDebt.md, so this needs a one-line rebase that keeps both lines. #560 adds its line at the same spot, so whichever of the two lands second will need the same. Ready to merge from my side after that.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5986480623 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/559#issuecomment-5986480623). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-05T01:18:17Z. --- #558 is on main now, and its libSceErrorDialog line sits where this one goes in the silent stubs list of docs/dev/TechnicalDebt.md, so this needs a one-line rebase that keeps both lines. #560 adds its line at the same spot, so whichever of the two lands second will need the same. Ready to merge from my side after that.
oneandonlydean commented 2026-10-06 21:20:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T21:20:52Z.


Are you still working on this? It still needs the one-line docs/dev/TechnicalDebt.md rebase from 10-05; the code was ready from my side then. If you'd rather not continue, please say so, and it can be closed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6025675095 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/559#issuecomment-6025675095). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-06T21:20:52Z. --- Are you still working on this? It still needs the one-line `docs/dev/TechnicalDebt.md` rebase from 10-05; the code was ready from my side then. If you'd rather not continue, please say so, and it can be closed.
Phi1ow commented 2026-10-06 21:52:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Phi1ow on 2026-10-06T21:52:17Z.


Rebased. The silent-stubs rebase keeps #558's libSceErrorDialog line and adds the libSceLoginDialog one next to it. guest_login_dialog passes here.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6026126105 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/559#issuecomment-6026126105). Originally posted by [Phi1ow](https://github.com/Phi1ow) on 2026-10-06T21:52:17Z. --- Rebased. The silent-stubs rebase keeps #558's libSceErrorDialog line and adds the libSceLoginDialog one next to it. guest_login_dialog passes here.
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!559
No description provided.