feat(libSceIme): implement keyboard info and mode queries #738

Merged
adriadam10 merged 1 commit from upstream-pr/738 into main 2026-10-05 23:39:33 +00:00
adriadam10 commented 2026-10-05 18:44:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-05T18:44:53Z.


What

Implements sceImeKeyboardGetInfo and sceImeKeyboardSetMode (libSceIme), on top of the existing keyboard open/close state.

  • sceImeKeyboardGetInfo: null info → 0x80bc0031 (INVALID_ADDRESS); no keyboard open → 0x80bc0002 (NOT_OPENED); otherwise 0x80bc0023 (NO_RESOURCE_ID) for every id, since no resource id is ever handed out (no IME keyboard device is reported). info is not written. Follows KytyPS5 ImeKeyboardGetInfo.
  • sceImeKeyboardSetMode: user -1 → 0x80bc0010 (INVALID_USER_ID); keyboard not open for that user → NOT_OPENED; mode bits outside 0x7f → 0x80bc0024 (INVALID_MODE); otherwise 0. Follows KytyPS5 ImeKeyboardSetMode; the 0x7f mask is the union of the SCE_IME_KEYBOARD_MODE_* bits in fpPS4 (ps4_libsceime.pas, 0x01..0x40).
  • Error codes match KytyPS5 and shadPS4 (ime_error.h).

Where the references differ:

  • KytyPS5 keeps one global keyboard; here the open state is per user (existing sceImeKeyboardOpen/Close), so SetMode checks the given user and GetInfo checks whether any keyboard is open.
  • fpPS4's GetInfo checks "not opened" before the null pointer and reports the host keyboard; KytyPS5's order (null pointer first) is used here.
  • shadPS4 stubs both (return ORBIS_OK, GetInfo zeroes info).

The mode has no effect because no IME keyboard events are delivered; both are listed in TechnicalDebt (Functional).

#696 (sceImeKeyboardGetResourceId) adds the same two error constants next to the existing ones: whichever merges second needs a trivial rebase of that block. No function overlap.

Tested

Linux, GCC (Release and a fast build). New guest test guest_ime_keyboard (core/libs/tests/GuestImeKeyboard.cpp, registered in ctest): every error path, the closed/open/closed sequence, mode bits 0/0x7f/0x41 accepted and 0x80/0x80000001 rejected, info left untouched. On main both exports throw (NotImplemented_nid_no_patch). Each check was verified to fail when its piece of the implementation is removed.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4749397842 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/738). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-05T18:44:53Z. --- ### What Implements `sceImeKeyboardGetInfo` and `sceImeKeyboardSetMode` (libSceIme), on top of the existing keyboard open/close state. - `sceImeKeyboardGetInfo`: null `info` → `0x80bc0031` (INVALID_ADDRESS); no keyboard open → `0x80bc0002` (NOT_OPENED); otherwise `0x80bc0023` (NO_RESOURCE_ID) for every id, since no resource id is ever handed out (no IME keyboard device is reported). `info` is not written. Follows [KytyPS5](https://github.com/KytyPS5/KytyPS5) `ImeKeyboardGetInfo`. - `sceImeKeyboardSetMode`: user `-1` → `0x80bc0010` (INVALID_USER_ID); keyboard not open for that user → NOT_OPENED; mode bits outside `0x7f` → `0x80bc0024` (INVALID_MODE); otherwise 0. Follows KytyPS5 `ImeKeyboardSetMode`; the `0x7f` mask is the union of the `SCE_IME_KEYBOARD_MODE_*` bits in [fpPS4](https://github.com/red-prig/fpPS4) (`ps4_libsceime.pas`, 0x01..0x40). - Error codes match KytyPS5 and shadPS4 (`ime_error.h`). Where the references differ: - KytyPS5 keeps one global keyboard; here the open state is per user (existing `sceImeKeyboardOpen`/`Close`), so `SetMode` checks the given user and `GetInfo` checks whether any keyboard is open. - fpPS4's `GetInfo` checks "not opened" before the null pointer and reports the host keyboard; KytyPS5's order (null pointer first) is used here. - shadPS4 stubs both (`return ORBIS_OK`, `GetInfo` zeroes `info`). The mode has no effect because no IME keyboard events are delivered; both are listed in TechnicalDebt (Functional). #696 (`sceImeKeyboardGetResourceId`) adds the same two error constants next to the existing ones: whichever merges second needs a trivial rebase of that block. No function overlap. ### Tested Linux, GCC (Release and a fast build). New guest test `guest_ime_keyboard` (`core/libs/tests/GuestImeKeyboard.cpp`, registered in ctest): every error path, the closed/open/closed sequence, mode bits 0/0x7f/0x41 accepted and 0x80/0x80000001 rejected, `info` left untouched. On `main` both exports throw (`NotImplemented_nid_no_patch`). Each check was verified to fail when its piece of the implementation is removed. ### 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 in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes
github-actions[bot] commented 2026-10-05 18:45:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-05T18:45:18Z.


Progress report (bc24783 → 58263b5)

📈 System libraries: 79.6% (+0.06%, +2 implemented functions)

✅ 2 implemented
Library Name
libSceIme sceImeKeyboardGetInfo
libSceIme sceImeKeyboardSetMode
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6000868735 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/738#issuecomment-6000868735). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-05T18:45:18Z. --- <!-- progress-report --> ### Progress report (bc24783 → 58263b5) 📈 **System libraries**: 79.6% (+0.06%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libSceIme | `sceImeKeyboardGetInfo` | | libSceIme | `sceImeKeyboardSetMode` | </details>
oneandonlydean commented 2026-10-05 20:30:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T20:30:17Z.


Thanks for this. It needs a rebase: docs/dev/TechnicalDebt.md conflicts with current main, where #649 added its sceAudioOut2Set3DLatency line at the same spot as your sceImeKeyboardGetInfo line. Keeping both lines is enough.

I checked the rest with that resolved. Both NIDs match the names, the error codes and the mode mask are consistent with what sceImeKeyboardOpen already records, and guest_ime_keyboard fails on main's code and passes with the change (Linux, GCC). One note for later: #696 adds ErrorConnectionFailed next to the same constants in libSceIme/Export.cpp, so whichever of the two lands second will need a one-line rebase there.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6002367031 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/738#issuecomment-6002367031). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-05T20:30:17Z. --- Thanks for this. It needs a rebase: `docs/dev/TechnicalDebt.md` conflicts with current `main`, where #649 added its `sceAudioOut2Set3DLatency` line at the same spot as your `sceImeKeyboardGetInfo` line. Keeping both lines is enough. I checked the rest with that resolved. Both NIDs match the names, the error codes and the mode mask are consistent with what `sceImeKeyboardOpen` already records, and `guest_ime_keyboard` fails on main's code and passes with the change (Linux, GCC). One note for later: #696 adds `ErrorConnectionFailed` next to the same constants in `libSceIme/Export.cpp`, so whichever of the two lands second will need a one-line rebase there.
adriadam10 commented 2026-10-05 22:30:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-05T22:30:27Z.


Rebased on current main: kept both the sceAudioOut2Set3DLatency and sceImeKeyboardGetInfo lines. guest_ime_keyboard passes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6004485048 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/738#issuecomment-6004485048). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-05T22:30:27Z. --- Rebased on current `main`: kept both the `sceAudioOut2Set3DLatency` and `sceImeKeyboardGetInfo` lines. `guest_ime_keyboard` passes.
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!738
No description provided.