Repository navigation
feat: mapping wizard for controllers without a known profile - #121
Merged
Merged
Conversation
Raw joystick buttons, hats and axes from SDL drive a Core wizard (neutral calibration, deadzone, inverted axes, redo, timeout, safe cancel, test mode) that produces a versioned JSON profile. Profiles are validated on read (size, depth, known fields, ranges), saved atomically with a backup, applied by device GUID or VID/PID after restart, and can be exported/imported. Replacing an existing profile always asks first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nextestudios
force-pushed
the
feature/79-mapping-wizard
branch
from
September 27, 2026 03:13
ad0896a to
7f8b6f0
Compare
This was referenced Sep 27, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Joysticks that SDL doesn't recognize as gamepads were detected but couldn't drive the UI. They can now be mapped with a wizard that the device itself drives, with a keyboard fallback.
IInputSink.OnRawInput, a default interface method so the probe still compiles), plusGetRawStatefor neutral calibration.Input/Mapping):ControllerMappingWizardstate machine. Steps: neutral → up/down/left/right → confirm/back (follows "Confirm with") → optional buttons → test.ControllerProfileTranslator: calibrated neutral, hysteresis, hat diagonals ignored.ControllerProfileSerializer: versioned JSON (format+schemaVersion). This is the security boundary:IControllerProfileStore/JsonControllerProfileStorekeeps one file per device GUID (or VID/PID) under<data>\controllers. Writes are atomic (temp file, flush, move) and keep a.bak. Invalid files are skipped and reported. Also export to a folder and import from a folder.InputHostapplies saved profiles through the translator into the normalInputRouterpath.ModalViewshows the wizard.input-and-focus.md,controller-compatibility.md, TESTING.md, test plan and ADR 0002 note.Tested in CI vs. manual
CI (unit tests, simulated raw events only):
ControllerMappingWizardTests: full hat and button mapping, hold-release per step, refused reused input, skipping with Back, test-mode translation, axis neutral/deadzone calibration with an inverted axis and a trigger at rest, redo, timeout, and the translator's hysteresis and hat diagonals.ControllerProfileSerializerTests(security boundary): round trip, malformed or unexpected payloads (unknown/duplicate field, newer schema, missing required control, duplicate input, numeric enum, out-of-range values, bad GUID, excessive depth), and an endless stream that is cut off at the limit.ControllerMappingJourneyTests: a joystick mapped by itself, saved and used after a restart (a new store on the same folder); an existing profile kept on cancel and on a cancelled replace, then replaced with a.bak; a tampered import refused; a valid export imported elsewhere.Not verified: real hardware. No generic USB joystick was available, so SDL's raw events on Windows, real hats and axes, and restart with a physical device are unverified. The checklist is in
docs/TESTING.md("Joystick sem perfil") and the matrix row indocs/controller-compatibility.mdis still "não testado". For that reason this PR usesRefsrather than closing the issue.Follow-up (not in this PR): a pad with only a D-pad and two buttons can't open Actions or Menu unless those optional steps are mapped. The wizard puts them first among the optional steps and the guide recommends mapping them.
Refs #79
🤖 Generated with Claude Code