mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-19 01:38:12 +00:00
Assume D-pad or thumbstick style axes are centered at 0
This commit is contained in:
@@ -125,7 +125,6 @@ SDL_JoystickAxesCenteredAtZero(SDL_Joystick *joystick)
|
|||||||
Uint16 vendor;
|
Uint16 vendor;
|
||||||
Uint16 product;
|
Uint16 product;
|
||||||
} zero_centered_joysticks[] = {
|
} zero_centered_joysticks[] = {
|
||||||
{ 0x0810, 0xe501 }, /* NEXT SNES Controller */
|
|
||||||
{ 0x0e8f, 0x3013 }, /* HuiJia SNES USB adapter */
|
{ 0x0e8f, 0x3013 }, /* HuiJia SNES USB adapter */
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -133,6 +132,11 @@ SDL_JoystickAxesCenteredAtZero(SDL_Joystick *joystick)
|
|||||||
Uint16 vendor = SDL_JoystickGetVendor(joystick);
|
Uint16 vendor = SDL_JoystickGetVendor(joystick);
|
||||||
Uint16 product = SDL_JoystickGetProduct(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) {
|
for (i = 0; i < SDL_arraysize(zero_centered_joysticks); ++i) {
|
||||||
if (vendor == zero_centered_joysticks[i].vendor &&
|
if (vendor == zero_centered_joysticks[i].vendor &&
|
||||||
product == zero_centered_joysticks[i].product) {
|
product == zero_centered_joysticks[i].product) {
|
||||||
|
Reference in New Issue
Block a user