mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-03-06 18:09:53 +00:00
Fixed sensor timestamp units for third-party PS5 controllers
(cherry picked from commit a72dfa6a5fe8d8901175db852de8686b83487522)
This commit is contained in:
parent
62e7049a4f
commit
37dee79b74
|
@ -723,7 +723,7 @@ static void HIDAPI_DriverPS5_CheckPendingLEDReset(SDL_HIDAPI_Device *device)
|
||||||
SDL_DriverPS5_Context *ctx = (SDL_DriverPS5_Context *)device->context;
|
SDL_DriverPS5_Context *ctx = (SDL_DriverPS5_Context *)device->context;
|
||||||
SDL_bool led_reset_complete = SDL_FALSE;
|
SDL_bool led_reset_complete = SDL_FALSE;
|
||||||
|
|
||||||
if (ctx->sensors_supported) {
|
if (ctx->enhanced_mode && ctx->sensors_supported && !ctx->use_alternate_report) {
|
||||||
const PS5StatePacketCommon_t *packet = &ctx->last_state.state;
|
const PS5StatePacketCommon_t *packet = &ctx->last_state.state;
|
||||||
|
|
||||||
/* Check the timer to make sure the Bluetooth connection LED animation is complete */
|
/* Check the timer to make sure the Bluetooth connection LED animation is complete */
|
||||||
|
@ -1253,6 +1253,9 @@ static void HIDAPI_DriverPS5_HandleStatePacketCommon(SDL_Joystick *joystick, SDL
|
||||||
ctx->timestamp = timestamp;
|
ctx->timestamp = timestamp;
|
||||||
}
|
}
|
||||||
ctx->last_timestamp = timestamp;
|
ctx->last_timestamp = timestamp;
|
||||||
|
|
||||||
|
/* Sensor timestamp is in 1us units */
|
||||||
|
timestamp_us = ctx->timestamp;
|
||||||
} else {
|
} else {
|
||||||
/* 32-bit timestamp */
|
/* 32-bit timestamp */
|
||||||
Uint32 timestamp;
|
Uint32 timestamp;
|
||||||
|
@ -1274,10 +1277,10 @@ static void HIDAPI_DriverPS5_HandleStatePacketCommon(SDL_Joystick *joystick, SDL
|
||||||
ctx->timestamp = timestamp;
|
ctx->timestamp = timestamp;
|
||||||
}
|
}
|
||||||
ctx->last_timestamp = timestamp;
|
ctx->last_timestamp = timestamp;
|
||||||
}
|
|
||||||
|
|
||||||
/* Sensor timestamp is in 0.33us units */
|
/* Sensor timestamp is in 0.33us units */
|
||||||
timestamp_us = ctx->timestamp / 3;
|
timestamp_us = ctx->timestamp / 3;
|
||||||
|
}
|
||||||
|
|
||||||
data[0] = HIDAPI_DriverPS5_ApplyCalibrationData(ctx, 0, LOAD16(packet->rgucGyroX[0], packet->rgucGyroX[1]));
|
data[0] = HIDAPI_DriverPS5_ApplyCalibrationData(ctx, 0, LOAD16(packet->rgucGyroX[0], packet->rgucGyroX[1]));
|
||||||
data[1] = HIDAPI_DriverPS5_ApplyCalibrationData(ctx, 1, LOAD16(packet->rgucGyroY[0], packet->rgucGyroY[1]));
|
data[1] = HIDAPI_DriverPS5_ApplyCalibrationData(ctx, 1, LOAD16(packet->rgucGyroY[0], packet->rgucGyroY[1]));
|
||||||
|
|
Loading…
Reference in a new issue