@@ -809,7 +809,7 @@ static void GIP_MetadataFree(GIP_Metadata *metadata)
809
809
SDL_memset (metadata , 0 , sizeof (* metadata ));
810
810
}
811
811
812
- static bool GIP_ParseDeviceMetadata (GIP_Metadata * metadata , const Uint8 * bytes , int num_bytes , int * offset )
812
+ static bool GIP_ParseDeviceMetadata (GIP_Metadata * metadata , const Uint8 * bytes , int num_bytes , int * offset )
813
813
{
814
814
GIP_DeviceMetadata * device = & metadata -> device ;
815
815
int buffer_offset ;
@@ -956,7 +956,7 @@ static bool GIP_ParseDeviceMetadata(GIP_Metadata *metadata, const Uint8 *bytes,
956
956
return true;
957
957
}
958
958
959
- static bool GIP_ParseMessageMetadata (GIP_MessageMetadata * metadata , const Uint8 * bytes , int num_bytes , int * offset )
959
+ static bool GIP_ParseMessageMetadata (GIP_MessageMetadata * metadata , const Uint8 * bytes , int num_bytes , int * offset )
960
960
{
961
961
Uint16 length ;
962
962
@@ -1095,7 +1095,8 @@ static bool GIP_Acknowledge(
1095
1095
NULL );
1096
1096
}
1097
1097
1098
- static bool GIP_FragmentFailed (GIP_Attachment * attachment , const GIP_Header * header ) {
1098
+ static bool GIP_FragmentFailed (GIP_Attachment * attachment , const GIP_Header * header )
1099
+ {
1099
1100
attachment -> fragment_retries ++ ;
1100
1101
if (attachment -> fragment_retries > 8 ) {
1101
1102
if (attachment -> fragment_data ) {
@@ -1120,14 +1121,11 @@ static bool GIP_EnableEliteButtons(GIP_Attachment *attachment) {
1120
1121
*/
1121
1122
static const Uint8 enable_raw_report [] = { 7 , 0 };
1122
1123
1123
- if (! GIP_SendVendorMessage (attachment ,
1124
+ return GIP_SendVendorMessage (attachment ,
1124
1125
GIP_SL_ELITE_CONFIG ,
1125
1126
0 ,
1126
1127
enable_raw_report ,
1127
- sizeof (enable_raw_report )))
1128
- {
1129
- return false;
1130
- }
1128
+ sizeof (enable_raw_report ));
1131
1129
}
1132
1130
1133
1131
return true;
@@ -1565,10 +1563,10 @@ static bool GIP_HandleCommandMetadataRespose(
1565
1563
"GIP: Controller was missing expected GUID. This controller probably won't work on an actual Xbox." );
1566
1564
}
1567
1565
1568
- if ((attachment -> features & GIP_CMD_GUIDE_COLOR ) &&
1566
+ if ((attachment -> features & GIP_FEATURE_GUIDE_COLOR ) &&
1569
1567
!GIP_SupportsVendorMessage (attachment , GIP_CMD_GUIDE_COLOR , false))
1570
1568
{
1571
- attachment -> features &= ~GIP_CMD_GUIDE_COLOR ;
1569
+ attachment -> features &= ~GIP_FEATURE_GUIDE_COLOR ;
1572
1570
}
1573
1571
1574
1572
GIP_HandleQuirks (attachment );
@@ -1661,9 +1659,9 @@ static bool GIP_HandleCommandFirmware(
1661
1659
} else {
1662
1660
attachment -> paddle_format = GIP_PADDLES_XBE2 ;
1663
1661
}
1662
+ return GIP_EnableEliteButtons (attachment );
1664
1663
}
1665
-
1666
- return GIP_EnableEliteButtons (attachment );
1664
+ return true;
1667
1665
} else {
1668
1666
SDL_LogDebug (SDL_LOG_CATEGORY_INPUT , "GIP: Unimplemented Firmware message" );
1669
1667
@@ -1715,7 +1713,6 @@ static bool GIP_HandleCommandRawReport(
1715
1713
return true;
1716
1714
}
1717
1715
1718
-
1719
1716
static bool GIP_HandleCommandHidReport (
1720
1717
GIP_Attachment * attachment ,
1721
1718
const GIP_Header * header ,
@@ -1886,8 +1883,6 @@ static void GIP_HandleNavigationReport(
1886
1883
} else {
1887
1884
SDL_SendJoystickButton (timestamp , joystick , SDL_GAMEPAD_BUTTON_LEFT_SHOULDER , ((bytes [1 ] & 0x10 ) != 0 ));
1888
1885
SDL_SendJoystickButton (timestamp , joystick , SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER , ((bytes [1 ] & 0x20 ) != 0 ));
1889
- SDL_SendJoystickButton (timestamp , joystick , SDL_GAMEPAD_BUTTON_LEFT_STICK , ((bytes [1 ] & 0x40 ) != 0 ));
1890
- SDL_SendJoystickButton (timestamp , joystick , SDL_GAMEPAD_BUTTON_RIGHT_STICK , ((bytes [1 ] & 0x80 ) != 0 ));
1891
1886
}
1892
1887
}
1893
1888
}
@@ -1900,6 +1895,10 @@ static void GIP_HandleGamepadReport(
1900
1895
int num_bytes )
1901
1896
{
1902
1897
Sint16 axis ;
1898
+
1899
+ SDL_SendJoystickButton (timestamp , joystick , SDL_GAMEPAD_BUTTON_LEFT_STICK , ((bytes [1 ] & 0x40 ) != 0 ));
1900
+ SDL_SendJoystickButton (timestamp , joystick , SDL_GAMEPAD_BUTTON_RIGHT_STICK , ((bytes [1 ] & 0x80 ) != 0 ));
1901
+
1903
1902
axis = bytes [2 ];
1904
1903
axis |= bytes [3 ] << 8 ;
1905
1904
axis = SDL_clamp (axis , 0 , 1023 );
@@ -2241,7 +2240,7 @@ static bool GIP_HandleSystemMessage(
2241
2240
}
2242
2241
}
2243
2242
2244
- static GIP_Attachment * GIP_EnsureAttachment (GIP_Device * device , Uint8 attachment_index )
2243
+ static GIP_Attachment * GIP_EnsureAttachment (GIP_Device * device , Uint8 attachment_index )
2245
2244
{
2246
2245
GIP_Attachment * attachment = device -> attachments [attachment_index ];
2247
2246
if (!attachment ) {
@@ -2280,7 +2279,7 @@ static bool GIP_HandleMessage(
2280
2279
case GIP_LL_BUTTON_INFO_REPORT :
2281
2280
return GIP_HandleLLButtonInfoReport (attachment , header , bytes , num_bytes );
2282
2281
case GIP_LL_OVERFLOW_INPUT_REPORT :
2283
- return GIP_HandleLLOverflowInputReport (attachment , header , bytes , num_bytes );
2282
+ return GIP_HandleLLOverflowInputReport (attachment , header , bytes , num_bytes );
2284
2283
}
2285
2284
}
2286
2285
SDL_LogWarn (SDL_LOG_CATEGORY_INPUT ,
0 commit comments