Skip to content

Give each GLFW gamepad slot its own device path - #224

Merged
BenjaFriend merged 1 commit into
mainfrom
fix/xinput-gamepad-identity
Oct 25, 2026
Merged

BenjaFriend merged 1 commit into
mainfrom
fix/xinput-gamepad-identity

Conversation

@BenjaFriend

Copy link
Copy Markdown
Member

Problem

GlfwInputDeviceInterface::ConnectGamepad made the device's HardwarePath from the GLFW joystick GUID only. On Windows, GLFW gives every XInput pad the same GUID (78696e707574..., which is xinput plus a subtype, with no slot number). On every platform, two pads of the same model also have the same GUID.

InputDeviceFactory::CreateDevice returns the connected device that has the same interface, type, VID/PID and path. So the second pad got the device of the first pad:

  • both pads sent input as one InputDeviceId
  • when you disconnected one pad, the device was disconnected for both pads

Fix

Add the GLFW joystick slot to the path: glfw:<guid>:<slot>. A pad that connects again in the same slot still gets its old ID.

Testing (Windows, MSVC / VS 2022, Debug)

  • Clean build. All 96 CTest tests pass.
  • The comment-style check and clang-format pass.
  • Windowed Sandbox run with one Xbox pad: the pad connects as glfw:78696e70757401000000000000000000:0 and sends axis messages.
  • Not tested: two pads connected at the same time. Only one pad was available.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ce9wNPVavgwzJKqdHkMLQR

On Windows all XInput pads have the same GLFW GUID, and two pads of the
same model have the same GUID on any platform. The second pad got the
device of the first one, so both pads sent input as one device. Add the
joystick slot to the hardware path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ce9wNPVavgwzJKqdHkMLQR
@BenjaFriend
BenjaFriend merged commit 4267dd9 into main Oct 25, 2026
9 checks passed
@BenjaFriend
BenjaFriend deleted the fix/xinput-gamepad-identity branch October 25, 2026 18:13
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.

1 participant