The dialog request carries the message dialog owner id, and the status poll,
close and terminate pass it, so terminating libSceMsgDialog no longer resets or
finishes a dialog another library is showing.
guest_msg_dialog_tests opens dialogs through the exports. Without a presenter a
dialog finishes on the second status call and nothing is shown. With one, the
dialog is shown, stays running across status calls, refuses a second open,
finishes when answered, and a close or a terminate closes or resets the
session. A dialog without buttons, a progress bar, a system message and a
dialog the session refuses because another one is showing keep the automatic
answer.
sceMsgDialogOpen builds a modal dialog request from the user message and, when
the session accepts it because a presenter exists and no other dialog is
showing, marks the dialog as presented: it stays running until the player
answers it or the title closes it. Progress bars, system messages, dialogs
without buttons or with an unknown button type, and any dialog opened with no
presenter keep the automatic answer on the second status call. The log line
says whether the dialog was shown.
sceMsgDialogClose closes the session of a presented dialog, so the overlay and
its input capture go away, and sceMsgDialogTerminate resets the session. No
dialog is presented yet.
A dialog marked as presented stays running until the modal dialog session
reports an answer or is closed or reset, instead of finishing on the second
status call, and an answer sets the button id the dialog keeps. Nothing marks a
dialog as presented yet, so every dialog still finishes as before.
msg_dialog_request_tests checks the buttons, focus and cancel button of the four
presented button types, the decoded message, and that other button types, modes
and parameters without a user message or a message pointer are refused without
touching the output.
MsgDialog::BuildRequest turns a parsed user message with button type 0, 1, 3 or 4
into a ModalDialogRequest: OK; Yes and No; OK and Cancel; Yes and No with the
focus on No. The cancel input picks the last button. Dialogs without a message
pointer, in progress bar or system message mode, without buttons or with a
button type outside those four are not presented, so their callers keep the
automatic answer. The button id of a choice is its index plus one.
msg_dialog_text_tests checks ASCII, two-, three- and four-byte sequences,
the replacement of an invalid lead byte, a stray continuation byte, overlong
forms, an encoded surrogate, a code point past U+10FFFF and truncated or broken
sequences.
The overlay draws UTF-16 code units. MsgDialog::DecodeUtf8 converts a guest
message, replacing each byte of an invalid, overlong, truncated or surrogate
sequence and each stray continuation byte with U+FFFD, and encoding code points
past U+FFFF as surrogate pairs.
A host-only test builds parameters in memory and checks the mode fallback, the
other modes not reading a user message, the button type, a null message
pointer, the 1024-byte cap and the 160-character masked log text. It gives
libSceMsgDialog its own CMakeLists.txt, which builds the same Export.cpp as
before.
sceMsgDialogOpen read the mode, the user message parameter, the button type and
the message through a function that wrote file-scope state. The parse is now a
stateless header returning a ParsedParam, so both message dialog libraries and
tests can share it. The mode, the readability checks, the focused button and the
logged text are unchanged.
Replace the unimplemented stubs with a working NONE -> INITIALIZED ->
RUNNING -> FINISHED state machine for the message dialog PRX. Open()
best-effort parses the SceMsgDialogParam layout to pick a sensible
default button (auto-focus-no variants answer No, everything else
answers Yes/OK), then auto-finishes the dialog after a couple of status
polls so a title that waits on a dialog for user input never blocks
forever. Progress-bar mode is instead closed by the title itself via
sceMsgDialogClose, with a time cap as a safety net. GetResult now fills
in a real SceMsgDialogResult (mode/result/buttonId) instead of leaving
the caller's buffer untouched.