diff options
author | arades79 <scravers@protonmail.com> | 2023-02-14 17:13:47 +0100 |
---|---|---|
committer | arades79 <scravers@protonmail.com> | 2023-02-14 18:35:39 +0100 |
commit | 683019878fc939b418a65e1c5d84b066596d7655 (patch) | |
tree | 6b2a2e8ea34cb00a3fccf3613a52475550997035 /src/input_common | |
parent | apply clang-format (diff) | |
download | yuzu-683019878fc939b418a65e1c5d84b066596d7655.tar yuzu-683019878fc939b418a65e1c5d84b066596d7655.tar.gz yuzu-683019878fc939b418a65e1c5d84b066596d7655.tar.bz2 yuzu-683019878fc939b418a65e1c5d84b066596d7655.tar.lz yuzu-683019878fc939b418a65e1c5d84b066596d7655.tar.xz yuzu-683019878fc939b418a65e1c5d84b066596d7655.tar.zst yuzu-683019878fc939b418a65e1c5d84b066596d7655.zip |
Diffstat (limited to 'src/input_common')
-rw-r--r-- | src/input_common/drivers/gc_adapter.cpp | 8 | ||||
-rw-r--r-- | src/input_common/drivers/joycon.cpp | 4 | ||||
-rw-r--r-- | src/input_common/drivers/mouse.cpp | 2 | ||||
-rw-r--r-- | src/input_common/drivers/sdl_driver.cpp | 8 | ||||
-rw-r--r-- | src/input_common/drivers/udp_client.cpp | 2 | ||||
-rw-r--r-- | src/input_common/helpers/joycon_driver.cpp | 4 | ||||
-rw-r--r-- | src/input_common/helpers/joycon_protocol/calibration.cpp | 12 | ||||
-rw-r--r-- | src/input_common/helpers/joycon_protocol/common_protocol.cpp | 14 | ||||
-rw-r--r-- | src/input_common/helpers/joycon_protocol/irs.cpp | 6 | ||||
-rw-r--r-- | src/input_common/helpers/joycon_protocol/nfc.cpp | 8 | ||||
-rw-r--r-- | src/input_common/helpers/joycon_protocol/ringcon.cpp | 2 |
11 files changed, 35 insertions, 35 deletions
diff --git a/src/input_common/drivers/gc_adapter.cpp b/src/input_common/drivers/gc_adapter.cpp index a4faab15e..d09ff178b 100644 --- a/src/input_common/drivers/gc_adapter.cpp +++ b/src/input_common/drivers/gc_adapter.cpp @@ -223,8 +223,8 @@ void GCAdapter::AdapterScanThread(std::stop_token stop_token) { } bool GCAdapter::Setup() { - constexpr static u16 nintendo_vid = 0x057e; - constexpr static u16 gc_adapter_pid = 0x0337; + constexpr u16 nintendo_vid = 0x057e; + constexpr u16 gc_adapter_pid = 0x0337; usb_adapter_handle = std::make_unique<LibUSBDeviceHandle>(libusb_ctx->get(), nintendo_vid, gc_adapter_pid); if (!usb_adapter_handle->get()) { @@ -346,7 +346,7 @@ void GCAdapter::UpdateVibrations() { // Use 8 states to keep the switching between on/off fast enough for // a human to feel different vibration strenght // More states == more rumble strengths == slower update time - constexpr static u8 vibration_states = 8; + constexpr u8 vibration_states = 8; vibration_counter = (vibration_counter + 1) % vibration_states; @@ -363,7 +363,7 @@ void GCAdapter::SendVibrations() { return; } s32 size{}; - constexpr static u8 rumble_command = 0x11; + constexpr u8 rumble_command = 0x11; const u8 p1 = pads[0].enable_vibration; const u8 p2 = pads[1].enable_vibration; const u8 p3 = pads[2].enable_vibration; diff --git a/src/input_common/drivers/joycon.cpp b/src/input_common/drivers/joycon.cpp index a93bb5c25..b4cd39a20 100644 --- a/src/input_common/drivers/joycon.cpp +++ b/src/input_common/drivers/joycon.cpp @@ -77,7 +77,7 @@ void Joycons::Setup() { } void Joycons::ScanThread(std::stop_token stop_token) { - constexpr static u16 nintendo_vendor_id = 0x057e; + constexpr u16 nintendo_vendor_id = 0x057e; Common::SetCurrentThreadName("JoyconScanThread"); do { @@ -390,7 +390,7 @@ void Joycons::OnMotionUpdate(std::size_t port, Joycon::ControllerType type, int void Joycons::OnRingConUpdate(f32 ring_data) { // To simplify ring detection it will always be mapped to an empty identifier for all // controllers - constexpr static PadIdentifier identifier = { + static constexpr PadIdentifier identifier = { .guid = Common::UUID{}, .port = 0, .pad = 0, diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp index dfa93d58a..faf9cbdc3 100644 --- a/src/input_common/drivers/mouse.cpp +++ b/src/input_common/drivers/mouse.cpp @@ -37,7 +37,7 @@ Mouse::Mouse(std::string input_engine_) : InputEngine(std::move(input_engine_)) void Mouse::UpdateThread(std::stop_token stop_token) { Common::SetCurrentThreadName("Mouse"); - constexpr static int update_time = 10; + constexpr int update_time = 10; while (!stop_token.stop_requested()) { if (Settings::values.mouse_panning && !Settings::values.mouse_enabled) { // Slow movement by 4% diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index 53ebae2d6..5c20b3426 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp @@ -63,7 +63,7 @@ public: } bool UpdateMotion(SDL_ControllerSensorEvent event) { - constexpr static float gravity_constant = 9.80665f; + constexpr float gravity_constant = 9.80665f; std::scoped_lock lock{mutex}; const u64 time_difference = event.timestamp - last_motion_update; last_motion_update = event.timestamp; @@ -109,7 +109,7 @@ public: } bool RumblePlay(const Common::Input::VibrationStatus vibration) { - constexpr static u32 rumble_max_duration_ms = 1000; + constexpr u32 rumble_max_duration_ms = 1000; if (sdl_controller) { return SDL_GameControllerRumble( sdl_controller.get(), static_cast<u16>(vibration.low_amplitude), @@ -616,7 +616,7 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) { const auto joystick = GetSDLJoystickByGUID(identifier.guid.RawString(), static_cast<int>(identifier.port)); - constexpr static Common::Input::VibrationStatus test_vibration{ + static constexpr Common::Input::VibrationStatus test_vibration{ .low_amplitude = 1, .low_frequency = 160.0f, .high_amplitude = 1, @@ -624,7 +624,7 @@ bool SDLDriver::IsVibrationEnabled(const PadIdentifier& identifier) { .type = Common::Input::VibrationAmplificationType::Exponential, }; - constexpr static Common::Input::VibrationStatus zero_vibration{ + static constexpr Common::Input::VibrationStatus zero_vibration{ .low_amplitude = 0, .low_frequency = 160.0f, .high_amplitude = 0, diff --git a/src/input_common/drivers/udp_client.cpp b/src/input_common/drivers/udp_client.cpp index ae49f0478..808b21069 100644 --- a/src/input_common/drivers/udp_client.cpp +++ b/src/input_common/drivers/udp_client.cpp @@ -599,7 +599,7 @@ CalibrationConfigurationJob::CalibrationConfigurationJob( Status current_status{Status::Initialized}; SocketCallback callback{[](Response::Version) {}, [](Response::PortInfo) {}, [&](Response::PadData data) { - constexpr static u16 CALIBRATION_THRESHOLD = 100; + constexpr u16 CALIBRATION_THRESHOLD = 100; if (current_status == Status::Initialized) { // Receiving data means the communication is ready now diff --git a/src/input_common/helpers/joycon_driver.cpp b/src/input_common/helpers/joycon_driver.cpp index 6ab16cde6..e65b6b845 100644 --- a/src/input_common/helpers/joycon_driver.cpp +++ b/src/input_common/helpers/joycon_driver.cpp @@ -129,7 +129,7 @@ void JoyconDriver::InputThread(std::stop_token stop_token) { input_thread_running = true; // Max update rate is 5ms, ensure we are always able to read a bit faster - constexpr static int ThreadDelay = 2; + constexpr int ThreadDelay = 2; std::vector<u8> buffer(MaxBufferSize); while (!stop_token.stop_requested()) { @@ -548,7 +548,7 @@ DriverResult JoyconDriver::GetDeviceType(SDL_hid_device_info* device_info, {0x2007, ControllerType::Right}, {0x2009, ControllerType::Pro}, }; - constexpr static u16 nintendo_vendor_id = 0x057e; + constexpr u16 nintendo_vendor_id = 0x057e; controller_type = ControllerType::None; if (device_info->vendor_id != nintendo_vendor_id) { diff --git a/src/input_common/helpers/joycon_protocol/calibration.cpp b/src/input_common/helpers/joycon_protocol/calibration.cpp index 69e3379cf..d8f040f75 100644 --- a/src/input_common/helpers/joycon_protocol/calibration.cpp +++ b/src/input_common/helpers/joycon_protocol/calibration.cpp @@ -129,7 +129,7 @@ DriverResult CalibrationProtocol::GetImuCalibration(MotionCalibration& calibrati DriverResult CalibrationProtocol::GetRingCalibration(RingCalibration& calibration, s16 current_value) { - constexpr static s16 DefaultRingRange{800}; + constexpr s16 DefaultRingRange{800}; // TODO: Get default calibration form ring itself if (ring_data_max == 0 && ring_data_min == 0) { @@ -168,8 +168,8 @@ u16 CalibrationProtocol::GetYAxisCalibrationValue(std::span<u8> block) const { } void CalibrationProtocol::ValidateCalibration(JoyStickCalibration& calibration) { - constexpr static u16 DefaultStickCenter{0x800}; - constexpr static u16 DefaultStickRange{0x6cc}; + constexpr u16 DefaultStickCenter{0x800}; + constexpr u16 DefaultStickRange{0x6cc}; calibration.x.center = ValidateValue(calibration.x.center, DefaultStickCenter); calibration.x.max = ValidateValue(calibration.x.max, DefaultStickRange); @@ -181,9 +181,9 @@ void CalibrationProtocol::ValidateCalibration(JoyStickCalibration& calibration) } void CalibrationProtocol::ValidateCalibration(MotionCalibration& calibration) { - constexpr static s16 DefaultAccelerometerScale{0x4000}; - constexpr static s16 DefaultGyroScale{0x3be7}; - constexpr static s16 DefaultOffset{0}; + constexpr s16 DefaultAccelerometerScale{0x4000}; + constexpr s16 DefaultGyroScale{0x3be7}; + constexpr s16 DefaultOffset{0}; for (auto& sensor : calibration.accelerometer) { sensor.scale = ValidateValue(sensor.scale, DefaultAccelerometerScale); diff --git a/src/input_common/helpers/joycon_protocol/common_protocol.cpp b/src/input_common/helpers/joycon_protocol/common_protocol.cpp index 95c3923b0..2b42a4555 100644 --- a/src/input_common/helpers/joycon_protocol/common_protocol.cpp +++ b/src/input_common/helpers/joycon_protocol/common_protocol.cpp @@ -72,8 +72,8 @@ DriverResult JoyconCommonProtocol::SendRawData(std::span<const u8> buffer) { DriverResult JoyconCommonProtocol::GetSubCommandResponse(SubCommand sc, SubCommandResponse& output) { - constexpr static int timeout_mili = 66; - constexpr static int MaxTries = 15; + constexpr int timeout_mili = 66; + constexpr int MaxTries = 15; int tries = 0; do { @@ -157,8 +157,8 @@ DriverResult JoyconCommonProtocol::SendVibrationReport(std::span<const u8> buffe } DriverResult JoyconCommonProtocol::ReadRawSPI(SpiAddress addr, std::span<u8> output) { - constexpr static std::size_t HeaderSize = 5; - constexpr static std::size_t MaxTries = 10; + constexpr std::size_t HeaderSize = 5; + constexpr std::size_t MaxTries = 10; std::size_t tries = 0; SubCommandResponse response{}; std::array<u8, sizeof(ReadSpiPacket)> buffer{}; @@ -216,8 +216,8 @@ DriverResult JoyconCommonProtocol::ConfigureMCU(const MCUConfig& config) { DriverResult JoyconCommonProtocol::GetMCUDataResponse(ReportMode report_mode, MCUCommandResponse& output) { - constexpr static int TimeoutMili = 200; - constexpr static int MaxTries = 9; + constexpr int TimeoutMili = 200; + constexpr int MaxTries = 9; int tries = 0; do { @@ -265,7 +265,7 @@ DriverResult JoyconCommonProtocol::SendMCUData(ReportMode report_mode, SubComman DriverResult JoyconCommonProtocol::WaitSetMCUMode(ReportMode report_mode, MCUMode mode) { MCUCommandResponse output{}; - constexpr static std::size_t MaxTries{8}; + constexpr std::size_t MaxTries{8}; std::size_t tries{}; do { diff --git a/src/input_common/helpers/joycon_protocol/irs.cpp b/src/input_common/helpers/joycon_protocol/irs.cpp index 5c07f698b..731fd5981 100644 --- a/src/input_common/helpers/joycon_protocol/irs.cpp +++ b/src/input_common/helpers/joycon_protocol/irs.cpp @@ -131,7 +131,7 @@ DriverResult IrsProtocol::RequestImage(std::span<u8> buffer) { DriverResult IrsProtocol::ConfigureIrs() { LOG_DEBUG(Input, "Configure IRS"); - constexpr static std::size_t max_tries = 28; + constexpr std::size_t max_tries = 28; SubCommandResponse output{}; std::size_t tries = 0; @@ -166,7 +166,7 @@ DriverResult IrsProtocol::ConfigureIrs() { DriverResult IrsProtocol::WriteRegistersStep1() { LOG_DEBUG(Input, "WriteRegistersStep1"); DriverResult result{DriverResult::Success}; - constexpr static std::size_t max_tries = 28; + constexpr std::size_t max_tries = 28; SubCommandResponse output{}; std::size_t tries = 0; @@ -226,7 +226,7 @@ DriverResult IrsProtocol::WriteRegistersStep1() { DriverResult IrsProtocol::WriteRegistersStep2() { LOG_DEBUG(Input, "WriteRegistersStep2"); - constexpr static std::size_t max_tries = 28; + constexpr std::size_t max_tries = 28; SubCommandResponse output{}; std::size_t tries = 0; diff --git a/src/input_common/helpers/joycon_protocol/nfc.cpp b/src/input_common/helpers/joycon_protocol/nfc.cpp index 6b8f38aec..eeba82986 100644 --- a/src/input_common/helpers/joycon_protocol/nfc.cpp +++ b/src/input_common/helpers/joycon_protocol/nfc.cpp @@ -109,7 +109,7 @@ bool NfcProtocol::HasAmiibo() { } DriverResult NfcProtocol::WaitUntilNfcIsReady() { - constexpr static std::size_t timeout_limit = 10; + constexpr std::size_t timeout_limit = 10; MCUCommandResponse output{}; std::size_t tries = 0; @@ -131,7 +131,7 @@ DriverResult NfcProtocol::WaitUntilNfcIsReady() { DriverResult NfcProtocol::StartPolling(TagFoundData& data) { LOG_DEBUG(Input, "Start Polling for tag"); - constexpr static std::size_t timeout_limit = 7; + constexpr std::size_t timeout_limit = 7; MCUCommandResponse output{}; std::size_t tries = 0; @@ -155,7 +155,7 @@ DriverResult NfcProtocol::StartPolling(TagFoundData& data) { } DriverResult NfcProtocol::ReadTag(const TagFoundData& data) { - constexpr static std::size_t timeout_limit = 10; + constexpr std::size_t timeout_limit = 10; MCUCommandResponse output{}; std::size_t tries = 0; @@ -224,7 +224,7 @@ DriverResult NfcProtocol::ReadTag(const TagFoundData& data) { } DriverResult NfcProtocol::GetAmiiboData(std::vector<u8>& ntag_data) { - constexpr static std::size_t timeout_limit = 10; + constexpr std::size_t timeout_limit = 10; MCUCommandResponse output{}; std::size_t tries = 0; diff --git a/src/input_common/helpers/joycon_protocol/ringcon.cpp b/src/input_common/helpers/joycon_protocol/ringcon.cpp index 9056e64dc..190cef812 100644 --- a/src/input_common/helpers/joycon_protocol/ringcon.cpp +++ b/src/input_common/helpers/joycon_protocol/ringcon.cpp @@ -69,7 +69,7 @@ DriverResult RingConProtocol::StartRingconPolling() { DriverResult RingConProtocol::IsRingConnected(bool& is_connected) { LOG_DEBUG(Input, "IsRingConnected"); - constexpr static std::size_t max_tries = 28; + constexpr std::size_t max_tries = 28; SubCommandResponse output{}; std::size_t tries = 0; is_connected = false; |