Skip to content

feat(input): add native SDL input configuration with ImGui - #674

Closed
clevetdev wants to merge 10 commits into
boykopovar:mainfrom
clevetdev:feat/native-input-mapping
Closed

clevetdev wants to merge 10 commits into
boykopovar:mainfrom
clevetdev:feat/native-input-mapping

Conversation

@clevetdev

@clevetdev clevetdev commented Oct 5, 2026 •

Copy link
Copy Markdown

What

Add a native Dear ImGui input editor for #392, available as anyps5-input-config [--config path] and a separate F10 window during gameplay. The editor supports keyboard/mouse alternate bindings, GUID-scoped PS5 button/axis profiles with inversion and analog previews, and a confirmed physical SDL mapping assistant for unrecognized joysticks.

Keep existing keyboard INI behavior; add NONE for disabled bindings and numeric SDL scancodes for key names that cannot round-trip through the comment syntax. Save each tab atomically, apply saved mappings live, and neutralize game input while the editor is open. Use the SDL software renderer independently of the game's Vulkan renderer. Package the tool for Windows and Linux.

This implements hardBSDk's native preference. I acknowledge the maintainer's proposed GitHub Pages direction in the issue; this contribution deliberately provides a native alternative. The shared sampler preserves the non-PlayStation Back/View touchpad behavior requested by hamb3r in #593, including a center contact when no real finger is available. Explicit TouchPad remapping or NONE overrides the default fallback; PS4/PS5 Share/Create stays separate.

Tested

  • Windows, official WinLibs GCC 15.2.0/UCRT r7: full project build and patched-library target libs succeed.
  • Five input/configuration/editor/packaging tests pass. SDL virtual devices cover buttons, hats, analog and digital triggers/sticks, inversion, disabled controls, GUID round trips, malformed files, atomic write failure, live reload, and reconnect.
  • Dummy-video UI tests exercise capture cancellation, alternate key saves, PS5 button capture, explicit SDL physical-input confirmation, saving, resize, and close/reopen. Visually inspected rendered frames of all three tabs.
  • Full Windows suite at upstream base 961acb0c: 288/290 pass. agc_driver_f32_output_modifier and agc_driver_scalar_sop1 fail on the RTX 5070 Ti; both fail identically on a separate, unmodified checkout of 961acb0c. The newly registered packaging test also passes.
  • No physical controller, commercial title, or homebrew session was tested. Runtime integration was exercised through the real PadInput class with virtual SDL devices and a test publication sink. Linux and Windows full builds, patched libraries and test suites (repeat-until-fail:3) pass on commit 4173f317 in the fork CI run. Upstream PR workflows require maintainer approval for this first-time contribution.

Keyboard and mouse bindings
PS5 command profiles
SDL physical mapping assistant

Integration with open pull requests

Rebased onto upstream 9cafa33f after #593 landed. The prior audit compared all 130 open PRs and inspected the five sharing changed files. No merge of an unrelated PR is required first.

  • feat(pad): map Xbox View button to PS5 touchpad #593 is now merged: its PadInput.cpp integration conflict is resolved. Preserve its Back/View button and synthetic touch contact in InputConfig::SampleController, without an unconditional second fallback that would ignore explicit profiles. Virtual generic/PS4/PS5 tests cover defaults, reassignment, NONE, release, real finger preservation, and runtime publication/suspension. Original View/contact behavior and integration feedback are credited to hamb3r.
  • fix(jpegenc): honor chroma sampling and encode true grayscale JPEGs #485: moved the ImGui submodule declaration away from its insertion point. Git's merge simulation is now clean and retains both submodules.
  • feat(release): publish portable archives and checksums #600: separated root input-test registration from its CMake addition. Two textual conflicts remain in release workflow/packager code. Integration must retain both asset lists, both CTest entries, add the editor to its new portable archive file list, preserve the Linux executable bit, and retain checksums. Its release-test fixtures will need an editor binary; our input-test fixtures must use its new repository-root and compiler-metadata inputs. A scratch integration of both packagers passed Windows/Linux portable archive, standalone asset, executable permission and checksum checks; this is not part of this branch.
  • fix: address decoder memory leaks, ELF parser safety, and python tool… #615: clean merge simulation; the merged Windows runtime-directory override passes our Windows/Linux input packaging tests.
  • refactor(libs): drop replacements of modules that titles ship themselves #676: clean merge simulation; removal of the Cohtml alias requirement passes our Windows/Linux input packaging tests. Do not restore that requirement when rebasing after it lands.

Local validation after the rebase: full Windows build and patched libs target succeed; six input-related CTest cases passed three consecutive times with official Windows GCC 15.2.0. Full CTest is 321/323; the same two RTX 5070 Ti GPU failures retain the exact previously reproduced mismatches (0x7f7fffff vs 0x7f800000, 0x00007fff vs 0xd4cbd76d). Linux/Windows full-build, patched libraries and test run passed on both platforms for 8986feef (323 tests, repeated three times). After integrating the merged #593, Windows libSceVideoOut builds and eight input/pad tests pass three consecutive times. Full CI passes on rebased commit 318fa88d: Linux and Windows full builds, patched libraries and all 342 tests pass, repeated three times.

Checklist

  • Based on current main; no other open PR implements this native editor (integration with overlapping PRs documented above)
  • One topic per PR; follow-ups go in a new PR
  • No new comments in code except permitted existing comments
  • Unimplemented paths are not replaced with silent stubs
  • No investigation notes, reports, logs, or screenshots added to the repository
  • New third-party code is a pinned submodule built from source (Dear ImGui v1.92.5)
  • Generic behavior, not specific to one title
  • Depends on: none
  • AI-assisted: yes, implemented and reviewed with OpenAI Codex

Extract the existing INI reader into a standalone input library while preserving default bindings, alternate inputs, BOM handling, and explicit-path errors. Add NONE to represent disabled actions and atomic replacement that leaves previous files intact on write failures.

Add GUID-scoped PS5 button/axis profiles and a validated SDL physical mapping database. Keep physical recognition separate from command reassignment and retain analog trigger/stick values.

Validation: configured with the documented WinLibs GCC 15.2.0 toolchain; input_configuration passed on Windows, including INI round trips, duplicates, invalid sources, disabled actions, and failed atomic replacement.
Verify physical button and hat recognition, analog stick and trigger precision, axis inversion, disabled controls, PS5 button reassignment, GUID profile serialization, malformed mappings, and reconnect behavior using SDL virtual joysticks.

Filter mapping records by their declared platform before applying them so a Linux record cannot replace a Windows record for the same GUID.

Validation: input_controllers passed on Windows with the documented WinLibs GCC toolchain.
Build a standalone SDL2 software-rendered editor with keyboard/mouse alternate bindings, GUID-scoped PS5 command reassignment, analog previews, and a physical SDL mapping assistant. Require explicit confirmation for captured joystick inputs and retain mapping drafts across device changes.

Save each tab independently with atomic replacement; preserve unsaved edits in other tabs and prompt before discarding them on close. Add the pinned Dear ImGui v1.92.5 submodule and the anyps5-input-config executable with --config support.

Validation: standalone tool builds with official WinLibs; configuration/controller tests and dummy-video editor open, resize, close, and reopen tests pass. Rendered the keyboard tab for visual inspection.
Open the shared editor with F10 on the presentation event loop without touching Vulkan rendering. Neutralize pad input, reset keyboard/mouse state, and release relative mouse mode while editing; closing the editor only closes its own window.

Reload saved bindings and GUID profiles live, applying physical SDL mappings before reopening the active controller. Preserve controller sensors, touch input, haptics, and output handling. Link private SDL and editor archives before driver imports to avoid mixed SDL exports and duplicate Windows symbols.

Validation: full Windows build and patched libraries completed with official WinLibs. Virtual runtime tests cover held-key clearing, neutral controller input during editing, live keyboard/profile/database changes, and disconnect/reconnect behavior.
Consume captured keyboard/mouse events before ImGui can activate unrelated controls. Treat Cancel capture as an editor action rather than a new mouse binding, and select the first recognized controller when opening the editor.

Extend dummy-video UI coverage to capture cancellation, alternate keyboard saves, PS5 button-source capture, explicit physical-input confirmation, SDL mapping saves, resizing, and independent window close/reopen. Provide optional rendered screenshots of all three tabs for visual verification.

Validation: all five input/editor/packaging tests pass on Windows. Full build and patched libraries succeed; the two full-suite GPU failures were reproduced unchanged on upstream main 961acb0 using the same RTX 5070 Ti.
Include anyps5-input-config in Windows/Linux PRX archives and publish a versioned standalone executable. Require the editor binary during packaging and release asset checks so distributions cannot silently omit the tool.

Document standalone --config use, in-game F10 access, per-tab saving, GUID controller profiles, SDL physical mappings, disabled bindings, and live application of changes. Add packaging tests for both platforms, archive contents, standalone assets, and missing editor binaries.

Validation: input_release_packaging passed; full Windows project and patched library builds succeeded with the supported WinLibs toolchain. All five input tests pass.
Use numeric SDL scancode sources for key names containing INI comment markers. Capturing semicolon or non-US hash must not produce a file that reloads as an invalid, truncated binding. Keep existing KEY names and inline comment behavior unchanged.

Validate numeric sources and round-trip every named SDL scancode through the shared serializer and file reader. Also verify that NONE clears earlier alternate bindings for the same action.

Validation: full patched-library target and standalone editor build succeed; all five input/editor/packaging tests pass on Windows.
Accept physical buttons and cardinal hats for trigger-axis targets. Older joysticks that expose digital triggers must be able to map them to SDL lefttrigger/righttrigger without requiring a physical analog axis.

Exercise confirmed digital-trigger capture in the native UI test and verify that SDL converts virtual button presses/releases to full/zero PS5 analog trigger values.

Validation: standalone and patched-library builds succeed; controller and editor tests pass with virtual SDL devices on Windows.
Carry the non-PlayStation Back/View fallback from PR boykopovar#593 into shared controller sampling so the native editor and gameplay agree. Supply a center touch contact only when no real finger is present, and preserve physical PS4/PS5 touchpad and Share/Create behavior.

Keep explicit TouchPad reassignment and NONE authoritative over the default fallback. Move finger sampling alongside the button mapping and document the effective defaults. Credit hamb3r for the integration requirement and original View/contact behavior in PR boykopovar#593.

Validate virtual generic, PS4 and PS5 controllers, synthetic contact coordinates, real finger preservation, release, reassignment, disabling, and runtime publication/suspension. All input-related CTest cases passed locally with official Windows GCC 15.2.0; controller regressions pass after the added real-contact coverage.
Place the ImGui submodule entry before the existing final entry so the JPEG submodule addition in PR boykopovar#485 merges independently. Register the input packaging test alongside root test initialization rather than the release-test insertion point used by PR boykopovar#600.

Preserve the existing build and packaging behavior. Reconfigured with official Windows GCC 15.2.0 and passed all six input-related CTest cases three consecutive times.
@adriadam10

Copy link
Copy Markdown
Collaborator

Thanks for the work and for documenting the overlaps. This needs a decision from the maintainers before a detailed review, so tagging them:

@boykopovar @oneandonlydean

  • Direction: in (Feature request) Add GUI for SDL controller mapping #392 the plan was a web mapping page on GitHub Pages; this PR adds a native ImGui editor instead. Do we want it in-tree?
  • New dependency: adds 3rdparty/imgui (Dear ImGui v1.92.5) as a submodule, built from source into a new anyps5_input_editor target.
  • Global change: root CMakeLists.txt flips SDL_RENDER OFF -> ON for the whole SDL build.
  • Release policy: release.yml now requires and uploads two extra assets (anyps5-input-config-<tag>[.exe]). feat(release): publish portable archives and checksums #600 is already waiting on a release-layout decision and touches the same workflow and package_release.py.

@clevetdev, independent of the decision:

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@clevetdev thank you for this editor and for the work that went into it. We're closing it because main has moved past it: keyboard and mouse editing now ships as the web configurator (#3456), main supports four controllers with deadzones and a configurable mouse stick, and F10 is now the performance overlay. A rebase would be a rewrite against the multi-controller model.

The part main still doesn't have is the per-controller (GUID) button remapping. If you'd like to bring that back, a new, small PR for just the runtime and config side, with tests, would be very welcome.

@clevetdev

clevetdev commented Oct 31, 2026 •

Copy link
Copy Markdown
Author

@oneandonlydean ty for your time and effort you've put into it, and also for the feedbacks.
Would you be able to create an issue and assign it to me so I could work on the latter part you mentioned it would be gladly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build ci .github docs needs rebase Conflicts with main, rebase needed prx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants