You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(libScePad): analog keyboard input with a stick modifier and stick and trigger ramps - #7500
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:
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.
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.
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 a210a8e (the PR head 438e1ba 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.
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.
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.
@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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
StickModifieraction (no built-in binding) andStickModifierScale(0.05 to 1, default 0.5). While a key or mouse button bound toStickModifieris 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.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::Advancenow also returns true while an axis is still moving, soPadInput::Updatepublishes the new state without an input event.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.mddocuments the action, the three settings and a section "Analog keyboard input".Not included: a default key for
StickModifier(Left AltisR1in the built-in bindings), wheel-driven trigger levels, and any default-binding change.Tested
-R '^(pad_|guest_pad|video_out_mouse|mouse_input|keyboard_input)'): 9 of 9 passed, among thempad_keyboard_mouseandpad_input_mapping. Not run on Windows.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, andRelease()centres it at once.ramp keeps advance reporting:Advancereturns 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 aStickModifier.python3 tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.pylists feat(pad): add a Shake input that swings the reported motion while held #6353 (a newInputControlvalue next toTouchRight, theactionsarray and theComposeswitch: textual overlap, no shared function; a rebase of whichever merges second) and feat(agc,videoout): show an optional performance overlay with F10 #6012 (the list of actions indocs/user/INPUT_MAPPING.md), and could not compare feat(input): add native SDL input configuration with ImGui #674, feat(agc,videoout): save the displayed frame as a PNG with a screenshot key #4891 and Macos port #7201 (InputMapping.cpp,InputMapping.hpp, docs). Based on cdb7ed0.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)