Skip to content

feat: Visual Xbox gamepad mapper for keyboards (PES style) - #1354

Open
Hkeoke wants to merge 4 commits into
sezanzeb:mainfrom
Hkeoke:feature/xbox-gamepad-visual-mapper
Open

Hkeoke wants to merge 4 commits into
sezanzeb:mainfrom
Hkeoke:feature/xbox-gamepad-visual-mapper

Conversation

@Hkeoke

@Hkeoke Hkeoke commented Sep 4, 2026

Copy link
Copy Markdown

Summary

  • Adds an interactive, visual Xbox 360 gamepad mapper with PES-style layout for keyboards.
  • Supports button-to-axis analog mapping (WASD / D-Pad / Sticks / Triggers).
  • Adds option to deactivate unmapped keyboard keys while gamepad emulation is active.
  • Integrated natively into GTK3 stack with clean theme styling.

@Hkeoke

Hkeoke commented Sep 4, 2026

Copy link
Copy Markdown
Author
Screenshot_2026-09-04_17-38-55

@Hkeoke
Hkeoke force-pushed the feature/xbox-gamepad-visual-mapper branch from fd74e8f to 0004d93 Compare September 6, 2026 15:50
@Hkeoke

Hkeoke commented Sep 6, 2026

Copy link
Copy Markdown
Author

Related Issues & Features Solved

For context and review, this PR directly resolves several long-standing community feature requests and issues regarding keyboard-to-gamepad emulation:

  • Fixes How to bind keyboard keys as gamepad joystick axis? #875 (How to bind keyboard keys as gamepad joystick axis?):
    Enables mapping discrete keys (e.g. WASD) to Left/Right analog stick axes (ABS_X, ABS_Y, ABS_RX, ABS_RY) with clean recentering to neutral upon key release.
  • Fixes can't make analog controller using key button on keyboard #1249 (Can't make analog controller using key button on keyboard):
    Implements the btn2abs event pipeline handler, allowing keyboard buttons (EV_KEY) to drive virtual gamepad axes (EV_ABS).
  • Fixes Cannot map keys to L2 or R2 #1267 (Cannot map keys to L2 or R2):
    Allows mapping keyboard keys to analog trigger axes (LT as ABS_Z, RT as ABS_RZ) with proper return to 0 upon release.
  • Fixes Map keyboard keys to D-Pad #1244 (Map keyboard keys to D-Pad):
    Supports mapping keys to D-Pad directions (both as Hat axes ABS_HAT0X/ABS_HAT0Y and gamepad buttons) with proper release handling.
  • Addresses BTN_TL2 & BTN_TR2 work not in GTA V. #1281 (BTN_TL2 & BTN_TR2 work not in GTA V):
    Properly emits standard analog trigger events (ABS_Z/ABS_RZ) expected by games running under Steam Proton / Wine.
  • Addresses Mapping templates #95 (Mapping templates):
    Provides an intuitive visual gamepad interface (PES-style) for quickly setting up keyboard-to-gamepad profiles without needing to configure raw codes manually.

@sezanzeb sezanzeb left a comment •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the editor looks really cool, but I'm reluctant to merge this, because a simpler first solution would be to add a new macro function, as mentioned in my comment #875 (comment)

This pr is also missing tests, and writing tests for an isolated small macro function will be much, much easier.


Once that macro function exists, there could be a menu to load one of a selection of default-presets (like one that maps wasd to the joystick, q and e to shoulder buttons, etc.), which can the be more easily adjusted by users without building a preset from scratch. This would also be easier on the codebase, I think. Loading some defaults into the preset json would be rather easy to test and implement.


If alternative editor layouts are a thing, I'd not do it as a separate tab, but rather some option inside of the editor tab. Maybe something below the autoload toggle, an "Editor" dropdown that lets one switch between "Classic", "XBox Gamepad" and potentially others.

I'd really like a qt rewrite of the gui instead of large new features to the existing gui though. And first go with some lower hanging fruit fixes to the linked issues.

Comment on lines +87 to +90
103: "🡹 ARRIBA",
105: "🡸 IZQUIERDA",
106: "🡺 DERECHA",
108: "🡻 ABAJO",

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

English in the code please. Translations via translation files

local_path = os.path.abspath("data/xbox_controller.svg")
if os.path.exists(local_path):
return local_path
ws_path = "/home/vic/PROYECTOS/keyboard_as_xbox/input-remapper/data/xbox_controller.svg"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hardcoded path will break on other peoples instalations

Comment thread data/xbox_controller.svg

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the source of this svg? There is https://vectorified.com/download-image#xbox-360-controller-vector-8.png, wihch has a CC license.

Comment thread DEBIAN/control
@@ -1,5 +1,5 @@
Package: input-remapper
Version: 2.2.1
Version: 2.2.2

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No version bump yet please

Comment thread data/xbox_controller.jpg

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file used?

@sezanzeb

Copy link
Copy Markdown
Owner

Started working on macros: #1370

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants