Files
AnyPS5/docs/dev/debt/libSceIme.md
T

13 KiB

libSceIme technical debt

Silent stubs

  • sceImeOpen (libSceIme) shows no panel: the text is typed on the host keyboard, which ImeTextInput forwards from the game window (SDL text input, Backspace, Delete, Left, Right, Home, End, Enter and Escape), and the controller cannot type. While a panel is open, key presses do not reach the keyboard-to-pad bindings of PadInput, as the console's panel takes the controller; key releases still do. Minecraft Preview (PPSA19639, #1277) opens it when entering a world. The external keyboard filter is accepted and never called because no keycode events are produced

Unknown function info

Functional

  • sceImeKeyboardOpen, sceImeKeyboardClose (libSceIme) - opening a keyboard that is already open for the same user returns 0x80bc0001 (busy) and closing one that is not open returns 0x80bc0002, as KytyPS5 does; it tracks one keyboard for all users, while the open state is kept per user id here, and the PS5 result is unverified
  • sceImeKeyboardGetInfo (libSceIme) returns 0x80bc0023 (no resource id) for every id while a keyboard is open, since the IME keyboard never reports a connected device. sceImeKeyboardSetMode validates the mode bits but the mode has no effect, as no IME keyboard events are delivered.
  • sceImeKeyboardGetResourceId (libSceIme) reports that no USB keyboard is connected (0x80bc0004, as shadPS4 does) because IME keyboard events are not delivered to the handler, although libSceKeyboard exposes the host keyboard
  • sceImeOpen text filter (libSceIme) runs on the text edits of host input - typing, backspace, forward delete and a multiline Enter - following KytyPS5, not confirmed on a PS5. The host input thread only queues the edit under the IME mutex; sceImeUpdate applies it on the title's thread, where the filter also runs with the mutex released - like the event handler, so a filter that calls back into sceIme* cannot deadlock - and the structural edit and the filtered commit are serialized under the mutex, with a commit after the session closed or reopened dropped by a session id. The filter is guest code and ImeTextFilter and ImeExtKeyboardFilter are declared APS5_VABI like EventHandler. The filter is called with the edited text, a buffer of maxTextLength UTF-16 units and its length; a nonzero return, an output longer than the capacity, an unpaired surrogate or, without the multiline option, a line break keeps the edit unfiltered. An accepted output replaces the text, the caret stays where the edit put it and is clamped to the text and normalized past a surrogate pair, and one UpdateText is sent with the minimal edit delta of the whole old and new text, as KytyPS5 computes it; an output equal to the previous text sends no event. Caret moves, PressEnter without multiline, PressClose, sceImeSetText and sceImeSetCaret do not run the filter, as in KytyPS5; a sceImeSetText or sceImeSetCaret that lands while the filter runs bumps a revision beside the session id, and the filtered commit is dropped when either changed, as KytyPS5 drops the commit when its revision changed, so the title's own text or caret setting wins, the edit is discarded and sends no event. An external keyboard filter is accepted and stored on the session: it is called only for keyboard events that carry key data, which the host input path does not produce - it delivers text and actions, as KytyPS5's host API queues external inputs with a zeroed key and skips the filter for them - so it is never called