input: rebindable gamepad button mapping per port

Open
#315 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start with raylib-libretro.h, especially LibretroMenu and LibretroRetroJoypadButtonToGamepadButton(), then inspect the Settings > Input flow and rlconfig persistence. The implementation is done when each port has a Controller Mapping screen, mappings persist under the specified inputPort sections, and the QA A/B swap survives restart.

Written by the indexing model from the issue text.

Description

enhancement

LibretroRetroJoypadButtonToGamepadButton() (raylib-libretro.h) hard-codes the libretro→raylib gamepad button mapping. Users on non-standard controllers, or who prefer swapped A/B/X/Y layouts, have no recourse.

TASKS.md lists "Rebindable gamepad controller inputs" as unchecked. This is distinct from turbo (#291) and multitap (already done).

Suggested Implementation

  • Add a gamepadRemap[MAX_PLAYERS][RETRO_DEVICE_ID_JOYPAD_R3+1] table to LibretroMenu, defaulting to the identity mapping.
  • Replace the switch in LibretroRetroJoypadButtonToGamepadButton() with a lookup into this table (or keep it as a fallback default).
  • Expose a per-port "Controller Mapping" screen in Settings > Input that shows each libretro button and lets the user press a physical button to remap it.
  • Persist via rlconfig under [inputPort0], [inputPort1], etc.

QA

Swap A and B for port 0. A game that uses B to jump now jumps when the physical A button is pressed. Remap survives restart.

Dominant language
C
Stars
38
Forks
8
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

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.

More from RobLoach/raylib-libretro

All issues in RobLoach/raylib-libretro

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.