Skip to content

Commit

Permalink
Better patch to make it more clear what's going on
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jun 12, 2019
1 parent 3fbaa5d commit 747df96
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/joystick/linux/SDL_sysjoystick.c
Expand Up @@ -763,7 +763,7 @@ HandleHat(SDL_Joystick * stick, Uint8 hat, int axis, int value)
{SDL_HAT_LEFTDOWN, SDL_HAT_DOWN, SDL_HAT_RIGHTDOWN}
};

the_hat = &stick->hwdata->hats[stick->hwdata->hats_indices[hat]];
the_hat = &stick->hwdata->hats[hat];
if (value < 0) {
value = 0;
} else if (value == 0) {
Expand All @@ -773,7 +773,7 @@ HandleHat(SDL_Joystick * stick, Uint8 hat, int axis, int value)
}
if (value != the_hat->axis[axis]) {
the_hat->axis[axis] = value;
SDL_PrivateJoystickHat(stick, stick->hwdata->hats_indices[hat],
SDL_PrivateJoystickHat(stick, hat,
position_map[the_hat->axis[1]][the_hat->axis[0]]);
}
}
Expand Down Expand Up @@ -875,7 +875,7 @@ HandleInputEvents(SDL_Joystick * joystick)
case ABS_HAT3X:
case ABS_HAT3Y:
code -= ABS_HAT0X;
HandleHat(joystick, code / 2, code % 2, events[i].value);
HandleHat(joystick, joystick->hwdata->hats_indices[code / 2], code % 2, events[i].value);
break;
default:
if (joystick->hwdata->abs_map[code] != 0xFF) {
Expand Down

0 comments on commit 747df96

Please sign in to comment.