mirror of https://github.com/encounter/SDL.git
Fixed Xbox One Series X share button incorrectly triggering on newer firmware
This commit is contained in:
parent
b24494734b
commit
a5dba7d3ab
|
@ -488,16 +488,20 @@ HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverXboxOne
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->has_share_button) {
|
if (ctx->has_share_button) {
|
||||||
/* Version 1 of the firmware for Xbox One Series X */
|
/* Xbox Series X firmware version 5.0, report is 36 bytes, share button is in byte 18
|
||||||
|
* Xbox Series X firmware version 5.1, report is 44 bytes, share button is in byte 18
|
||||||
|
* Xbox Series X firmware version 5.5, report is 48 bytes, share button is in byte 22
|
||||||
|
*/
|
||||||
|
if (size < 48) {
|
||||||
if (ctx->last_state[18] != data[18]) {
|
if (ctx->last_state[18] != data[18]) {
|
||||||
SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_MISC1, (data[18] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_MISC1, (data[18] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
/* Version 2 of the firmware for Xbox One Series X */
|
|
||||||
if (ctx->last_state[22] != data[22]) {
|
if (ctx->last_state[22] != data[22]) {
|
||||||
SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_MISC1, (data[22] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_MISC1, (data[22] & 0x01) ? SDL_PRESSED : SDL_RELEASED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Xbox One S report is 18 bytes
|
/* Xbox One S report is 18 bytes
|
||||||
Xbox One Elite Series 1 report is 33 bytes, paddles in data[32], mode in data[32] & 0x10, both modes have mapped paddles by default
|
Xbox One Elite Series 1 report is 33 bytes, paddles in data[32], mode in data[32] & 0x10, both modes have mapped paddles by default
|
||||||
|
|
Loading…
Reference in New Issue