Skip to content

Commit

Permalink
input_retro: always use hat1 for d-pad in joystick configure
Browse files Browse the repository at this point in the history
Joystick device's configure used hat1 + n, n being index of currently
configured joystick, for d-pad. Because of this in Batocera.linux
running on rk3399 arm board d-pad didn't work except for the first
player when using two Logitech gamepads. Interestingly this did not
happen on x86 linux desktop where same gamepads worked correctly without
this patch and I have no idea why.

Fixed by using hat1 for all configured joystick devices. D-pad mapping
still works correctly for two gamepads on x86 linux desktop too.
  • Loading branch information
nuumio authored and sonninnos committed Sep 20, 2023
1 parent b6d4105 commit 3d612fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/osd/modules/input/input_retro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1228,28 +1228,28 @@ class retro_joystick_device : public event_based_device<KeyPressEventArgs>, prot
switch_ids[SWITCH_DPAD_UP] = device.add_item(
Buttons_Name[RETROPAD_PAD_UP],
std::string_view(),
static_cast<input_item_id>(ITEM_ID_HAT1UP + joy_count*4),
ITEM_ID_HAT1UP,
generic_button_get_state<std::uint8_t>,
&joystate[joy_count].button[RETROPAD_PAD_UP]);

switch_ids[SWITCH_DPAD_DOWN] = device.add_item(
Buttons_Name[RETROPAD_PAD_DOWN],
std::string_view(),
static_cast<input_item_id>(ITEM_ID_HAT1DOWN + joy_count*4),
ITEM_ID_HAT1DOWN,
generic_button_get_state<std::uint8_t>,
&joystate[joy_count].button[RETROPAD_PAD_DOWN]);

switch_ids[SWITCH_DPAD_LEFT] = device.add_item(
Buttons_Name[RETROPAD_PAD_LEFT],
std::string_view(),
static_cast<input_item_id>(ITEM_ID_HAT1LEFT + joy_count*4),
ITEM_ID_HAT1LEFT,
generic_button_get_state<std::uint8_t>,
&joystate[joy_count].button[RETROPAD_PAD_LEFT]);

switch_ids[SWITCH_DPAD_RIGHT] = device.add_item(
Buttons_Name[RETROPAD_PAD_RIGHT],
std::string_view(),
static_cast<input_item_id>(ITEM_ID_HAT1RIGHT + joy_count*4),
ITEM_ID_HAT1RIGHT,
generic_button_get_state<std::uint8_t>,
&joystate[joy_count].button[RETROPAD_PAD_RIGHT]);

Expand Down

0 comments on commit 3d612fb

Please sign in to comment.