mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-07 02:40:30 -05:00
Fix: Dualsense (PS5) Gyro
No needs to use the hacky stuff anymore :D
This commit is contained in:
parent
bda5ba8cbc
commit
fde3c8e98f
@ -195,7 +195,6 @@ namespace Ship {
|
|||||||
SDL_GameControllerGetSensorData(Cont, SDL_SENSOR_GYRO, gyroData, 3);
|
SDL_GameControllerGetSensorData(Cont, SDL_SENSOR_GYRO, gyroData, 3);
|
||||||
|
|
||||||
const char* contName = SDL_GameControllerName(Cont);
|
const char* contName = SDL_GameControllerName(Cont);
|
||||||
const int isSpecialController = !strcmp("PS5 Controller", contName);
|
|
||||||
float gyro_drift_x = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX", contNumber).c_str(), 0.0f);
|
float gyro_drift_x = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX", contNumber).c_str(), 0.0f);
|
||||||
float gyro_drift_y = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY", contNumber).c_str(), 0.0f);
|
float gyro_drift_y = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY", contNumber).c_str(), 0.0f);
|
||||||
const float gyro_sensitivity = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroSensitivity", contNumber).c_str(), 1.0f);
|
const float gyro_sensitivity = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroSensitivity", contNumber).c_str(), 1.0f);
|
||||||
@ -205,25 +204,14 @@ namespace Ship {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gyro_drift_y == 0) {
|
if (gyro_drift_y == 0) {
|
||||||
if (isSpecialController == 1) {
|
gyro_drift_y = gyroData[1];
|
||||||
gyro_drift_y = gyroData[2];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
gyro_drift_y = gyroData[1];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX", contNumber).c_str(), gyro_drift_x);
|
CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX", contNumber).c_str(), gyro_drift_x);
|
||||||
CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY", contNumber).c_str(), gyro_drift_y);
|
CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY", contNumber).c_str(), gyro_drift_y);
|
||||||
|
|
||||||
if (isSpecialController == 1) {
|
wGyroX = gyroData[0] - gyro_drift_x;
|
||||||
wGyroX = gyroData[0] - gyro_drift_x;
|
wGyroY = gyroData[1] - gyro_drift_y;
|
||||||
wGyroY = -gyroData[2] - gyro_drift_y;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
wGyroX = gyroData[0] - gyro_drift_x;
|
|
||||||
wGyroY = gyroData[1] - gyro_drift_y;
|
|
||||||
}
|
|
||||||
|
|
||||||
wGyroX *= gyro_sensitivity;
|
wGyroX *= gyro_sensitivity;
|
||||||
wGyroY *= gyro_sensitivity;
|
wGyroY *= gyro_sensitivity;
|
||||||
|
Loading…
Reference in New Issue
Block a user