diff options
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
5 files changed, 7 insertions, 5 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp b/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp index b22ace19f2..50c827d6d3 100644 --- a/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp @@ -574,7 +574,7 @@ Device::Device(std::string name, int index, std::string server_address, u16 serv AddInput(new AccelerometerInput("Accel Backward", m_pad_data.accelerometer_z_g, -accel_scale)); // Convert degrees per second to radians per second - constexpr auto gyro_scale = 360.0 / MathUtil::TAU; + constexpr auto gyro_scale = MathUtil::RadiansToDegrees(1.0); AddInput(new GyroInput("Gyro Pitch Up", m_pad_data.gyro_pitch_deg_s, gyro_scale)); AddInput(new GyroInput("Gyro Pitch Down", m_pad_data.gyro_pitch_deg_s, -gyro_scale)); diff --git a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp index 8b8a22e400..6b29a95b2c 100644 --- a/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp +++ b/Source/Core/InputCommon/ControllerInterface/MappingCommon.cpp @@ -189,7 +189,7 @@ bool ReshapableInputMapper::Update() float ReshapableInputMapper::GetCurrentAngle() const { - constexpr auto quarter_circle = float(MathUtil::TAU) * 0.25f; + constexpr auto quarter_circle = MathUtil::TAU_v<float> * 0.25f; return quarter_circle - (float(m_input_detector.GetResults().size()) * quarter_circle); } diff --git a/Source/Core/InputCommon/ControllerInterface/SteamDeck/SteamDeck.cpp b/Source/Core/InputCommon/ControllerInterface/SteamDeck/SteamDeck.cpp index b78c56afc6..689217822d 100644 --- a/Source/Core/InputCommon/ControllerInterface/SteamDeck/SteamDeck.cpp +++ b/Source/Core/InputCommon/ControllerInterface/SteamDeck/SteamDeck.cpp @@ -257,7 +257,7 @@ Device::Device(hid_device* device) : m_device{device} // 16.384 (?) LSBs = 1 deg / s // final output in rads / s - constexpr auto gyro_scale = 16.384 * 360.0 / MathUtil::TAU; + constexpr auto gyro_scale = MathUtil::RadiansToDegrees(16.384); AddInput(new MotionInput("Gyro Pitch Up", m_latest_input.gyro_pitch, gyro_scale)); AddInput(new MotionInput("Gyro Pitch Down", m_latest_input.gyro_pitch, -gyro_scale)); AddInput(new MotionInput("Gyro Roll Left", m_latest_input.gyro_roll, -gyro_scale)); diff --git a/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp b/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp index e7724c1840..42924a77ed 100644 --- a/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp @@ -3,6 +3,8 @@ #include "InputCommon/ControllerInterface/Wiimote/WiimoteController.h" +#include <numbers> + #include "Common/BitUtils.h" #include "Common/Logging/Log.h" #include "Common/MathUtil.h" @@ -1258,7 +1260,7 @@ void Device::UpdateOrientation() m_rotation_inputs = Common::Vec3{WiimoteEmu::GetPitch(m_orientation), WiimoteEmu::GetRoll(m_orientation), WiimoteEmu::GetYaw(m_orientation)} / - float(MathUtil::PI); + std::numbers::pi_v<float>; } void Device::IRState::ProcessData(const DataReportManipulator& manipulator) diff --git a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp index c8fa7b3647..fc10325fa0 100644 --- a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp +++ b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp @@ -541,7 +541,7 @@ bool evdevDevice::AddNode(std::string devnode, int fd, libevdev* dev) // evdev resolution is specified in "g"s and deg/s. // Convert these to m/s/s and rad/s. constexpr ControlState accel_scale = MathUtil::GRAVITY_ACCELERATION; - constexpr ControlState gyro_scale = MathUtil::TAU / 360; + constexpr ControlState gyro_scale = MathUtil::DegreesToRadians(ControlState{1}); add_motion_inputs(ABS_X, accel_scale); add_motion_inputs(ABS_RX, gyro_scale); |
