feat(libScePad): analog keyboard input with a stick modifier and stick and trigger ramps #7500

Merged
AlxcBTW merged 5 commits from upstream-pr/7500 into main 2026-10-18 21:10:27 +00:00
AlxcBTW commented 2026-10-18 09:36:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-18T09:36:01Z.


What

Keys move a stick fully or not at all, and a key bound to L2 or R2 presses the trigger to 255 at once. Walking slowly, steering a vehicle or feathering a throttle with the keyboard is not possible. Three opt-in changes, one per commit, all off or unbound by default, so the built-in behaviour and the bytes reported to the title are unchanged:

  1. StickModifier action (no built-in binding) and StickModifierScale (0.05 to 1, default 0.5). While a key or mouse button bound to StickModifier is held, keyboard stick bindings tilt the stick by the scale instead of fully. Opposite keys still cancel. Controller sticks and the mouse stick are not affected.
  2. KeyboardRampMs (0 to 2000, default 0 = off). The keyboard stick axes move toward their target at a steady speed (full range in that many milliseconds) instead of jumping, and back the same way. Pad::KeyboardMouse::Advance now also returns true while an axis is still moving, so PadInput::Update publishes the new state without an input event.
  3. TriggerRampMs (0 to 2000, default 0 = off). The same for a key or mouse button bound to L2 or R2. The digital bit follows the analog value (set while it is above 0). A pressed controller trigger is not slowed: the larger of the two values is passed on.

An axis reaches StickByte(+-1) = 255 or 0 exactly, so with the settings at their defaults the sticks report the same bytes as before (0, 128, 255). docs/user/INPUT_MAPPING.md documents the action, the three settings and a section "Analog keyboard input".

Not included: a default key for StickModifier (Left Alt is R1 in the built-in bindings), wheel-driven trigger levels, and any default-binding change.

Tested

  • Linux (Ubuntu 24.04, GCC 13, Mesa lavapipe runner), fork CI at a210a8e030 (the PR head 438e1baa3 plus the CI scaffolding commit; run 39113655574, ctest -R '^(pad_|guest_pad|video_out_mouse|mouse_input|keyboard_input)'): 9 of 9 passed, among them pad_keyboard_mouse and pad_input_mapping. Not run on Windows.
  • New checks in pad_keyboard_mouse, with timed events through the existing simulation (PadSimulation::Simulate):
    • stick modifier: half tilt (64 and 192) while held with a key or a mouse button, opposite keys cancel, full tilt again on release, the modifier alone moves nothing, scales 0.25 and 1.
    • keyboard ramp: a 100 ms ramp is 0.2 after 20 ms and 0.5 after 50 ms, reaches full tilt, moves only in one direction, returns at the same speed after release, stops at a modified tilt, and Release() centres it at once.
    • ramp keeps advance reporting: Advance returns true while the axis moves and false when it has settled or nothing is held.
    • trigger ramp: without a ramp a press is 255 at once; with 100 ms it starts at 0 with the bit clear, is about half after 50 ms, ends at 255, returns the same way; a controller trigger above the ramp value is passed on.
  • pad_input_mapping: the new action and settings are read case-insensitively, take their defaults, and reject out-of-range, non-numeric and duplicate values; a wheel direction cannot be a StickModifier.
  • Not tested in a game with a real keyboard.
  • python3 tools/check_conventions.py --base origin/main passes. tools/pr_overlap.py lists #6353 (a new InputControl value next to TouchRight, the actions array and the Compose switch: textual overlap, no shared function; a rebase of whichever merges second) and #6012 (the list of actions in docs/user/INPUT_MAPPING.md), and could not compare #674, #4891 and #7201 (InputMapping.cpp, InputMapping.hpp, docs). Based on cdb7ed035.

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: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4908011920 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7500). Originally posted by [AlxcBTW](https://github.com/AlxcBTW) on 2026-10-18T09:36:01Z. --- ### What Keys move a stick fully or not at all, and a key bound to L2 or R2 presses the trigger to 255 at once. Walking slowly, steering a vehicle or feathering a throttle with the keyboard is not possible. Three opt-in changes, one per commit, all off or unbound by default, so the built-in behaviour and the bytes reported to the title are unchanged: 1. **`StickModifier` action** (no built-in binding) and **`StickModifierScale`** (0.05 to 1, default 0.5). While a key or mouse button bound to `StickModifier` is held, keyboard stick bindings tilt the stick by the scale instead of fully. Opposite keys still cancel. Controller sticks and the mouse stick are not affected. 2. **`KeyboardRampMs`** (0 to 2000, default 0 = off). The keyboard stick axes move toward their target at a steady speed (full range in that many milliseconds) instead of jumping, and back the same way. `Pad::KeyboardMouse::Advance` now also returns true while an axis is still moving, so `PadInput::Update` publishes the new state without an input event. 3. **`TriggerRampMs`** (0 to 2000, default 0 = off). The same for a key or mouse button bound to L2 or R2. The digital bit follows the analog value (set while it is above 0). A pressed controller trigger is not slowed: the larger of the two values is passed on. An axis reaches `StickByte(+-1)` = 255 or 0 exactly, so with the settings at their defaults the sticks report the same bytes as before (0, 128, 255). `docs/user/INPUT_MAPPING.md` documents the action, the three settings and a section "Analog keyboard input". Not included: a default key for `StickModifier` (`Left Alt` is `R1` in the built-in bindings), wheel-driven trigger levels, and any default-binding change. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> - Linux (Ubuntu 24.04, GCC 13, Mesa lavapipe runner), fork CI at a210a8e030 (the PR head 438e1baa3 plus the CI scaffolding commit; run 39113655574, ctest `-R '^(pad_|guest_pad|video_out_mouse|mouse_input|keyboard_input)'`): 9 of 9 passed, among them `pad_keyboard_mouse` and `pad_input_mapping`. Not run on Windows. - New checks in `pad_keyboard_mouse`, with timed events through the existing simulation (`PadSimulation::Simulate`): - `stick modifier`: half tilt (64 and 192) while held with a key or a mouse button, opposite keys cancel, full tilt again on release, the modifier alone moves nothing, scales 0.25 and 1. - `keyboard ramp`: a 100 ms ramp is 0.2 after 20 ms and 0.5 after 50 ms, reaches full tilt, moves only in one direction, returns at the same speed after release, stops at a modified tilt, and `Release()` centres it at once. - `ramp keeps advance reporting`: `Advance` returns true while the axis moves and false when it has settled or nothing is held. - `trigger ramp`: without a ramp a press is 255 at once; with 100 ms it starts at 0 with the bit clear, is about half after 50 ms, ends at 255, returns the same way; a controller trigger above the ramp value is passed on. - `pad_input_mapping`: the new action and settings are read case-insensitively, take their defaults, and reject out-of-range, non-numeric and duplicate values; a wheel direction cannot be a `StickModifier`. - Not tested in a game with a real keyboard. - `python3 tools/check_conventions.py --base origin/main` passes. `tools/pr_overlap.py` lists #6353 (a new `InputControl` value next to `TouchRight`, the `actions` array and the `Compose` switch: textual overlap, no shared function; a rebase of whichever merges second) and #6012 (the list of actions in `docs/user/INPUT_MAPPING.md`), and could not compare #674, #4891 and #7201 (`InputMapping.cpp`, `InputMapping.hpp`, docs). Based on cdb7ed035. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-18 10:31:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T10:31:41Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 674 core/libs/prx/libSceVideoOut/src/InputMapping.cpp
docs/user/INPUT_MAPPING.md
PR 4891 core/libs/prx/libScePad/include/InputMapping.hpp
core/libs/prx/libScePad/include/PadInputTypes.hpp
core/libs/prx/libSceVideoOut/src/InputMapping.cpp
docs/user/INPUT_MAPPING.md
PR 6353 core/libs/prx/libScePad/include/InputMapping.hpp
core/libs/prx/libScePad/include/KeyboardMouse.hpp
core/libs/prx/libScePad/include/PadInputTypes.hpp
core/libs/prx/libSceVideoOut/src/InputMapping.cpp
core/libs/prx/libSceVideoOut/src/KeyboardMouse.cpp
core/libs/prx/libSceVideoOut/tests/KeyboardMouse.cpp
docs/user/INPUT_MAPPING.md
PR 7201 core/libs/prx/libSceVideoOut/src/InputMapping.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6248785133 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7500#issuecomment-6248785133). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-18T10:31:41Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 674](https://www.github.com/boykopovar/AnyPS5/pull/674) | `core/libs/prx/libSceVideoOut/src/InputMapping.cpp`<br>`docs/user/INPUT_MAPPING.md` | | [PR 4891](https://www.github.com/boykopovar/AnyPS5/pull/4891) | `core/libs/prx/libScePad/include/InputMapping.hpp`<br>`core/libs/prx/libScePad/include/PadInputTypes.hpp`<br>`core/libs/prx/libSceVideoOut/src/InputMapping.cpp`<br>`docs/user/INPUT_MAPPING.md` | | [PR 6353](https://www.github.com/boykopovar/AnyPS5/pull/6353) | `core/libs/prx/libScePad/include/InputMapping.hpp`<br>`core/libs/prx/libScePad/include/KeyboardMouse.hpp`<br>`core/libs/prx/libScePad/include/PadInputTypes.hpp`<br>`core/libs/prx/libSceVideoOut/src/InputMapping.cpp`<br>`core/libs/prx/libSceVideoOut/src/KeyboardMouse.cpp`<br>`core/libs/prx/libSceVideoOut/tests/KeyboardMouse.cpp`<br>`docs/user/INPUT_MAPPING.md` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libSceVideoOut/src/InputMapping.cpp` |
blawesom commented 2026-10-18 16:32:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-18T16:32:20Z.


Rebase handoff — rebased onto current main (all three commits, authorship unchanged). One docs conflict in INPUT_MAPPING.md, unioned.

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV): builds; conventions pass; full suite green apart from the two known main regressions (agc_driver_tessellation — Mesa, #5444; agc_driver_bda_device — #7584), neither from this PR.

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/7500
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is 039986ba1.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6252335317 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7500#issuecomment-6252335317). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-18T16:32:20Z. --- **Rebase handoff** — rebased onto current `main` (all three commits, authorship unchanged). One docs conflict in `INPUT_MAPPING.md`, unioned. Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): builds; conventions pass; **full suite green apart from the two known `main` regressions** (`agc_driver_tessellation` — Mesa, #5444; `agc_driver_bda_device` — #7584), neither from this PR. **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/7500 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `039986ba1`.
AlxcBTW commented 2026-10-18 18:13:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by AlxcBTW on 2026-10-18T18:13:46Z.


@blawesom thanks. I updated the branch with a merge of main (head 5dbdd6b79) rather than a rebase. The only conflict was INPUT_MAPPING.md: I took main's action list (with TogglePerformanceOverlay) and added StickModifier after TouchRight. Your tree had the "Supported actions" line twice. The code matches yours. Fork CI 9/9 (run 39146965464).

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6253385664 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7500#issuecomment-6253385664). Originally posted by [AlxcBTW](https://github.com/AlxcBTW) on 2026-10-18T18:13:46Z. --- @blawesom thanks. I updated the branch with a merge of `main` (head `5dbdd6b79`) rather than a rebase. The only conflict was `INPUT_MAPPING.md`: I took main's action list (with `TogglePerformanceOverlay`) and added `StickModifier` after `TouchRight`. Your tree had the "Supported actions" line twice. The code matches yours. Fork CI 9/9 (run 39146965464). AI-assisted: yes (Claude Code)
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!7500
No description provided.