Better patch to make it more clear what's going on
authorSam Lantinga <slouken@libsdl.org>
Wed, 12 Jun 2019 10:38:49 -0700
changeset 12848a9a7c1e48f0b
parent 12847 baae9331abc0
child 12849 5cd9ce1d28f2
Better patch to make it more clear what's going on
src/joystick/linux/SDL_sysjoystick.c
     1.1 --- a/src/joystick/linux/SDL_sysjoystick.c	Wed Jun 12 10:35:47 2019 -0700
     1.2 +++ b/src/joystick/linux/SDL_sysjoystick.c	Wed Jun 12 10:38:49 2019 -0700
     1.3 @@ -763,7 +763,7 @@
     1.4          {SDL_HAT_LEFTDOWN, SDL_HAT_DOWN, SDL_HAT_RIGHTDOWN}
     1.5      };
     1.6  
     1.7 -    the_hat = &stick->hwdata->hats[stick->hwdata->hats_indices[hat]];
     1.8 +    the_hat = &stick->hwdata->hats[hat];
     1.9      if (value < 0) {
    1.10          value = 0;
    1.11      } else if (value == 0) {
    1.12 @@ -773,7 +773,7 @@
    1.13      }
    1.14      if (value != the_hat->axis[axis]) {
    1.15          the_hat->axis[axis] = value;
    1.16 -        SDL_PrivateJoystickHat(stick, stick->hwdata->hats_indices[hat],
    1.17 +        SDL_PrivateJoystickHat(stick, hat,
    1.18                                 position_map[the_hat->axis[1]][the_hat->axis[0]]);
    1.19      }
    1.20  }
    1.21 @@ -875,7 +875,7 @@
    1.22                  case ABS_HAT3X:
    1.23                  case ABS_HAT3Y:
    1.24                      code -= ABS_HAT0X;
    1.25 -                    HandleHat(joystick, code / 2, code % 2, events[i].value);
    1.26 +                    HandleHat(joystick, joystick->hwdata->hats_indices[code / 2], code % 2, events[i].value);
    1.27                      break;
    1.28                  default:
    1.29                      if (joystick->hwdata->abs_map[code] != 0xFF) {