Repository navigation
feat(input): turn mouse speed into a smooth right-stick tilt - #4704
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
|
Windows test: head AI-assisted (Claude Code). |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
d7ca998 to
bc568a1
Compare
|
Checked on current
Merging once CI is green. |
|
Thanks @adriadam10. That's the right fix: |
What
The captured mouse (
ToggleMouse) polledSDL_GetRelativeMouseStateevery 33 ms and tilted the right stick byclamp(distance * sensitivity + 16, 64, 128): any movement tilted the stick at least halfway, the tilt depended on the poll interval, and nothing could be tuned exceptMouseSensitivity(#4009).Mouse motion is now accumulated from
SDL_MOUSEMOTIONevents and turned into a speed in counts per second, so the same hand speed gives the same tilt at any frame rate. The keyboard and mouse logic moves out ofPadInputintoPad::KeyboardMouse(libScePad/include/KeyboardMouse.hpp), which takes its time as an argument and so can be tested offline;PadInputkeeps the SDL calls.MouseMaxSpeed, shaped byMouseCurveand lifted byMouseDeadzoneOffset, so slow movement clears the game's own deadzone without the old half-tilt jump.MouseDecayMsafter the last movement.MouseSensitivity:MouseVerticalScale,MouseCurve,MouseDeadzoneOffset,MouseMaxSpeed,MouseSmoothingMs,MouseDecayMs. Invalid or repeated values stop initialization with file and line, like the existing settings.MouseSensitivitykeeps its range (above 0, at most 10) and name. At 1, 3000 counts per second is a full tilt. The old behaviour is approximated byMouseDeadzoneOffset = 0.5,MouseSmoothingMs = 0,MouseDecayMs = 33; the defaults change how the mouse feels, deliberately.SDL_HINT_MOUSE_RELATIVE_MODE_WARP=0andSDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE=0, so the pointer speed of the operating system does not apply.docs/user/INPUT_MAPPING.mdgains a "Mouse as the right stick" section and the settings table.New test
pad_keyboard_mouse(tests/KeyboardMouse.cpp,tests/PadSimulation.hpp) feeds timed events intoPad::KeyboardMouseand samples the pad state at 33, 8 and 1 ms polls: steady deflection follows the curve, the stick centers within the decay time, a flick above full speed does not extend the tail, integrated deflection agrees across poll rates, plus the key, wheel and focus-loss paths.pad_input_mappinggains parsing and rejection cases for the new settings.Tested
Not tested in a title; no game was run. Windows 11 build node (WinLibs GCC 15.2.0, Release,
BUILD_TESTING=ON): full build and the non-GPU ctest set, includingpad_input_mappingand the newpad_keyboard_mouse.tools/check_conventions.py --base origin/mainpasses.Checklist
main; no other open PR implements the same functions (feat(input): add native SDL input configuration with ImGui #674 edits bindings through an ImGui editor, feat(input): add browser-based input mapping configurator #3456 is a browser editor for the ini, feat(libSceVideoOut): capture the host cursor for guest mice and scale their deltas #4217 captures the host cursor for guest mice; none changes the analog conversion)NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt (none added).mdfiles or images added to the repository🤖 Generated with Claude Code