Skip to content

An option to use XInput controllers under DirectInput to allow more than 4 XInput controllers. #19173

Description

@ProbDenis

Godot version:
Any

OS/device including version:
Windows

Issue description:
I'm developing a game that supports up to 8 players on a shared screen. One of our testers tried to use 8 XBox360 controllers, but could only use 4 because of XInput limitations. This limit could be lifted if there was an option to use XInput controllers under DirectInput. He also suggested a possible solution, so let me quote:

https://github.com/godotengine/godot/blob/master/platform/windows/joypad.h

It stores a separate array for XInput controllers and directinput controllers.
#define XUSER_MAX_COUNT 4
...
xinput_gamepad x_joypads[XUSER_MAX_COUNT];
...

When setting up the directinput joypads it skips the XInput ones since they are handled separately via the XInput API:
BOOL CALLBACK JoypadWindows::enumCallback(const DIDEVICEINSTANCE *p_instance, void *p_context) {

JoypadWindows *self = (JoypadWindows *)p_context;
if (self->is_xinput_device(&p_instance->guidProduct)) {
return DIENUM_CONTINUE;
}
self->setup_dinput_joypad(p_instance);
return DIENUM_CONTINUE;
}

So if they could add a setting to disable XInput and at the same time remove the filtering shown above, XInput gamepads could work under direct input.

They seem to be borrowing some gamepad configs from SDL. The latest configs contain entries for XInput controllers under DirectInput so if they're using that it should simply work.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions