diff options
Diffstat (limited to 'src/input_common')
| -rw-r--r-- | src/input_common/CMakeLists.txt | 19 | ||||
| -rwxr-xr-x | src/input_common/analog_from_button.cpp | 1 | ||||
| -rw-r--r-- | src/input_common/gcadapter/gc_adapter.cpp | 7 | ||||
| -rw-r--r-- | src/input_common/main.cpp | 4 | ||||
| -rw-r--r-- | src/input_common/mouse/mouse_input.cpp | 16 | ||||
| -rw-r--r-- | src/input_common/mouse/mouse_input.h | 6 | ||||
| -rw-r--r-- | src/input_common/mouse/mouse_poller.cpp | 5 | ||||
| -rw-r--r-- | src/input_common/sdl/sdl_impl.cpp | 65 | ||||
| -rw-r--r-- | src/input_common/sdl/sdl_impl.h | 8 | ||||
| -rw-r--r-- | src/input_common/touch_from_button.cpp | 3 | ||||
| -rw-r--r-- | src/input_common/udp/client.cpp | 4 | ||||
| -rw-r--r-- | src/input_common/udp/protocol.h | 7 |
12 files changed, 81 insertions, 64 deletions
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt index 7c5763f9c..c4283a952 100644 --- a/src/input_common/CMakeLists.txt +++ b/src/input_common/CMakeLists.txt | |||
| @@ -34,28 +34,17 @@ if (MSVC) | |||
| 34 | /W4 | 34 | /W4 |
| 35 | /WX | 35 | /WX |
| 36 | 36 | ||
| 37 | # 'expression' : signed/unsigned mismatch | 37 | /we4242 # 'identifier': conversion from 'type1' to 'type2', possible loss of data |
| 38 | /we4018 | 38 | /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data |
| 39 | # 'argument' : conversion from 'type1' to 'type2', possible loss of data (floating-point) | 39 | /we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch |
| 40 | /we4244 | 40 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data |
| 41 | # 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch | ||
| 42 | /we4245 | ||
| 43 | # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data | ||
| 44 | /we4254 | ||
| 45 | # 'var' : conversion from 'size_t' to 'type', possible loss of data | ||
| 46 | /we4267 | ||
| 47 | # 'context' : truncation from 'type1' to 'type2' | ||
| 48 | /we4305 | ||
| 49 | ) | 41 | ) |
| 50 | else() | 42 | else() |
| 51 | target_compile_options(input_common PRIVATE | 43 | target_compile_options(input_common PRIVATE |
| 52 | -Werror | 44 | -Werror |
| 53 | -Werror=conversion | 45 | -Werror=conversion |
| 54 | -Werror=ignored-qualifiers | 46 | -Werror=ignored-qualifiers |
| 55 | -Werror=implicit-fallthrough | ||
| 56 | -Werror=reorder | ||
| 57 | -Werror=shadow | 47 | -Werror=shadow |
| 58 | -Werror=sign-compare | ||
| 59 | $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter> | 48 | $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-parameter> |
| 60 | $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-variable> | 49 | $<$<CXX_COMPILER_ID:GNU>:-Werror=unused-but-set-variable> |
| 61 | -Werror=unused-variable | 50 | -Werror=unused-variable |
diff --git a/src/input_common/analog_from_button.cpp b/src/input_common/analog_from_button.cpp index 100138d11..2fafd077f 100755 --- a/src/input_common/analog_from_button.cpp +++ b/src/input_common/analog_from_button.cpp | |||
| @@ -27,6 +27,7 @@ public: | |||
| 27 | down->SetCallback(callbacks); | 27 | down->SetCallback(callbacks); |
| 28 | left->SetCallback(callbacks); | 28 | left->SetCallback(callbacks); |
| 29 | right->SetCallback(callbacks); | 29 | right->SetCallback(callbacks); |
| 30 | modifier->SetCallback(callbacks); | ||
| 30 | } | 31 | } |
| 31 | 32 | ||
| 32 | bool IsAngleGreater(float old_angle, float new_angle) const { | 33 | bool IsAngleGreater(float old_angle, float new_angle) const { |
diff --git a/src/input_common/gcadapter/gc_adapter.cpp b/src/input_common/gcadapter/gc_adapter.cpp index 320f51ee6..a2f1bb67c 100644 --- a/src/input_common/gcadapter/gc_adapter.cpp +++ b/src/input_common/gcadapter/gc_adapter.cpp | |||
| @@ -5,14 +5,7 @@ | |||
| 5 | #include <chrono> | 5 | #include <chrono> |
| 6 | #include <thread> | 6 | #include <thread> |
| 7 | 7 | ||
| 8 | #ifdef _MSC_VER | ||
| 9 | #pragma warning(push) | ||
| 10 | #pragma warning(disable : 4200) // nonstandard extension used : zero-sized array in struct/union | ||
| 11 | #endif | ||
| 12 | #include <libusb.h> | 8 | #include <libusb.h> |
| 13 | #ifdef _MSC_VER | ||
| 14 | #pragma warning(pop) | ||
| 15 | #endif | ||
| 16 | 9 | ||
| 17 | #include "common/logging/log.h" | 10 | #include "common/logging/log.h" |
| 18 | #include "common/param_package.h" | 11 | #include "common/param_package.h" |
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index 7399c3648..8de3d4520 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp | |||
| @@ -294,8 +294,8 @@ void InputSubsystem::ReloadInputDevices() { | |||
| 294 | impl->udp->ReloadSockets(); | 294 | impl->udp->ReloadSockets(); |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | std::vector<std::unique_ptr<Polling::DevicePoller>> InputSubsystem::GetPollers( | 297 | std::vector<std::unique_ptr<Polling::DevicePoller>> InputSubsystem::GetPollers([ |
| 298 | Polling::DeviceType type) const { | 298 | [maybe_unused]] Polling::DeviceType type) const { |
| 299 | #ifdef HAVE_SDL2 | 299 | #ifdef HAVE_SDL2 |
| 300 | return impl->sdl->GetPollers(type); | 300 | return impl->sdl->GetPollers(type); |
| 301 | #else | 301 | #else |
diff --git a/src/input_common/mouse/mouse_input.cpp b/src/input_common/mouse/mouse_input.cpp index a335e6da1..3b052ffb2 100644 --- a/src/input_common/mouse/mouse_input.cpp +++ b/src/input_common/mouse/mouse_input.cpp | |||
| @@ -2,25 +2,23 @@ | |||
| 2 | // Licensed under GPLv2+ | 2 | // Licensed under GPLv2+ |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <stop_token> | ||
| 6 | #include <thread> | ||
| 7 | |||
| 5 | #include "common/settings.h" | 8 | #include "common/settings.h" |
| 6 | #include "input_common/mouse/mouse_input.h" | 9 | #include "input_common/mouse/mouse_input.h" |
| 7 | 10 | ||
| 8 | namespace MouseInput { | 11 | namespace MouseInput { |
| 9 | 12 | ||
| 10 | Mouse::Mouse() { | 13 | Mouse::Mouse() { |
| 11 | update_thread = std::thread(&Mouse::UpdateThread, this); | 14 | update_thread = std::jthread([this](std::stop_token stop_token) { UpdateThread(stop_token); }); |
| 12 | } | 15 | } |
| 13 | 16 | ||
| 14 | Mouse::~Mouse() { | 17 | Mouse::~Mouse() = default; |
| 15 | update_thread_running = false; | ||
| 16 | if (update_thread.joinable()) { | ||
| 17 | update_thread.join(); | ||
| 18 | } | ||
| 19 | } | ||
| 20 | 18 | ||
| 21 | void Mouse::UpdateThread() { | 19 | void Mouse::UpdateThread(std::stop_token stop_token) { |
| 22 | constexpr int update_time = 10; | 20 | constexpr int update_time = 10; |
| 23 | while (update_thread_running) { | 21 | while (!stop_token.stop_requested()) { |
| 24 | for (MouseInfo& info : mouse_info) { | 22 | for (MouseInfo& info : mouse_info) { |
| 25 | const Common::Vec3f angular_direction{ | 23 | const Common::Vec3f angular_direction{ |
| 26 | -info.tilt_direction.y, | 24 | -info.tilt_direction.y, |
diff --git a/src/input_common/mouse/mouse_input.h b/src/input_common/mouse/mouse_input.h index 5a971ad67..c8bae99c1 100644 --- a/src/input_common/mouse/mouse_input.h +++ b/src/input_common/mouse/mouse_input.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <mutex> | 8 | #include <mutex> |
| 9 | #include <stop_token> | ||
| 9 | #include <thread> | 10 | #include <thread> |
| 10 | 11 | ||
| 11 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| @@ -85,7 +86,7 @@ public: | |||
| 85 | [[nodiscard]] const MouseData& GetMouseState(std::size_t button) const; | 86 | [[nodiscard]] const MouseData& GetMouseState(std::size_t button) const; |
| 86 | 87 | ||
| 87 | private: | 88 | private: |
| 88 | void UpdateThread(); | 89 | void UpdateThread(std::stop_token stop_token); |
| 89 | void UpdateYuzuSettings(); | 90 | void UpdateYuzuSettings(); |
| 90 | void StopPanning(); | 91 | void StopPanning(); |
| 91 | 92 | ||
| @@ -105,12 +106,11 @@ private: | |||
| 105 | u16 buttons{}; | 106 | u16 buttons{}; |
| 106 | u16 toggle_buttons{}; | 107 | u16 toggle_buttons{}; |
| 107 | u16 lock_buttons{}; | 108 | u16 lock_buttons{}; |
| 108 | std::thread update_thread; | 109 | std::jthread update_thread; |
| 109 | MouseButton last_button{MouseButton::Undefined}; | 110 | MouseButton last_button{MouseButton::Undefined}; |
| 110 | std::array<MouseInfo, 7> mouse_info; | 111 | std::array<MouseInfo, 7> mouse_info; |
| 111 | Common::SPSCQueue<MouseStatus> mouse_queue; | 112 | Common::SPSCQueue<MouseStatus> mouse_queue; |
| 112 | bool configuring{false}; | 113 | bool configuring{false}; |
| 113 | bool update_thread_running{true}; | ||
| 114 | int mouse_panning_timout{}; | 114 | int mouse_panning_timout{}; |
| 115 | }; | 115 | }; |
| 116 | } // namespace MouseInput | 116 | } // namespace MouseInput |
diff --git a/src/input_common/mouse/mouse_poller.cpp b/src/input_common/mouse/mouse_poller.cpp index d96104a4e..efcdd85d2 100644 --- a/src/input_common/mouse/mouse_poller.cpp +++ b/src/input_common/mouse/mouse_poller.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | ||
| 6 | #include <memory> | ||
| 5 | #include <mutex> | 7 | #include <mutex> |
| 6 | #include <utility> | 8 | #include <utility> |
| 7 | 9 | ||
| @@ -82,7 +84,8 @@ public: | |||
| 82 | std::lock_guard lock{mutex}; | 84 | std::lock_guard lock{mutex}; |
| 83 | const auto axis_value = | 85 | const auto axis_value = |
| 84 | static_cast<float>(mouse_input->GetMouseState(button).axis.at(axis)); | 86 | static_cast<float>(mouse_input->GetMouseState(button).axis.at(axis)); |
| 85 | return axis_value * Settings::values.mouse_panning_sensitivity / (100.0f * range); | 87 | const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue() * 0.10f; |
| 88 | return axis_value * sensitivity / (100.0f * range); | ||
| 86 | } | 89 | } |
| 87 | 90 | ||
| 88 | std::pair<float, float> GetAnalog(u32 analog_axis_x, u32 analog_axis_y) const { | 91 | std::pair<float, float> GetAnalog(u32 analog_axis_x, u32 analog_axis_y) const { |
diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp index 68672a92b..70a0ba09c 100644 --- a/src/input_common/sdl/sdl_impl.cpp +++ b/src/input_common/sdl/sdl_impl.cpp | |||
| @@ -115,6 +115,41 @@ public: | |||
| 115 | return state.buttons.at(button); | 115 | return state.buttons.at(button); |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | bool ToggleButton(int button) { | ||
| 119 | std::lock_guard lock{mutex}; | ||
| 120 | |||
| 121 | if (!state.toggle_buttons.contains(button) || !state.lock_buttons.contains(button)) { | ||
| 122 | state.toggle_buttons.insert_or_assign(button, false); | ||
| 123 | state.lock_buttons.insert_or_assign(button, false); | ||
| 124 | } | ||
| 125 | |||
| 126 | const bool button_state = state.toggle_buttons.at(button); | ||
| 127 | const bool button_lock = state.lock_buttons.at(button); | ||
| 128 | |||
| 129 | if (button_lock) { | ||
| 130 | return button_state; | ||
| 131 | } | ||
| 132 | |||
| 133 | state.lock_buttons.insert_or_assign(button, true); | ||
| 134 | |||
| 135 | if (button_state) { | ||
| 136 | state.toggle_buttons.insert_or_assign(button, false); | ||
| 137 | } else { | ||
| 138 | state.toggle_buttons.insert_or_assign(button, true); | ||
| 139 | } | ||
| 140 | |||
| 141 | return !button_state; | ||
| 142 | } | ||
| 143 | |||
| 144 | bool UnlockButton(int button) { | ||
| 145 | std::lock_guard lock{mutex}; | ||
| 146 | if (!state.toggle_buttons.contains(button)) { | ||
| 147 | return false; | ||
| 148 | } | ||
| 149 | state.lock_buttons.insert_or_assign(button, false); | ||
| 150 | return state.toggle_buttons.at(button); | ||
| 151 | } | ||
| 152 | |||
| 118 | void SetAxis(int axis, Sint16 value) { | 153 | void SetAxis(int axis, Sint16 value) { |
| 119 | std::lock_guard lock{mutex}; | 154 | std::lock_guard lock{mutex}; |
| 120 | state.axes.insert_or_assign(axis, value); | 155 | state.axes.insert_or_assign(axis, value); |
| @@ -130,10 +165,10 @@ public: | |||
| 130 | 165 | ||
| 131 | if (sdl_controller) { | 166 | if (sdl_controller) { |
| 132 | return SDL_GameControllerRumble(sdl_controller.get(), amp_low, amp_high, | 167 | return SDL_GameControllerRumble(sdl_controller.get(), amp_low, amp_high, |
| 133 | rumble_max_duration_ms) == 0; | 168 | rumble_max_duration_ms) != -1; |
| 134 | } else if (sdl_joystick) { | 169 | } else if (sdl_joystick) { |
| 135 | return SDL_JoystickRumble(sdl_joystick.get(), amp_low, amp_high, | 170 | return SDL_JoystickRumble(sdl_joystick.get(), amp_low, amp_high, |
| 136 | rumble_max_duration_ms) == 0; | 171 | rumble_max_duration_ms) != -1; |
| 137 | } | 172 | } |
| 138 | 173 | ||
| 139 | return false; | 174 | return false; |
| @@ -241,6 +276,8 @@ public: | |||
| 241 | private: | 276 | private: |
| 242 | struct State { | 277 | struct State { |
| 243 | std::unordered_map<int, bool> buttons; | 278 | std::unordered_map<int, bool> buttons; |
| 279 | std::unordered_map<int, bool> toggle_buttons{}; | ||
| 280 | std::unordered_map<int, bool> lock_buttons{}; | ||
| 244 | std::unordered_map<int, Sint16> axes; | 281 | std::unordered_map<int, Sint16> axes; |
| 245 | std::unordered_map<int, Uint8> hats; | 282 | std::unordered_map<int, Uint8> hats; |
| 246 | } state; | 283 | } state; |
| @@ -402,16 +439,25 @@ void SDLState::CloseJoysticks() { | |||
| 402 | 439 | ||
| 403 | class SDLButton final : public Input::ButtonDevice { | 440 | class SDLButton final : public Input::ButtonDevice { |
| 404 | public: | 441 | public: |
| 405 | explicit SDLButton(std::shared_ptr<SDLJoystick> joystick_, int button_) | 442 | explicit SDLButton(std::shared_ptr<SDLJoystick> joystick_, int button_, bool toggle_) |
| 406 | : joystick(std::move(joystick_)), button(button_) {} | 443 | : joystick(std::move(joystick_)), button(button_), toggle(toggle_) {} |
| 407 | 444 | ||
| 408 | bool GetStatus() const override { | 445 | bool GetStatus() const override { |
| 409 | return joystick->GetButton(button); | 446 | const bool button_state = joystick->GetButton(button); |
| 447 | if (!toggle) { | ||
| 448 | return button_state; | ||
| 449 | } | ||
| 450 | |||
| 451 | if (button_state) { | ||
| 452 | return joystick->ToggleButton(button); | ||
| 453 | } | ||
| 454 | return joystick->UnlockButton(button); | ||
| 410 | } | 455 | } |
| 411 | 456 | ||
| 412 | private: | 457 | private: |
| 413 | std::shared_ptr<SDLJoystick> joystick; | 458 | std::shared_ptr<SDLJoystick> joystick; |
| 414 | int button; | 459 | int button; |
| 460 | bool toggle; | ||
| 415 | }; | 461 | }; |
| 416 | 462 | ||
| 417 | class SDLDirectionButton final : public Input::ButtonDevice { | 463 | class SDLDirectionButton final : public Input::ButtonDevice { |
| @@ -635,6 +681,7 @@ public: | |||
| 635 | std::unique_ptr<Input::ButtonDevice> Create(const Common::ParamPackage& params) override { | 681 | std::unique_ptr<Input::ButtonDevice> Create(const Common::ParamPackage& params) override { |
| 636 | const std::string guid = params.Get("guid", "0"); | 682 | const std::string guid = params.Get("guid", "0"); |
| 637 | const int port = params.Get("port", 0); | 683 | const int port = params.Get("port", 0); |
| 684 | const auto toggle = params.Get("toggle", false); | ||
| 638 | 685 | ||
| 639 | auto joystick = state.GetSDLJoystickByGUID(guid, port); | 686 | auto joystick = state.GetSDLJoystickByGUID(guid, port); |
| 640 | 687 | ||
| @@ -660,7 +707,8 @@ public: | |||
| 660 | 707 | ||
| 661 | if (params.Has("axis")) { | 708 | if (params.Has("axis")) { |
| 662 | const int axis = params.Get("axis", 0); | 709 | const int axis = params.Get("axis", 0); |
| 663 | const float threshold = params.Get("threshold", 0.5f); | 710 | // Convert range from (0.0, 1.0) to (-1.0, 1.0) |
| 711 | const float threshold = (params.Get("threshold", 0.5f) - 0.5f) * 2.0f; | ||
| 664 | const std::string direction_name = params.Get("direction", ""); | 712 | const std::string direction_name = params.Get("direction", ""); |
| 665 | bool trigger_if_greater; | 713 | bool trigger_if_greater; |
| 666 | if (direction_name == "+") { | 714 | if (direction_name == "+") { |
| @@ -679,7 +727,7 @@ public: | |||
| 679 | const int button = params.Get("button", 0); | 727 | const int button = params.Get("button", 0); |
| 680 | // This is necessary so accessing GetButton with button won't crash | 728 | // This is necessary so accessing GetButton with button won't crash |
| 681 | joystick->SetButton(button, false); | 729 | joystick->SetButton(button, false); |
| 682 | return std::make_unique<SDLButton>(joystick, button); | 730 | return std::make_unique<SDLButton>(joystick, button, toggle); |
| 683 | } | 731 | } |
| 684 | 732 | ||
| 685 | private: | 733 | private: |
| @@ -933,12 +981,11 @@ Common::ParamPackage BuildAnalogParamPackageForButton(int port, std::string guid | |||
| 933 | params.Set("port", port); | 981 | params.Set("port", port); |
| 934 | params.Set("guid", std::move(guid)); | 982 | params.Set("guid", std::move(guid)); |
| 935 | params.Set("axis", axis); | 983 | params.Set("axis", axis); |
| 984 | params.Set("threshold", "0.5"); | ||
| 936 | if (value > 0) { | 985 | if (value > 0) { |
| 937 | params.Set("direction", "+"); | 986 | params.Set("direction", "+"); |
| 938 | params.Set("threshold", "0.5"); | ||
| 939 | } else { | 987 | } else { |
| 940 | params.Set("direction", "-"); | 988 | params.Set("direction", "-"); |
| 941 | params.Set("threshold", "-0.5"); | ||
| 942 | } | 989 | } |
| 943 | return params; | 990 | return params; |
| 944 | } | 991 | } |
diff --git a/src/input_common/sdl/sdl_impl.h b/src/input_common/sdl/sdl_impl.h index b77afcbd8..7a9ad6346 100644 --- a/src/input_common/sdl/sdl_impl.h +++ b/src/input_common/sdl/sdl_impl.h | |||
| @@ -10,15 +10,7 @@ | |||
| 10 | #include <thread> | 10 | #include <thread> |
| 11 | #include <unordered_map> | 11 | #include <unordered_map> |
| 12 | 12 | ||
| 13 | // Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307 | ||
| 14 | #ifdef __GNUC__ | ||
| 15 | #pragma GCC diagnostic push | ||
| 16 | #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" | ||
| 17 | #endif | ||
| 18 | #include <SDL.h> | 13 | #include <SDL.h> |
| 19 | #ifdef __GNUC__ | ||
| 20 | #pragma GCC diagnostic pop | ||
| 21 | #endif | ||
| 22 | 14 | ||
| 23 | #include "common/common_types.h" | 15 | #include "common/common_types.h" |
| 24 | #include "common/threadsafe_queue.h" | 16 | #include "common/threadsafe_queue.h" |
diff --git a/src/input_common/touch_from_button.cpp b/src/input_common/touch_from_button.cpp index e94ba197b..7878a56d7 100644 --- a/src/input_common/touch_from_button.cpp +++ b/src/input_common/touch_from_button.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | ||
| 5 | #include "common/settings.h" | 6 | #include "common/settings.h" |
| 6 | #include "core/frontend/framebuffer_layout.h" | 7 | #include "core/frontend/framebuffer_layout.h" |
| 7 | #include "input_common/touch_from_button.h" | 8 | #include "input_common/touch_from_button.h" |
| @@ -12,7 +13,7 @@ class TouchFromButtonDevice final : public Input::TouchDevice { | |||
| 12 | public: | 13 | public: |
| 13 | TouchFromButtonDevice() { | 14 | TouchFromButtonDevice() { |
| 14 | const auto button_index = | 15 | const auto button_index = |
| 15 | static_cast<std::size_t>(Settings::values.touch_from_button_map_index); | 16 | static_cast<u64>(Settings::values.touch_from_button_map_index.GetValue()); |
| 16 | const auto& buttons = Settings::values.touch_from_button_maps[button_index].buttons; | 17 | const auto& buttons = Settings::values.touch_from_button_maps[button_index].buttons; |
| 17 | 18 | ||
| 18 | for (const auto& config_entry : buttons) { | 19 | for (const auto& config_entry : buttons) { |
diff --git a/src/input_common/udp/client.cpp b/src/input_common/udp/client.cpp index bc1dfab3d..9b0aec797 100644 --- a/src/input_common/udp/client.cpp +++ b/src/input_common/udp/client.cpp | |||
| @@ -201,7 +201,7 @@ bool Client::DeviceConnected(std::size_t pad) const { | |||
| 201 | void Client::ReloadSockets() { | 201 | void Client::ReloadSockets() { |
| 202 | Reset(); | 202 | Reset(); |
| 203 | 203 | ||
| 204 | std::stringstream servers_ss(Settings::values.udp_input_servers); | 204 | std::stringstream servers_ss(static_cast<std::string>(Settings::values.udp_input_servers)); |
| 205 | std::string server_token; | 205 | std::string server_token; |
| 206 | std::size_t client = 0; | 206 | std::size_t client = 0; |
| 207 | while (std::getline(servers_ss, server_token, ',')) { | 207 | while (std::getline(servers_ss, server_token, ',')) { |
| @@ -370,7 +370,7 @@ std::optional<std::size_t> Client::GetUnusedFingerID() const { | |||
| 370 | 370 | ||
| 371 | void Client::UpdateTouchInput(Response::TouchPad& touch_pad, std::size_t client, std::size_t id) { | 371 | void Client::UpdateTouchInput(Response::TouchPad& touch_pad, std::size_t client, std::size_t id) { |
| 372 | // TODO: Use custom calibration per device | 372 | // TODO: Use custom calibration per device |
| 373 | const Common::ParamPackage touch_param(Settings::values.touch_device); | 373 | const Common::ParamPackage touch_param(Settings::values.touch_device.GetValue()); |
| 374 | const u16 min_x = static_cast<u16>(touch_param.Get("min_x", 100)); | 374 | const u16 min_x = static_cast<u16>(touch_param.Get("min_x", 100)); |
| 375 | const u16 min_y = static_cast<u16>(touch_param.Get("min_y", 50)); | 375 | const u16 min_y = static_cast<u16>(touch_param.Get("min_y", 50)); |
| 376 | const u16 max_x = static_cast<u16>(touch_param.Get("max_x", 1800)); | 376 | const u16 max_x = static_cast<u16>(touch_param.Get("max_x", 1800)); |
diff --git a/src/input_common/udp/protocol.h b/src/input_common/udp/protocol.h index a3d276697..1bdc9209e 100644 --- a/src/input_common/udp/protocol.h +++ b/src/input_common/udp/protocol.h | |||
| @@ -8,14 +8,7 @@ | |||
| 8 | #include <optional> | 8 | #include <optional> |
| 9 | #include <type_traits> | 9 | #include <type_traits> |
| 10 | 10 | ||
| 11 | #ifdef _MSC_VER | ||
| 12 | #pragma warning(push) | ||
| 13 | #pragma warning(disable : 4701) | ||
| 14 | #endif | ||
| 15 | #include <boost/crc.hpp> | 11 | #include <boost/crc.hpp> |
| 16 | #ifdef _MSC_VER | ||
| 17 | #pragma warning(pop) | ||
| 18 | #endif | ||
| 19 | 12 | ||
| 20 | #include "common/bit_field.h" | 13 | #include "common/bit_field.h" |
| 21 | #include "common/swap.h" | 14 | #include "common/swap.h" |