|
@@ -1014,6 +1014,18 @@ static void HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_d
|
|
|
int touchpad_x, touchpad_y;
|
|
|
Uint64 timestamp = SDL_GetTicksNS();
|
|
|
|
|
|
+ if (size > 9 && ctx->report_touchpad && ctx->enhanced_reports) {
|
|
|
+ touchpad_down = ((packet->ucTouchpadCounter1 & 0x80) == 0);
|
|
|
+ touchpad_x = packet->rgucTouchpadData1[0] | (((int)packet->rgucTouchpadData1[1] & 0x0F) << 8);
|
|
|
+ touchpad_y = (packet->rgucTouchpadData1[1] >> 4) | ((int)packet->rgucTouchpadData1[2] << 4);
|
|
|
+ SDL_SendJoystickTouchpad(timestamp, joystick, 0, 0, touchpad_down, touchpad_x * TOUCHPAD_SCALEX, touchpad_y * TOUCHPAD_SCALEY, touchpad_down ? 1.0f : 0.0f);
|
|
|
+
|
|
|
+ touchpad_down = ((packet->ucTouchpadCounter2 & 0x80) == 0);
|
|
|
+ touchpad_x = packet->rgucTouchpadData2[0] | (((int)packet->rgucTouchpadData2[1] & 0x0F) << 8);
|
|
|
+ touchpad_y = (packet->rgucTouchpadData2[1] >> 4) | ((int)packet->rgucTouchpadData2[2] << 4);
|
|
|
+ SDL_SendJoystickTouchpad(timestamp, joystick, 0, 1, touchpad_down, touchpad_x * TOUCHPAD_SCALEX, touchpad_y * TOUCHPAD_SCALEY, touchpad_down ? 1.0f : 0.0f);
|
|
|
+ }
|
|
|
+
|
|
|
if (ctx->last_state.rgucButtonsHatAndCounter[0] != packet->rgucButtonsHatAndCounter[0]) {
|
|
|
{
|
|
|
Uint8 data = (packet->rgucButtonsHatAndCounter[0] >> 4);
|
|
@@ -1123,18 +1135,6 @@ static void HIDAPI_DriverPS4_HandleStatePacket(SDL_Joystick *joystick, SDL_hid_d
|
|
|
SDL_SendJoystickPowerInfo(joystick, state, percent);
|
|
|
}
|
|
|
|
|
|
- if (size > 9 && ctx->report_touchpad && ctx->enhanced_reports) {
|
|
|
- touchpad_down = ((packet->ucTouchpadCounter1 & 0x80) == 0);
|
|
|
- touchpad_x = packet->rgucTouchpadData1[0] | (((int)packet->rgucTouchpadData1[1] & 0x0F) << 8);
|
|
|
- touchpad_y = (packet->rgucTouchpadData1[1] >> 4) | ((int)packet->rgucTouchpadData1[2] << 4);
|
|
|
- SDL_SendJoystickTouchpad(timestamp, joystick, 0, 0, touchpad_down, touchpad_x * TOUCHPAD_SCALEX, touchpad_y * TOUCHPAD_SCALEY, touchpad_down ? 1.0f : 0.0f);
|
|
|
-
|
|
|
- touchpad_down = ((packet->ucTouchpadCounter2 & 0x80) == 0);
|
|
|
- touchpad_x = packet->rgucTouchpadData2[0] | (((int)packet->rgucTouchpadData2[1] & 0x0F) << 8);
|
|
|
- touchpad_y = (packet->rgucTouchpadData2[1] >> 4) | ((int)packet->rgucTouchpadData2[2] << 4);
|
|
|
- SDL_SendJoystickTouchpad(timestamp, joystick, 0, 1, touchpad_down, touchpad_x * TOUCHPAD_SCALEX, touchpad_y * TOUCHPAD_SCALEY, touchpad_down ? 1.0f : 0.0f);
|
|
|
- }
|
|
|
-
|
|
|
if (size > 9 && ctx->report_sensors) {
|
|
|
Uint16 tick;
|
|
|
Uint16 delta;
|