mirror of https://github.com/encounter/SDL.git
hidapi: Also parse data[12] with dpad values on the xb1s controller
This commit is contained in:
parent
1ef45c1801
commit
3d92e8c742
|
@ -840,7 +840,7 @@ HIDAPI_DriverXbox360_HandleStatePacket(SDL_Joystick *joystick, hid_device *dev,
|
||||||
SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_START, (data[10] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_START, (data[10] & 0x80) ? SDL_PRESSED : SDL_RELEASED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->last_state[11] != data[11]) {
|
if (ctx->last_state[11] != data[11] || ctx->last_state[12] != data[12]) {
|
||||||
SDL_bool dpad_up = SDL_FALSE;
|
SDL_bool dpad_up = SDL_FALSE;
|
||||||
SDL_bool dpad_down = SDL_FALSE;
|
SDL_bool dpad_down = SDL_FALSE;
|
||||||
SDL_bool dpad_left = SDL_FALSE;
|
SDL_bool dpad_left = SDL_FALSE;
|
||||||
|
@ -881,6 +881,40 @@ HIDAPI_DriverXbox360_HandleStatePacket(SDL_Joystick *joystick, hid_device *dev,
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (data[12] & 0x0F) {
|
||||||
|
case 1:
|
||||||
|
dpad_up = SDL_TRUE;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
dpad_up = SDL_TRUE;
|
||||||
|
dpad_right = SDL_TRUE;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
dpad_right = SDL_TRUE;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
dpad_right = SDL_TRUE;
|
||||||
|
dpad_down = SDL_TRUE;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
dpad_down = SDL_TRUE;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
dpad_left = SDL_TRUE;
|
||||||
|
dpad_down = SDL_TRUE;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
dpad_left = SDL_TRUE;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
dpad_up = SDL_TRUE;
|
||||||
|
dpad_left = SDL_TRUE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down);
|
SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down);
|
||||||
SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up);
|
SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up);
|
||||||
SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right);
|
SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right);
|
||||||
|
|
Loading…
Reference in New Issue