|
@@ -609,17 +609,18 @@ ConfigJoystick(SDL_Joystick * joystick, int fd)
|
|
|
for (i = ABS_HAT0X; i <= ABS_HAT3Y; i += 2) {
|
|
|
if (test_bit(i, absbit) || test_bit(i + 1, absbit)) {
|
|
|
struct input_absinfo absinfo;
|
|
|
+ int hat_index = (i - ABS_HAT0X) / 2;
|
|
|
|
|
|
if (ioctl(fd, EVIOCGABS(i), &absinfo) < 0) {
|
|
|
continue;
|
|
|
}
|
|
|
#ifdef DEBUG_INPUT_EVENTS
|
|
|
- printf("Joystick has hat %d\n", (i - ABS_HAT0X) / 2);
|
|
|
+ printf("Joystick has hat %d\n", hat_index);
|
|
|
printf("Values = { %d, %d, %d, %d, %d }\n",
|
|
|
absinfo.value, absinfo.minimum, absinfo.maximum,
|
|
|
absinfo.fuzz, absinfo.flat);
|
|
|
#endif /* DEBUG_INPUT_EVENTS */
|
|
|
- ++joystick->nhats;
|
|
|
+ joystick->hwdata->hats_indices[joystick->nhats++] = hat_index;
|
|
|
}
|
|
|
}
|
|
|
if (test_bit(REL_X, relbit) || test_bit(REL_Y, relbit)) {
|
|
@@ -762,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[hat];
|
|
|
+ the_hat = &stick->hwdata->hats[stick->hwdata->hats_indices[hat]];
|
|
|
if (value < 0) {
|
|
|
value = 0;
|
|
|
} else if (value == 0) {
|