feat(libSceIme): open a panel-less IME fed by the host keyboard #4756
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4756"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-12T20:52:47Z.
What
sceImeOpenthrew, so Minecraft Preview (PPSA19639) stopped when entering a world (#1277; the bring-up post worked around it locally by returning an error). This PR implements the IME as a session without a panel, with the text typed on the host keyboard:sceImeOpenvalidates the parameters, takes the initial text frominputTextBuffer, places the caret after it and queues the Open event (position andsceImeGetPanelSizesize). Edits keepinputTextBufferand a copy inworkin sync and queue UpdateText (one edit area: position and change in UTF-16 units) or UpdateCaret (one per UTF-16 unit). Enter sends PressEnter (or inserts a line break with the multiline option); Escape sends PressClose.sceImeUpdate(handler)delivers the queue with theargfromsceImeOpenwhen given the handler passed to it, outside the lock, so a handler may callsceImeClose.sceImeSetText,sceImeSetCaret,sceImeSetTextGeometry,sceImeGetPanelPositionAndFormandsceImeClosework while a panel is open. Typed text is cut tomaxTextLengthwithout splitting a surrogate pair.ImeTextInputforwards SDL text input (already enabled by SDL on desktop, so host keyboard layouts and host IMEs work) and Backspace, Delete, Left, Right, Home, End, Enter and Escape from the game window. While a panel is open, key presses no longer reach the keyboard-to-pad bindings, as the console's panel takes the controller; releases still do, so no button sticks.EventHandlergetsAPS5_VABI, since it is a guest function now called from host code.Event ids, caret directions, payload layout and error codes follow the PS4 reimplementation in shadPS4
ime.cpp; its SDK-version-dependent masks are not applied. A text filter or external keyboard filter throws (contract unknown). The panel-less behaviour is listed under Silent stubs and every assumption is recorded indocs/dev/debt/libSceIme.md.New
guest_ime_opencovers everysceImeOpenerror, the Open event and handlerarg, delivery only to the opening handler, insertion with UTF-8 to UTF-16 conversion and surrogate pairs, the length limit, Backspace/Delete/caret moves at the edges,SetText/SetCaret, Enter and Escape, the multiline option, a close from inside the handler dropping the remaining events, and the SDL event translation (window filter, key repeats, key-up). Removing the surrogate guard, offsetting the Backspace edit index or dropping the handler check each make it fail.Tested
Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7),
BUILD_TESTING=ON:guest_ime_open,guest_ime_parametersandguest_ime_keyboardpass;libSceVideoOutbuilds.python tools/check_conventions.py --base origin/mainandtools/check_test_registration.pypass. Not tested in Minecraft (no copy here) and the pad suppression is not covered by a test, sincePadInputneeds an SDL window.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T00:10:09Z.
Windows test: head
3055e553bmerged onto currentmain90c683946(clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release,-j2: full build 0 errors; ctest with the filterguest_ime_open: guest_ime_open passed (1 test(s), 0 failed);python tools/check_conventions.py --base upstream/mainpassed. I did not run the new tests againstmainwithout the change.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T02:43:23Z.
This needs a run of PPSA19639 on this head: does entering a world get past
sceImeOpen, and does the title take the typed text? The event ids and payloads come from a PS4 reimplementation, and the description says it wasn't tried in the title.The Windows test above ran
3055e553b, not the current head, and nobody has built it on Linux yet.Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-13T07:17:10Z.
I don't have PPSA19639 to run, so I can't show it here. @ddrsilva, you reported the
sceImeOpenstop when entering a world in #1277: could you try this head with your Minecraft Preview build and say whether it gets pastsceImeOpenand takes typed text? Until someone can, it can stay open or be closed, whichever you prefer.Imported from boykopovar/AnyPS5. Originally posted by simonbbby on 2026-10-13T11:24:37Z.
Linux verification of exact PR head
f6f49148f2bb32438a79ee3b0e9eccc4c53142b5, Ubuntu 24.04 / GCC 13.3 / Ninja Release,BUILD_TESTING=ON,ANYPS5_ENABLE_SPIRV_TOOLS=ON:guest_ime_open_tests,guest_ime_parameters_tests,guest_ime_keyboard_tests, andlibSceVideoOutsuccessfully.ctest -R '^guest_ime_(open|parameters|keyboard)$' --repeat until-fail:3 --timeout 30 --no-tests=error: all three tests passed three consecutive runs each, no skips or timeouts.PadInputimplementation with default bindings: Space drives Cross before opening IME; a held Space releases while IME is open; new Space/A presses are suppressed during IME; Cross and left-stick input resume after closing it. All checks passed. The harness sends constructed SDL events directly toPadInput::HandleEventand capturesPadPublishInput_nid_postfix; this is a component test, without an interactive window.PadInput.cpp, retaining the PR's IME library. It fails at the assertion that a new Space press is suppressed during IME. Rebuilding against the PR'sPadInput.cpppasses.This covers the missing Linux build/test evidence and the keyboard-to-pad capture logic. I have not run PPSA19639 or verified its acceptance of the event IDs/payloads; that title check remains outstanding.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T15:27:15Z.
Checked the build and ctest for libSceIme/libSceVideoOut on the merge with main (
guest_ime_openpasses, 46/46 in scope), the error order and event layout against the cited shadPS4 revision, and the third-party Linux/Windows runs above (including thePadInputsuppression harness with its negative control).sceImeOpenthrew before, so only titles that call it change behaviour. Not run on PPSA19639; merging once the Windows build is green.Imported from boykopovar/AnyPS5. Originally posted by ddrsilva on 2026-10-13T16:55:55Z.
Tested the IME implementation from head
f6f49148f2bb32438a79ee3b0e9eccc4c53142b5with Minecraft Preview 1.21.40.22 (PPSA19639) on Windows 11, MinGW-w64 GCC 15.2, RTX 2080 Ti.The functional checks passed in my isolated integrated Minecraft build:
IME4756with the physical keyboard, and pressed Enter. The title displayed and accepted the text. Both the world'slevelname.txtand its level-info cache persistedIME4756.sceImeOpenstop or fatal exception occurred during this run.GuestImeOpen,GuestImeParameters, andGuestImeKeyboardfrom this PR all passed.Scope: this was not a build/run of the entire unmodified PR head. I used the PR's
libSceIme/Export.cpp,ImeInput.hpp, and bothImeTextInputfiles byte-for-byte, and adapted its VideoOut event-loop and pad-suppression additions to my existing working Minecraft integration. That integration includes separate boot/rendering/performance changes; its base is2a6910ac(upstreamb5f5362dplus local work). The EventHandler guest ABI was already equivalent there. The existing backend/other modules were retained, and native-input mode was disabled for this test. This is title-specific functional evidence for the IME implementation, not independent validation of every change on current upstream, all text fields, other titles, or an FPS improvement.Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-13T20:13:17Z.
Since the Windows CI job only runs on push or manual dispatch, here is a local Windows run: Windows 11, MinGW-w64 GCC 15 (winlibs), Ninja, Release. I built head
f6f49148fmerged into currentmain(a0f5916a2); it merges cleanly and the full tree builds.ctest -R "ime_|video|pad_input|mouse": 28/28 pass, with 6video_out_flip_*/wqhd_no_vulkantests skipping themselves because ctest runs SDL offscreen (no Vulkan surface).guest_ime_open,guest_ime_parameters,guest_ime_keyboardandpad_inputpass.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T03:06:04Z.
#4704 moved the keyboard and mouse handling in
PadInput::HandleEventinto the new keyboard/mouse handler, so this conflicts with main now. Could you rebase and move theImeCapturesKeyboardkeydown check into that handler? It's ready to merge after that.Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-14T07:56:27Z.
Rebased onto
main1209d3707(head435be9905). Since38bc0fd34, key and mouse handling lives inPad::KeyboardMouse::HandleEvent. So this PR's onePadInput.cppchange, not mapping a key-down to the pad while the IME takes the keyboard, now sits just before that call:if (event.type == SDL_KEYDOWN && ImeCapturesKeyboard_nid_postfix()) return;. Key-ups still reach it, so held keys are released. Nothing else changed. On Windows 11 (MinGW GCC 15, Release) the full tree builds,ctest -R "ime_|video|pad_input|mouse|keyboard"passes 30/30 (includingguest_ime_open,guest_ime_parameters,guest_ime_keyboardandpad_input), and the conventions check passes. Now shows as mergeable.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T10:42:35Z.
Checked the build and ctest for libSceIme/libSceVideoOut on the merge with main (
guest_ime_openpasses, 52/52 in scope), thePadInputchange after the rebase onto #4704, the error order and event layout against the cited shadPS4 revision, and the debt entries. Title run by @ddrsilva on PPSA19639 and the Linux/Windows runs above cover the rest; merging once the Windows build is green.