mirror of https://github.com/libsdl-org/SDL.git
joystick: Several minor GIP fixes
This mostly fixes stylistic issues, but also fixes an issue with some controllers where an erroneous check would clear the DLI flag, offsetting the share button index so it wouldn't work.
This commit is contained in:
parent
0a7548230c
commit
4cd889cb13
|
|
@ -1095,7 +1095,8 @@ static bool GIP_Acknowledge(
|
|||
NULL);
|
||||
}
|
||||
|
||||
static bool GIP_FragmentFailed(GIP_Attachment *attachment, const GIP_Header *header) {
|
||||
static bool GIP_FragmentFailed(GIP_Attachment *attachment, const GIP_Header *header)
|
||||
{
|
||||
attachment->fragment_retries++;
|
||||
if (attachment->fragment_retries > 8) {
|
||||
if (attachment->fragment_data) {
|
||||
|
|
@ -1120,14 +1121,11 @@ static bool GIP_EnableEliteButtons(GIP_Attachment *attachment) {
|
|||
*/
|
||||
static const Uint8 enable_raw_report[] = { 7, 0 };
|
||||
|
||||
if (!GIP_SendVendorMessage(attachment,
|
||||
return GIP_SendVendorMessage(attachment,
|
||||
GIP_SL_ELITE_CONFIG,
|
||||
0,
|
||||
enable_raw_report,
|
||||
sizeof(enable_raw_report)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
sizeof(enable_raw_report));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -1565,10 +1563,10 @@ static bool GIP_HandleCommandMetadataRespose(
|
|||
"GIP: Controller was missing expected GUID. This controller probably won't work on an actual Xbox.");
|
||||
}
|
||||
|
||||
if ((attachment->features & GIP_CMD_GUIDE_COLOR) &&
|
||||
if ((attachment->features & GIP_FEATURE_GUIDE_COLOR) &&
|
||||
!GIP_SupportsVendorMessage(attachment, GIP_CMD_GUIDE_COLOR, false))
|
||||
{
|
||||
attachment->features &= ~GIP_CMD_GUIDE_COLOR;
|
||||
attachment->features &= ~GIP_FEATURE_GUIDE_COLOR;
|
||||
}
|
||||
|
||||
GIP_HandleQuirks(attachment);
|
||||
|
|
@ -1661,9 +1659,9 @@ static bool GIP_HandleCommandFirmware(
|
|||
} else {
|
||||
attachment->paddle_format = GIP_PADDLES_XBE2;
|
||||
}
|
||||
}
|
||||
|
||||
return GIP_EnableEliteButtons(attachment);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "GIP: Unimplemented Firmware message");
|
||||
|
||||
|
|
@ -1715,7 +1713,6 @@ static bool GIP_HandleCommandRawReport(
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
static bool GIP_HandleCommandHidReport(
|
||||
GIP_Attachment *attachment,
|
||||
const GIP_Header *header,
|
||||
|
|
@ -1886,8 +1883,6 @@ static void GIP_HandleNavigationReport(
|
|||
} else {
|
||||
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, ((bytes[1] & 0x10) != 0));
|
||||
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, ((bytes[1] & 0x20) != 0));
|
||||
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, ((bytes[1] & 0x40) != 0));
|
||||
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, ((bytes[1] & 0x80) != 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1900,6 +1895,10 @@ static void GIP_HandleGamepadReport(
|
|||
int num_bytes)
|
||||
{
|
||||
Sint16 axis;
|
||||
|
||||
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_LEFT_STICK, ((bytes[1] & 0x40) != 0));
|
||||
SDL_SendJoystickButton(timestamp, joystick, SDL_GAMEPAD_BUTTON_RIGHT_STICK, ((bytes[1] & 0x80) != 0));
|
||||
|
||||
axis = bytes[2];
|
||||
axis |= bytes[3] << 8;
|
||||
axis = SDL_clamp(axis, 0, 1023);
|
||||
|
|
|
|||
Loading…
Reference in New Issue