From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winebus.sys/bus_sdl.c | 12 ++++++------ dlls/winebus.sys/bus_udev.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/dlls/winebus.sys/bus_sdl.c b/dlls/winebus.sys/bus_sdl.c index 3a12183534a..bc7904059ed 100644 --- a/dlls/winebus.sys/bus_sdl.c +++ b/dlls/winebus.sys/bus_sdl.c @@ -891,18 +891,18 @@ static BOOL set_report_from_controller_event(struct sdl_device *impl, SDL_Event case SDL_CONTROLLER_BUTTON_LEFTSTICK: button = 8; break; case SDL_CONTROLLER_BUTTON_RIGHTSTICK: button = 9; break; case SDL_CONTROLLER_BUTTON_DPAD_UP: button = 10; break; - case SDL_CONTROLLER_BUTTON_DPAD_DOWN: button = 11; break; - case SDL_CONTROLLER_BUTTON_DPAD_LEFT: button = 12; break; - case SDL_CONTROLLER_BUTTON_DPAD_RIGHT: button = 13; break; + case SDL_CONTROLLER_BUTTON_DPAD_DOWN: button = 12; break; + case SDL_CONTROLLER_BUTTON_DPAD_LEFT: button = 13; break; + case SDL_CONTROLLER_BUTTON_DPAD_RIGHT: button = 11; break; case SDL_CONTROLLER_BUTTON_GUIDE: button = 16; break; default: button = -1; break; }
if (button == -1) break; if (button == 10) hid_device_move_hatswitch(iface, 0, 0, ie->state ? -1 : +1); - if (button == 11) hid_device_move_hatswitch(iface, 0, 0, ie->state ? +1 : -1); - if (button == 12) hid_device_move_hatswitch(iface, 0, ie->state ? -1 : +1, 0); - if (button == 13) hid_device_move_hatswitch(iface, 0, ie->state ? +1 : -1, 0); + if (button == 12) hid_device_move_hatswitch(iface, 0, 0, ie->state ? +1 : -1); + if (button == 13) hid_device_move_hatswitch(iface, 0, ie->state ? -1 : +1, 0); + if (button == 11) hid_device_move_hatswitch(iface, 0, ie->state ? +1 : -1, 0); hid_device_set_button(iface, button, ie->state); bus_event_queue_input_report(&event_queue, iface, state->report_buf, state->report_len); break; diff --git a/dlls/winebus.sys/bus_udev.c b/dlls/winebus.sys/bus_udev.c index 5c108f59c4c..b7e8ba946ac 100644 --- a/dlls/winebus.sys/bus_udev.c +++ b/dlls/winebus.sys/bus_udev.c @@ -533,7 +533,7 @@ static void set_abs_axis_value(struct unix_device *iface, int code, int value) if (impl->is_gamepad) { hid_device_set_button(iface, 10, value < 0); - hid_device_set_button(iface, 11, value > 0); + hid_device_set_button(iface, 12, value > 0); } hid_device_set_hatswitch_y(iface, code - 1, value); } @@ -542,8 +542,8 @@ static void set_abs_axis_value(struct unix_device *iface, int code, int value) if (!(code = impl->hat_map[code - ABS_HAT0X])) return; if (impl->is_gamepad) { - hid_device_set_button(iface, 12, value < 0); - hid_device_set_button(iface, 13, value > 0); + hid_device_set_button(iface, 13, value < 0); + hid_device_set_button(iface, 11, value > 0); } hid_device_set_hatswitch_x(iface, code - 1, value); } @@ -665,9 +665,9 @@ static BOOL set_report_from_event(struct unix_device *iface, struct input_event if (impl->is_gamepad && !impl->hat_count) { if (button == 11) hid_device_set_hatswitch_y(iface, 0, -1); - if (button == 12) hid_device_set_hatswitch_y(iface, 0, +1); - if (button == 13) hid_device_set_hatswitch_x(iface, 0, -1); - if (button == 14) hid_device_set_hatswitch_x(iface, 0, +1); + if (button == 13) hid_device_set_hatswitch_y(iface, 0, +1); + if (button == 14) hid_device_set_hatswitch_x(iface, 0, -1); + if (button == 12) hid_device_set_hatswitch_x(iface, 0, +1); } hid_device_set_button(iface, button - 1, ie->value); return FALSE;
Alex Henrie (@alexhenrie) commented about dlls/winebus.sys/bus_sdl.c:
case SDL_CONTROLLER_BUTTON_LEFTSTICK: button = 8; break; case SDL_CONTROLLER_BUTTON_RIGHTSTICK: button = 9; break; case SDL_CONTROLLER_BUTTON_DPAD_UP: button = 10; break;
case SDL_CONTROLLER_BUTTON_DPAD_DOWN: button = 11; break;
case SDL_CONTROLLER_BUTTON_DPAD_LEFT: button = 12; break;
case SDL_CONTROLLER_BUTTON_DPAD_RIGHT: button = 13; break;
case SDL_CONTROLLER_BUTTON_DPAD_DOWN: button = 12; break;
case SDL_CONTROLLER_BUTTON_DPAD_LEFT: button = 13; break;
case SDL_CONTROLLER_BUTTON_DPAD_RIGHT: button = 11; break;
Should we keep these sorted by number? I suppose it doesn't really matter, it would just make a little more sense in my head.
On Tue Sep 9 14:24:54 2025 +0000, Alex Henrie wrote:
Should we keep these sorted by number? I suppose it doesn't really matter, it would just make a little more sense in my head.
Well, I asked myself the question and it doesn't really matter but I decided that SDL_CONTROLLER_BUTTON_GUIDE was already mapped out of order (sort of), and that keeping the SDL names in order makes it easier to read.
For context, this change is necessary because [SDL2](https://github.com/libsdl-org/SDL/blob/release-2.32.10/src/joystick/SDL_game...) and [SDL3](https://github.com/libsdl-org/SDL/blob/release-3.2.22/src/joystick/SDL_gamep... WGI backend expect these exact values.
This merge request was approved by Alex Henrie.