mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-05-30 19:57:10 +00:00
Fixed the accelerometer and gyro axes for the Armor-X Pro controller
(cherry picked from commit 37517557ae076cd94acd9ca3b739e1f32c150a43)
This commit is contained in:
parent
d2a2787783
commit
d043c8535b
|
@ -408,12 +408,6 @@ static SDL_bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
|
||||||
ctx->effects_supported = SDL_FALSE;
|
ctx->effects_supported = SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->vendor_id == USB_VENDOR_SONY &&
|
|
||||||
device->product_id == USB_PRODUCT_SONY_DS4_STRIKEPAD) {
|
|
||||||
/* The Armor-X Pro seems to only deliver half the acceleration it should */
|
|
||||||
ctx->accel_numerator *= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
device->joystick_type = joystick_type;
|
device->joystick_type = joystick_type;
|
||||||
device->type = SDL_CONTROLLER_TYPE_PS4;
|
device->type = SDL_CONTROLLER_TYPE_PS4;
|
||||||
if (ctx->official_controller) {
|
if (ctx->official_controller) {
|
||||||
|
@ -608,8 +602,40 @@ static void HIDAPI_DriverPS4_LoadCalibrationData(SDL_HIDAPI_Device *device)
|
||||||
|
|
||||||
if (i < 3) {
|
if (i < 3) {
|
||||||
scale *= ((double)ctx->gyro_numerator / ctx->gyro_denominator) * M_PI / 180.0;
|
scale *= ((double)ctx->gyro_numerator / ctx->gyro_denominator) * M_PI / 180.0;
|
||||||
|
|
||||||
|
if (device->vendor_id == USB_VENDOR_SONY &&
|
||||||
|
device->product_id == USB_PRODUCT_SONY_DS4_STRIKEPAD) {
|
||||||
|
/* The Armor-X Pro seems to rotate in the opposite direction on the Z axis */
|
||||||
|
switch (i) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
scale *= -1.0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
scale *= ((double)ctx->accel_numerator / ctx->accel_denominator) * SDL_STANDARD_GRAVITY;
|
scale *= ((double)ctx->accel_numerator / ctx->accel_denominator) * SDL_STANDARD_GRAVITY;
|
||||||
|
|
||||||
|
if (device->vendor_id == USB_VENDOR_SONY &&
|
||||||
|
device->product_id == USB_PRODUCT_SONY_DS4_STRIKEPAD) {
|
||||||
|
/* The Armor-X Pro seems to only deliver half the acceleration it should,
|
||||||
|
* and in the opposite direction on the X and Y axes */
|
||||||
|
switch (i) {
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
scale *= -2.0;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
scale *= 2.0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ctx->calibration[i].scale = (float)scale;
|
ctx->calibration[i].scale = (float)scale;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue