Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions doc/classes/Input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,6 @@
[code]product_id[/code]: The USB product ID of the device.
[code]serial_number[/code]: The serial number of the device. This key won't be present if the serial number is unavailable.
[code]steam_input_index[/code]: The Steam Input gamepad index, if the device is not a Steam Input device this key won't be present.
On Windows, the dictionary can have an additional field:
[code]xinput_index[/code]: The index of the controller in the XInput system. This key won't be present for devices not handled by XInput.
[b]Note:[/b] The returned dictionary is always empty on Android, iOS, visionOS, and Web.
</description>
</method>
Expand Down
4 changes: 1 addition & 3 deletions drivers/sdl/SDL_build_config_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,11 @@
#define HAVE_LIBC 1
#define HAVE_DINPUT_H 1
#define HAVE_XINPUT_H 1
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0A00 /* Windows 10 SDK */
#define HAVE_WINDOWS_GAMING_INPUT_H 1
#define SDL_JOYSTICK_WGI 1
#endif
#define SDL_JOYSTICK_DINPUT 1
#define SDL_JOYSTICK_HIDAPI 1
#define SDL_JOYSTICK_RAWINPUT 1
//#define SDL_JOYSTICK_WGI 1 // This driver causes compilation issues.
#define SDL_JOYSTICK_XINPUT 1
#define SDL_HAPTIC_DINPUT 1
#define SDL_THREAD_GENERIC_COND_SUFFIX 1
Expand Down
9 changes: 1 addition & 8 deletions drivers/sdl/joypad_sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ JoypadSDL::~JoypadSDL() {

Error JoypadSDL::initialize() {
SDL_SetHint(SDL_HINT_JOYSTICK_THREAD, "1");
SDL_SetHint(SDL_HINT_JOYSTICK_RAWINPUT, "1");
SDL_SetHint(SDL_HINT_NO_SIGNAL_HANDLERS, "1");
ERR_FAIL_COND_V_MSG(!SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_GAMEPAD), FAILED, SDL_GetError());

Expand Down Expand Up @@ -179,14 +180,6 @@ void JoypadSDL::process_events() {
joypad_info["steam_input_index"] = itos(steam_handle);
}

#ifdef WINDOWS_ENABLED
const int player_index = SDL_GetJoystickPlayerIndex(joy);
if (player_index >= 0 && joy_guid.data[14] == 'x') { // See also "SDL_IsJoystickXInput" in "thirdparty/sdl/joystick/SDL_joystick.c".
// For XInput controllers SDL_GetJoystickPlayerIndex returns the XInput user index.
joypad_info["xinput_index"] = itos(player_index);
}
#endif

Input::get_singleton()->joy_connection_changed(
joy_id,
true,
Expand Down