Skip to content

sdl_joypad: webOS Switch Pro builtin remap via hat #0 - #19273

Merged
LibretroAdmin merged 1 commit into
libretro:masterfrom
theromis:fix/sdl-gc-dpad-bind-fallback
Jul 28, 2026
Merged

sdl_joypad: webOS Switch Pro builtin remap via hat #0#19273
LibretroAdmin merged 1 commit into
libretro:masterfrom
theromis:fix/sdl-gc-dpad-bind-fallback

Conversation

@theromis

@theromis theromis commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • webOS-only builtin Switch Pro autoconfig from a working remap:
    • D-pad: h0up/down/left/right
    • Home / menu toggle: button 11
    • − / +: 9 / 10
    • L1 / R1: 5 / 6
    • L2 / R2: 7 / 8 (buttons)
    • L3 / R3: 12 / 13
  • Minimal sdl_joypad change: expose hat 0 and read the real joystick hat (stock GC path called get_button(hat) and set num_hats = 0, so h0* binds never worked).

Test plan

  • webOS + Switch Pro works without manual remap after deleting downloaded *Switch*Pro*.cfg
  • Home opens quick menu, not D-pad Up
  • L3/R3 stick clicks work
  • Non-webOS builds unchanged

@theromis

Copy link
Copy Markdown
Contributor Author

Verified on webOS with a Nintendo Switch Pro Controller: physical D-pad now navigates the menu (previously only the left stick worked via Analog to Digital).

Root cause: sdl2 autoconfig correctly binds DPAD to buttons 11–14, but on this platform SDL_GameControllerGetButton for those IDs stays unpressed. The patch resolves the real joystick bind via SDL_GameControllerGetBindForButton and falls back to hat 0 when needed.

@theromis theromis changed the title sdl_joypad: fix GameController D-pad via joystick bind/hat sdl_joypad: fix GameController / Switch Pro D-pad via bind, hat, and mapping Jul 28, 2026
@theromis

Copy link
Copy Markdown
Contributor Author

Tested on webOS 6 with a Nintendo Switch Pro Controller: left stick still navigates the menu, and D-pad up/down/left/right now works as well (with the follow-up commit that rebinds missing-hat DPAD mappings and adds the Pro VID/PID autoconfig).

@theromis

Copy link
Copy Markdown
Contributor Author

Follow-up: removed the forced dpup:b11… rebind and the raw button 11–14 probe. On Switch Pro those indices are often Home/misc, which made Guide act as D-pad Up and could break Right. Driver now prefers a real hat / existing bind only.

@theromis
theromis force-pushed the fix/sdl-gc-dpad-bind-fallback branch from a4f43fd to afb5f6c Compare July 28, 2026 05:07
@theromis theromis changed the title sdl_joypad: fix GameController / Switch Pro D-pad via bind, hat, and mapping sdl_joypad: fix Switch Pro D-pad on webOS via hat #0 Jul 28, 2026
Add a webOS-only Switch Pro autoconfig from a working remap (D-pad h0*,
Home=11, −/+=9/10, L1/R1=5/6, L2/R2=7/8, L3/R3=12/13). Expose joystick
hat 0 on GameController pads so those h0* binds poll correctly.
@theromis
theromis force-pushed the fix/sdl-gc-dpad-bind-fallback branch from afb5f6c to 0e45270 Compare July 28, 2026 05:22
@theromis theromis changed the title sdl_joypad: fix Switch Pro D-pad on webOS via hat #0 sdl_joypad: webOS Switch Pro builtin remap via hat #0 Jul 28, 2026
@LibretroAdmin
LibretroAdmin merged commit 1e0442c into libretro:master Jul 28, 2026
44 checks passed
@theromis

Copy link
Copy Markdown
Contributor Author

@LibretroAdmin may I ask, what happened with joysticks/sdl why all buttons has new codes?

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