feat(overlay): show PS5 system dialogs as real PC dialogs #12379

Merged
MarcZX10 merged 80 commits from upstream-pr/12379 into main 2026-10-30 01:04:23 +00:00
MarcZX10 commented 2026-10-28 12:04:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T12:04:41Z.


What

Shows PS5 system dialogs as real PC dialogs in the host overlay, driven by the PC keyboard, mouse and pad, in the same spirit as the real-keyboard IME replacing the on-screen keyboard. Until now sceMsgDialogOpen and sceErrorDialogOpen auto-answered silently.

Generic part (commits in this order):

  • libSceIme: a modal dialog session (ModalDialogRequest: message, one to three buttons, focused and cancel button; ModalDialogView; Showing/Answered/Closed). It is kept in libSceIme because libSceVideoOut already links it and both message dialog libraries and the error dialog can call it without linking each other. Opening is refused while no presenter is registered or another dialog is showing, so callers keep today's auto-answer (headless fallback). An active IME keyboard/pad capture has priority: the dialog is hidden and gets no input until the IME releases it.
  • libSceAgcDriver: LayOutDialog (word wrap to 36 columns and 8 lines, one to three buttons, accent border on the focused one, same scale rule as the keyboard), the system dialog slot, SystemOverlayLayout, and the present path in VulkanDevice.cpp now asks for the layout of whichever system panel is set.
  • libSceVideoOut: the presenter registration and the per-flip hand-over, DialogInput (arrows/Tab/wheel move focus, Enter/Space/left click confirm, Escape/right click cancel), pad hand-off (D-pad/left stick, Cross confirm, Circle cancel, armed only after both were seen released), and the title no longer receives pad, key press, key release, mouse motion, wheel, button press or button release input while the dialog is shown (held keys/buttons are released once). One commit per input path.

Per library:

  • libSceMsgDialog and libSceMsgDialog.native: user message dialogs with button type 0, 1, 3 or 4 are shown and stay running until answered or closed; sceMsgDialogGetResult returns the button the player chose. Progress bars, system messages, other button types and anything opened with no window or while another dialog is shown keep the old behaviour. SceMsgDialogParam parsing moved to a stateless typed header.
  • libSceErrorDialog: sceErrorDialogOpen shows a one-button dialog with the error code.
  • libSceSaveDataDialog(.native): deliberately not wired. The layouts of the user message, system message and error code parameters have no source in this repository or measurement, so it is recorded as debt instead of guessed.

Each feature has its test commit right after it, and the debt docs are trimmed one statement per commit (libSceMsgDialog, libSceMsgDialog.native, libSceErrorDialog, libSceVideoOut, libSceSaveDataDialog.native). The SceMsgDialogParam layout and the button-type enum stay unmeasured debt; button ids, labels, the look, the inputs and the Cross/Circle choice are listed as unmeasured too.

Overlap with open PRs: none implements these dialogs. #11948 changes libSceVideoOut/CMakeLists.txt, and several PRs touch the present region of VulkanDevice.cpp (this one replaces two lines there); #11511 only documents the sceMsgDialogOpen layout. No code was taken from other PRs.

Tested

Linux x86-64, GCC 12, throwaway archive build (host CPU gate patched) of tip 7f1a74c62a on base 2227f1366 (upstream/main has since moved by 14 commits that touch none of these libraries; a merge-tree simulation is clean).
Passed on that tip: guest_ime_modal_dialog, guest_msg_dialog, guest_msg_dialog_native, guest_error_dialog, error_dialog_request, msg_dialog_param, msg_dialog_text, msg_dialog_request, keyboard_input, keyboard_dialog, video_out_mouse, video_out_dialog_input, pad_sdl, agc_keyboard_overlay, guest_ime_pad_route, guest_ime_dialog. check_conventions.py --base upstream/main, git diff --check and the public header audit are clean.

Review fixes: a dialog that no flip draws is dropped after 3 seconds (a presenter flag alone no longer means the dialog can be seen), and a dialog belongs to the library that opened it, so another library's terminate, close or poll does not touch it.

Negative controls (same build tree; the non-test sources restored to an earlier version, tests kept; abort on the first failing check):

  • keyboard_dialog with KeyboardInput.cpp/.hpp from main: FAILS at "a key press or release reached the title while a dialog was shown". With only the key-press drop (no reset): FAILS at "a dialog that starts taking keys on a key press did not reset them". With the real change: passes.
  • video_out_mouse with MouseInput.cpp/.hpp from main: FAILS at "motion or wheel reached the title while a dialog was shown". With only motion, wheel and press dropping (no reset): FAILS at "a button press or release reached the title while a dialog was shown". With the real change: passes.
  • pad_sdl with PadInput.cpp from main: FAILS at the first dialog check, the intercepted neutral state while a dialog is shown (PadSdl.cpp line 96). With the real change: passes.
  • No-flip bound (the timeout check made a no-op): guest_ime_modal_dialog FAILS at "an undrawn dialog still captures input after the timeout", guest_msg_dialog at "a dialog that was never drawn kept the title waiting", guest_msg_dialog_native and guest_error_dialog at the status call expected to be finished after the bound.
  • Owner check (made always true): guest_ime_modal_dialog FAILS at "another library sees the dialog", guest_msg_dialog at "terminating libSceMsgDialog ended another library's dialog", guest_msg_dialog_native and guest_error_dialog at the poll that expects the other library's dialog to still be showing after a terminate.
  • Not run against main for the other new tests (layout, parse, request builders, UTF-8 decode, DialogInput, the hub session): they exercise code that does not exist there.

Not run: Windows, macOS, a real Vulkan window or any hardware GPU (the dialog was never seen on screen; only the rectangle layout is tested), a console, any title, real SDL held-key and held-button reset, video_out_flip_* (built, skipped on this host: no offscreen Vulkan). Each commit was not built on its own; the full branch was. Reasoned only: the dialog is drawn when the presentation thread has a flip, so a title that never flips gets the automatic answer after 3 seconds.

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:5050158976 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12379). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T12:04:41Z. --- ### What Shows PS5 system dialogs as real PC dialogs in the host overlay, driven by the PC keyboard, mouse and pad, in the same spirit as the real-keyboard IME replacing the on-screen keyboard. Until now `sceMsgDialogOpen` and `sceErrorDialogOpen` auto-answered silently. Generic part (commits in this order): - `libSceIme`: a modal dialog session (`ModalDialogRequest`: message, one to three buttons, focused and cancel button; `ModalDialogView`; Showing/Answered/Closed). It is kept in libSceIme because libSceVideoOut already links it and both message dialog libraries and the error dialog can call it without linking each other. Opening is refused while no presenter is registered or another dialog is showing, so callers keep today's auto-answer (headless fallback). An active IME keyboard/pad capture has priority: the dialog is hidden and gets no input until the IME releases it. - `libSceAgcDriver`: `LayOutDialog` (word wrap to 36 columns and 8 lines, one to three buttons, accent border on the focused one, same scale rule as the keyboard), the system dialog slot, `SystemOverlayLayout`, and the present path in `VulkanDevice.cpp` now asks for the layout of whichever system panel is set. - `libSceVideoOut`: the presenter registration and the per-flip hand-over, `DialogInput` (arrows/Tab/wheel move focus, Enter/Space/left click confirm, Escape/right click cancel), pad hand-off (D-pad/left stick, Cross confirm, Circle cancel, armed only after both were seen released), and the title no longer receives pad, key press, key release, mouse motion, wheel, button press or button release input while the dialog is shown (held keys/buttons are released once). One commit per input path. Per library: - `libSceMsgDialog` and `libSceMsgDialog.native`: user message dialogs with button type 0, 1, 3 or 4 are shown and stay running until answered or closed; `sceMsgDialogGetResult` returns the button the player chose. Progress bars, system messages, other button types and anything opened with no window or while another dialog is shown keep the old behaviour. `SceMsgDialogParam` parsing moved to a stateless typed header. - `libSceErrorDialog`: `sceErrorDialogOpen` shows a one-button dialog with the error code. - `libSceSaveDataDialog(.native)`: deliberately not wired. The layouts of the user message, system message and error code parameters have no source in this repository or measurement, so it is recorded as debt instead of guessed. Each feature has its test commit right after it, and the debt docs are trimmed one statement per commit (`libSceMsgDialog`, `libSceMsgDialog.native`, `libSceErrorDialog`, `libSceVideoOut`, `libSceSaveDataDialog.native`). The `SceMsgDialogParam` layout and the button-type enum stay unmeasured debt; button ids, labels, the look, the inputs and the Cross/Circle choice are listed as unmeasured too. Overlap with open PRs: none implements these dialogs. #11948 changes `libSceVideoOut/CMakeLists.txt`, and several PRs touch the present region of `VulkanDevice.cpp` (this one replaces two lines there); #11511 only documents the `sceMsgDialogOpen` layout. No code was taken from other PRs. ### Tested Linux x86-64, GCC 12, throwaway archive build (host CPU gate patched) of tip 7f1a74c62a on base 2227f1366 (upstream/main has since moved by 14 commits that touch none of these libraries; a merge-tree simulation is clean). Passed on that tip: `guest_ime_modal_dialog`, `guest_msg_dialog`, `guest_msg_dialog_native`, `guest_error_dialog`, `error_dialog_request`, `msg_dialog_param`, `msg_dialog_text`, `msg_dialog_request`, `keyboard_input`, `keyboard_dialog`, `video_out_mouse`, `video_out_dialog_input`, `pad_sdl`, `agc_keyboard_overlay`, `guest_ime_pad_route`, `guest_ime_dialog`. `check_conventions.py --base upstream/main`, `git diff --check` and the public header audit are clean. Review fixes: a dialog that no flip draws is dropped after 3 seconds (a presenter flag alone no longer means the dialog can be seen), and a dialog belongs to the library that opened it, so another library's terminate, close or poll does not touch it. Negative controls (same build tree; the non-test sources restored to an earlier version, tests kept; abort on the first failing check): - `keyboard_dialog` with `KeyboardInput.cpp/.hpp` from `main`: FAILS at "a key press or release reached the title while a dialog was shown". With only the key-press drop (no reset): FAILS at "a dialog that starts taking keys on a key press did not reset them". With the real change: passes. - `video_out_mouse` with `MouseInput.cpp/.hpp` from `main`: FAILS at "motion or wheel reached the title while a dialog was shown". With only motion, wheel and press dropping (no reset): FAILS at "a button press or release reached the title while a dialog was shown". With the real change: passes. - `pad_sdl` with `PadInput.cpp` from `main`: FAILS at the first dialog check, the intercepted neutral state while a dialog is shown (`PadSdl.cpp` line 96). With the real change: passes. - No-flip bound (the timeout check made a no-op): `guest_ime_modal_dialog` FAILS at "an undrawn dialog still captures input after the timeout", `guest_msg_dialog` at "a dialog that was never drawn kept the title waiting", `guest_msg_dialog_native` and `guest_error_dialog` at the status call expected to be finished after the bound. - Owner check (made always true): `guest_ime_modal_dialog` FAILS at "another library sees the dialog", `guest_msg_dialog` at "terminating libSceMsgDialog ended another library's dialog", `guest_msg_dialog_native` and `guest_error_dialog` at the poll that expects the other library's dialog to still be showing after a terminate. - Not run against `main` for the other new tests (layout, parse, request builders, UTF-8 decode, `DialogInput`, the hub session): they exercise code that does not exist there. Not run: Windows, macOS, a real Vulkan window or any hardware GPU (the dialog was never seen on screen; only the rectangle layout is tested), a console, any title, real SDL held-key and held-button reset, `video_out_flip_*` (built, skipped on this host: no offscreen Vulkan). Each commit was not built on its own; the full branch was. Reasoned only: the dialog is drawn when the presentation thread has a flip, so a title that never flips gets the automatic answer after 3 seconds. ### 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 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
adriadam10 commented 2026-10-28 12:15:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-28T12:15:43Z.

Review: CHANGES_REQUESTED


Thanks, the structure is clean (modal session in libSceIme, one commit per input path, debt trimmed). One blocking point and two smaller ones:

  • VideoOutDriver.cpp:768-771: the dialog view is only handed to the AGC driver inside if (current), i.e. when the title has a flip pending. Before this PR sceMsgDialogOpen/sceErrorDialogOpen auto-answered, so a title that opens a dialog and then polls UpdateStatus/GetStatus without flipping continued. Now it stays Running until a player answers a dialog that is never drawn, so it hangs with no way out. ModalDialogSetPresenter_nid_postfix(window.Handle() != nullptr) (line 758) says "a presenter exists" without knowing that frames are being presented. Please make "presenter registered" mean the dialog can actually be seen: for example only report a presenter while flips arrive, or fall back to the old auto-answer when no flip has been presented since the dialog opened (bounded wait), or redraw the last frame with the dialog while idle. Add a test for the no-flip case.
  • libSceErrorDialog/Export.cpp (sceErrorDialogTerminate) and libSceMsgDialog/Export.cpp (sceMsgDialogTerminate) call ModalDialogReset_nid_postfix(), which resets the one shared session. Terminating one library while the other has a dialog showing finishes that dialog as "answered OK". Reset only if this library's own dialog is the one showing (e.g. track an owner id in the session), and cover it in GuestImeModalDialog.
  • Tested: the branch was not rebuilt after the rebase and the new tests were not run against the unchanged code. The Build run on this head covers Linux/Windows; please say in the PR which new test fails on main for the input-suppression paths (KeyboardDialog, MouseInput, PadSdl).

Not verified by us: how the dialog looks on screen and the held-key/button reset on real SDL events (no GPU/window here); the Windows job is still pending.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5682407624 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12379#pullrequestreview-5682407624). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-28T12:15:43Z. **Review:** CHANGES_REQUESTED --- Thanks, the structure is clean (modal session in libSceIme, one commit per input path, debt trimmed). One blocking point and two smaller ones: - `VideoOutDriver.cpp:768-771`: the dialog view is only handed to the AGC driver inside `if (current)`, i.e. when the title has a flip pending. Before this PR `sceMsgDialogOpen`/`sceErrorDialogOpen` auto-answered, so a title that opens a dialog and then polls `UpdateStatus`/`GetStatus` without flipping continued. Now it stays `Running` until a player answers a dialog that is never drawn, so it hangs with no way out. `ModalDialogSetPresenter_nid_postfix(window.Handle() != nullptr)` (line 758) says "a presenter exists" without knowing that frames are being presented. Please make "presenter registered" mean the dialog can actually be seen: for example only report a presenter while flips arrive, or fall back to the old auto-answer when no flip has been presented since the dialog opened (bounded wait), or redraw the last frame with the dialog while idle. Add a test for the no-flip case. - `libSceErrorDialog/Export.cpp` (`sceErrorDialogTerminate`) and `libSceMsgDialog/Export.cpp` (`sceMsgDialogTerminate`) call `ModalDialogReset_nid_postfix()`, which resets the one shared session. Terminating one library while the other has a dialog showing finishes that dialog as "answered OK". Reset only if this library's own dialog is the one showing (e.g. track an owner id in the session), and cover it in `GuestImeModalDialog`. - Tested: the branch was not rebuilt after the rebase and the new tests were not run against the unchanged code. The Build run on this head covers Linux/Windows; please say in the PR which new test fails on `main` for the input-suppression paths (`KeyboardDialog`, `MouseInput`, `PadSdl`). Not verified by us: how the dialog looks on screen and the held-key/button reset on real SDL events (no GPU/window here); the Windows job is still pending.
MarcZX10 commented 2026-10-28 13:01:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T13:01:49Z.

Review: COMMENTED


Follow-up on exact head 7f1a74c62a. The prior no-flip hang and cross-library reset/poll concerns are addressed in the diff: undrawn sessions expire after a bounded three seconds, an already-drawn dialog remains answerable, and message/error callers pass their owner when polling, closing or resetting. I rebuilt the six focused targets from this head (35 Ninja steps). Native CTest execution on this host aborts all six before test logic because the Xeon E5-1620 v2 lacks the required Zen 2 instruction set. I then ran each exact binary under qemu-x86_64 TCG with -cpu max; all six exited 0: guest_ime_modal_dialog, guest_msg_dialog, guest_msg_dialog_native, guest_error_dialog, video_out_mouse and video_out_dialog_input. The emulated run covers state/input logic, not a real Vulkan window, GPU, console or title. Current-main diff check, conventions and the 211-script registration audit pass. Hosted Windows and report jobs were still pending, so I have not approved.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5682971791 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12379#pullrequestreview-5682971791). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T13:01:49Z. **Review:** COMMENTED --- Follow-up on exact head 7f1a74c62a. The prior no-flip hang and cross-library reset/poll concerns are addressed in the diff: undrawn sessions expire after a bounded three seconds, an already-drawn dialog remains answerable, and message/error callers pass their owner when polling, closing or resetting. I rebuilt the six focused targets from this head (35 Ninja steps). Native CTest execution on this host aborts all six before test logic because the Xeon E5-1620 v2 lacks the required Zen 2 instruction set. I then ran each exact binary under qemu-x86_64 TCG with -cpu max; all six exited 0: guest_ime_modal_dialog, guest_msg_dialog, guest_msg_dialog_native, guest_error_dialog, video_out_mouse and video_out_dialog_input. The emulated run covers state/input logic, not a real Vulkan window, GPU, console or title. Current-main diff check, conventions and the 211-script registration audit pass. Hosted Windows and report jobs were still pending, so I have not approved.
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!12379
No description provided.