From fde3c8e98f7206c1e91fa1f4599695f6b7805171 Mon Sep 17 00:00:00 2001 From: PurpleHato Date: Wed, 8 Jun 2022 17:14:46 +0200 Subject: [PATCH] Fix: Dualsense (PS5) Gyro No needs to use the hacky stuff anymore :D --- libultraship/libultraship/SDLController.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/libultraship/libultraship/SDLController.cpp b/libultraship/libultraship/SDLController.cpp index ab2c48b30..2d8e8bb0d 100644 --- a/libultraship/libultraship/SDLController.cpp +++ b/libultraship/libultraship/SDLController.cpp @@ -195,7 +195,6 @@ namespace Ship { SDL_GameControllerGetSensorData(Cont, SDL_SENSOR_GYRO, gyroData, 3); 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_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); @@ -205,25 +204,14 @@ namespace Ship { } if (gyro_drift_y == 0) { - if (isSpecialController == 1) { - gyro_drift_y = gyroData[2]; - } - else { - gyro_drift_y = gyroData[1]; - } + gyro_drift_y = gyroData[1]; } 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); - if (isSpecialController == 1) { - wGyroX = gyroData[0] - gyro_drift_x; - wGyroY = -gyroData[2] - gyro_drift_y; - } - else { - wGyroX = gyroData[0] - gyro_drift_x; - wGyroY = gyroData[1] - gyro_drift_y; - } + wGyroX = gyroData[0] - gyro_drift_x; + wGyroY = gyroData[1] - gyro_drift_y; wGyroX *= gyro_sensitivity; wGyroY *= gyro_sensitivity;