feat(libSceConvertKeycode): implement sceConvertKeycodeGetCharacter for the US layout #5366

Merged
codingreapermaps merged 1 commit from upstream-pr/5366 into main 2026-10-14 06:17:43 +00:00
codingreapermaps commented 2026-10-13 18:06:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by codingreapermaps on 2026-10-13T18:06:56Z.


What

sceConvertKeycodeGetCharacter was a throwing stub. PPSA12361 (Transport Fever 2: Console Edition) calls it at start-up, while it builds the names of its key bindings, and stopped with sceConvertKeycodeGetCharacter not implemented before its main menu.

  • The signature is inferred from the title's call site: edi holds a zero-extended 16-bit keycode, esi is 0, edx is the type sceConvertKeycodeGetImeKeyboardType returned and rcx points at a 16-bit value. When the result is 0 the title writes a terminator after that value and reads it as a UTF-16 string; on any other result, or an empty string, it uses its own table of key names.
  • The keycode is taken as a USB HID keyboard usage. Letters, digits, punctuation, space and the keypad return their unshifted US-layout character; any other keycode returns 0 with the character 0.
  • A null output returns 0x80BC0031, as sceConvertKeycodeGetImeKeyboardType does. A second argument other than 0, or a keyboard type other than 0, throws: the title never passes them, and sceConvertKeycodeGetImeKeyboardType only reports type 0.

The inferred signature, the unknown second argument and the unmeasured result for a keycode without a character are recorded in docs/dev/debt/libSceConvertKeycode.md.

Tested

Windows 11, MinGW-w64 GCC 15.2.0, relinked with --windows --to-intel.

  • PPSA12361: without the change it aborts about 12 s after start with sceConvertKeycodeGetCharacter not implemented; with it the title reaches its main menu and opens its settings page.
  • keyboard_input passes.
  • Built and run on 60fb61870, 112 commits before the main this branch is rebased on; not rebuilt after the rebase. No test was added: the function has no state, and the only reference for its results is this one title.

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 under Silent stubs in their library's technical debt file
  • 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
  • Unblocks: PPSA12361 (no Game bring-up discussion yet)
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4847431028 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5366). Originally posted by [codingreapermaps](https://github.com/codingreapermaps) on 2026-10-13T18:06:56Z. --- ### What `sceConvertKeycodeGetCharacter` was a throwing stub. PPSA12361 (Transport Fever 2: Console Edition) calls it at start-up, while it builds the names of its key bindings, and stopped with `sceConvertKeycodeGetCharacter not implemented` before its main menu. - The signature is inferred from the title's call site: `edi` holds a zero-extended 16-bit keycode, `esi` is 0, `edx` is the type `sceConvertKeycodeGetImeKeyboardType` returned and `rcx` points at a 16-bit value. When the result is 0 the title writes a terminator after that value and reads it as a UTF-16 string; on any other result, or an empty string, it uses its own table of key names. - The keycode is taken as a USB HID keyboard usage. Letters, digits, punctuation, space and the keypad return their unshifted US-layout character; any other keycode returns 0 with the character 0. - A null output returns `0x80BC0031`, as `sceConvertKeycodeGetImeKeyboardType` does. A second argument other than 0, or a keyboard type other than 0, throws: the title never passes them, and `sceConvertKeycodeGetImeKeyboardType` only reports type 0. The inferred signature, the unknown second argument and the unmeasured result for a keycode without a character are recorded in `docs/dev/debt/libSceConvertKeycode.md`. ### Tested Windows 11, MinGW-w64 GCC 15.2.0, relinked with `--windows --to-intel`. - PPSA12361: without the change it aborts about 12 s after start with `sceConvertKeycodeGetCharacter not implemented`; with it the title reaches its main menu and opens its settings page. - `keyboard_input` passes. - Built and run on `60fb61870`, 112 commits before the `main` this branch is rebased on; not rebuilt after the rebase. No test was added: the function has no state, and the only reference for its results is this one title. ### 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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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] Unblocks: PPSA12361 (no Game bring-up discussion yet) - [x] GPUs tested: n/a - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-13 18:07:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T18:07:42Z.


Progress report (18c438b → 5ca6487)

📈 System libraries: 88.18% (+0.03%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceConvertKeycode sceConvertKeycodeGetCharacter
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6152013009 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5366#issuecomment-6152013009). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-13T18:07:42Z. --- <!-- progress-report --> ### Progress report (18c438b → 5ca6487) 📈 **System libraries**: 88.18% (+0.03%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceConvertKeycode | `sceConvertKeycodeGetCharacter` | </details>
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!5366
No description provided.