feat(libSceKeyboard): open a second keyboard port with index 1 #18119
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18119"
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 eliasbruno124-dev on 2026-11-10T14:05:17Z.
What
The Last of Us Part II Remastered (PPSA15508, 01.002.000) opens two keyboard ports for the initial user at start-up and stops when the second open fails:
-2133196799is0x80da0001, theINVALID_ARGthatsceKeyboardOpenreturns here for every index other than 0. At the title's call sites (0xd76403and0xd76427) both calls pass the same user, type 0 and a null parameter; the first passes index 0 and the second index 1, and each result has to be above 0.Give index 1 its own handle, 2, for a port with no keyboard attached. The host keyboard stays on index 0. On the second handle
sceKeyboardReadreturns no samples,sceKeyboardReadStatereturns a disconnected sample of length 1 (the shape the first port reports after a disconnect),sceKeyboardGetConnectionreports false,sceKeyboardGetKey2Charconverts as for the first port, since it uses no device state, andsceKeyboardDebugGetDeviceIdreturnsINVALID_HANDLE, as for any handle without a device. Opening index 1 twice returnsALREADY_OPENED, and each port is closed on its own. The order of the checks is unchanged, so a bad type or index still comes before the user check, and any other index keepsINVALID_ARG.The only source is that call site, which shows what the title expects and not what the console's library does: the library's code was not read (no copy of it was available), and shadPS4's
sceKeyboardOpenis a stub that returns 1 whatever it is passed. The range ofindexand what a port without a keyboard answers on a console are recorded as unverified indocs/dev/debt/libSceKeyboard.md.Tested
Windows 11 Pro 10.0.26300, MSYS2 UCRT64 GCC 16.2.0-6, Release. The title needs other open pull requests to reach this stop, so the build is an integration:
main39bac5d055with #18086 (MSYS2 configuration), #18116, #11630 (b17933dfd4), #17570 (06457e01f1) and #3965 (8029f87e58) merged, with and without this change.keyboard_input, with the extendedKeyboard.cpp, and the five other tests matchingkeyboardpass. The new cases cover:INVALID_ARGfor index 2, index -1 and type 1 with either index; the user checks for index 1; the second handle refused before it is opened; a second open of index 1 returningALREADY_OPENED; the read, state, connection, conversion and device-id answers described above, including untouched output on an empty read; closing the second port twice; and the first port still open and connected afterwards.mainreturnsINVALID_ARGfor index 1 before it looks at the user, so the new index 1 cases fail there.int 0x41, exit0xC0000005).python tools/check_conventions.py --base origin/mainandgit diff --checkpass.Not tested: this change alone on
mainwith the title (it stops earlier there, atsceHttp2SendRequestAsync), a real second keyboard, Linux and macOS, a console. No menu or gameplay result is claimed.Overlap: of the open pull request heads fetched on 2026-11-10, four change a keyboard file. #17948 guards the output buffers of
sceKeyboardReadandsceKeyboardReadStatein the lines this branch extends for the second handle, so the two conflict inkeyboard_impl.cpp; it does not open a second port, and I will rebase onto it if it lands first. #17934 merges cleanly with this branch. #13486 and #14212 already conflict withmainin other files.tools/pr_overlap.py --branchdid not finish on this partial clone (dropped connections), so this comes from the file lists of the fetched heads and trial merges. The branch merges cleanly intomain3c9276b78f, which was not built here.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)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-10T21:47:43Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
06d7ed43c2:tools/check_conventions.pypassed;git diff --checkclean.keyboard_testsbuilt cleanly.keyboard_input,keyboard_dialog):Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-11T18:56:37Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
06d7ed43c2:tools/check_conventions.pypassed;git diff --checkclean.keyboard_testsbuilt cleanly.keyboard_input,keyboard_dialog):core/libs/prx/libSceKeyboard/include/keyboard_structs.h,core/libs/prx/libSceKeyboard/src/keyboard_impl.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me