libretro / libretro/RetroArch

[Feature Request] SDL3: left/right half of touchpad as separate buttons

Open
#19,369 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
C
Stars
14.1k
Forks
2.2k
Avg merge
7h 35m
Merged PRs (30d)
51

Description

The touchpad on DualShock 4 / DualSense has left and right regions as separate buttons in other applications, but SDL2 and 3 on RA currently sees one button for the whole pad.
SDL3 reports 2 fingers and their position, so we can use that to determine which half of the surface is being pressed, and use those as bindable buttons to mimic behavior seen elsewhere.
I'm only interested in 2 buttons, but we could also use a 4-button grid or more, probably a harder implementation.
The existing SDL_GAMEPAD_BUTTON_TOUCHPAD can't coexist, this can be disabled with the same toggle that enables the feature.
The tricky part is adding new buttons on top of the SDL_GAMEPAD_BUTTON_COUNT, if that increases then everyone's mappings will change.
I think this API is supported in SDL2 as well as SDL3, maybe other drivers (mfi?) Do we want to support this more generically?

I have a proof of concept working in SDL3, but I'd like to see a discussion about this before proceeding.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing RetroArch's SDL2/SDL3 gamepad input handling and the existing SDL_GAMEPAD_BUTTON_TOUCHPAD mapping. Check the SDL3 two-finger position data and the SDL_GAMEPAD_BUTTON_COUNT compatibility concern, then determine how the toggle should switch between one touchpad button and two bindable regions. Done means the behavior and cross-version scope are resolved without changing existing mappings unexpectedly.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.