Skip to content

Commit

Permalink
Assume D-pad or thumbstick style axes are centered at 0
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jan 4, 2017
1 parent 26f84d7 commit 99e10ef
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/joystick/SDL_joystick.c
Expand Up @@ -125,14 +125,18 @@ SDL_JoystickAxesCenteredAtZero(SDL_Joystick *joystick)
Uint16 vendor;
Uint16 product;
} zero_centered_joysticks[] = {
{ 0x0810, 0xe501 }, /* NEXT SNES Controller */
{ 0x0e8f, 0x3013 }, /* HuiJia SNES USB adapter */
};

int i;
Uint16 vendor = SDL_JoystickGetVendor(joystick);
Uint16 product = SDL_JoystickGetProduct(joystick);

if (joystick->naxes == 2) {
/* Assume D-pad or thumbstick style axes are centered at 0 */
return SDL_TRUE;
}

for (i = 0; i < SDL_arraysize(zero_centered_joysticks); ++i) {
if (vendor == zero_centered_joysticks[i].vendor &&
product == zero_centered_joysticks[i].product) {
Expand Down

0 comments on commit 99e10ef

Please sign in to comment.