diff options
| author | 2020-10-15 20:59:34 -0700 | |
|---|---|---|
| committer | 2020-10-15 20:59:34 -0700 | |
| commit | 64f967fd4958abb5a02191a81e91fc8b33bcf4c5 (patch) | |
| tree | 97a73da4871f006b39eafca3a881ae2ea42f206a /src/input_common/udp/udp.cpp | |
| parent | Merge pull request #4784 from bunnei/cancelbuffer (diff) | |
| parent | input_common/CMakeLists: Make some warnings errors (diff) | |
| download | yuzu-64f967fd4958abb5a02191a81e91fc8b33bcf4c5.tar.gz yuzu-64f967fd4958abb5a02191a81e91fc8b33bcf4c5.tar.xz yuzu-64f967fd4958abb5a02191a81e91fc8b33bcf4c5.zip | |
Merge pull request #4790 from lioncash/input-common
input_common/CMakeLists: Make some warnings errors
Diffstat (limited to 'src/input_common/udp/udp.cpp')
| -rw-r--r-- | src/input_common/udp/udp.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/input_common/udp/udp.cpp b/src/input_common/udp/udp.cpp index eba077a36..71a76a7aa 100644 --- a/src/input_common/udp/udp.cpp +++ b/src/input_common/udp/udp.cpp | |||
| @@ -2,8 +2,6 @@ | |||
| 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 <atomic> | ||
| 6 | #include <list> | ||
| 7 | #include <mutex> | 5 | #include <mutex> |
| 8 | #include <utility> | 6 | #include <utility> |
| 9 | #include "common/assert.h" | 7 | #include "common/assert.h" |
| @@ -15,8 +13,8 @@ namespace InputCommon { | |||
| 15 | 13 | ||
| 16 | class UDPMotion final : public Input::MotionDevice { | 14 | class UDPMotion final : public Input::MotionDevice { |
| 17 | public: | 15 | public: |
| 18 | UDPMotion(std::string ip_, int port_, int pad_, CemuhookUDP::Client* client_) | 16 | explicit UDPMotion(std::string ip_, int port_, u32 pad_, CemuhookUDP::Client* client_) |
| 19 | : ip(ip_), port(port_), pad(pad_), client(client_) {} | 17 | : ip(std::move(ip_)), port(port_), pad(pad_), client(client_) {} |
| 20 | 18 | ||
| 21 | Input::MotionStatus GetStatus() const override { | 19 | Input::MotionStatus GetStatus() const override { |
| 22 | return client->GetPadState(pad).motion_status; | 20 | return client->GetPadState(pad).motion_status; |
| @@ -25,7 +23,7 @@ public: | |||
| 25 | private: | 23 | private: |
| 26 | const std::string ip; | 24 | const std::string ip; |
| 27 | const int port; | 25 | const int port; |
| 28 | const int pad; | 26 | const u32 pad; |
| 29 | CemuhookUDP::Client* client; | 27 | CemuhookUDP::Client* client; |
| 30 | mutable std::mutex mutex; | 28 | mutable std::mutex mutex; |
| 31 | }; | 29 | }; |
| @@ -40,11 +38,11 @@ UDPMotionFactory::UDPMotionFactory(std::shared_ptr<CemuhookUDP::Client> client_) | |||
| 40 | * - "port": the nth jcpad on the adapter | 38 | * - "port": the nth jcpad on the adapter |
| 41 | */ | 39 | */ |
| 42 | std::unique_ptr<Input::MotionDevice> UDPMotionFactory::Create(const Common::ParamPackage& params) { | 40 | std::unique_ptr<Input::MotionDevice> UDPMotionFactory::Create(const Common::ParamPackage& params) { |
| 43 | const std::string ip = params.Get("ip", "127.0.0.1"); | 41 | auto ip = params.Get("ip", "127.0.0.1"); |
| 44 | const int port = params.Get("port", 26760); | 42 | const auto port = params.Get("port", 26760); |
| 45 | const int pad = params.Get("pad_index", 0); | 43 | const auto pad = static_cast<u32>(params.Get("pad_index", 0)); |
| 46 | 44 | ||
| 47 | return std::make_unique<UDPMotion>(ip, port, pad, client.get()); | 45 | return std::make_unique<UDPMotion>(std::move(ip), port, pad, client.get()); |
| 48 | } | 46 | } |
| 49 | 47 | ||
| 50 | void UDPMotionFactory::BeginConfiguration() { | 48 | void UDPMotionFactory::BeginConfiguration() { |
| @@ -79,7 +77,7 @@ Common::ParamPackage UDPMotionFactory::GetNextInput() { | |||
| 79 | 77 | ||
| 80 | class UDPTouch final : public Input::TouchDevice { | 78 | class UDPTouch final : public Input::TouchDevice { |
| 81 | public: | 79 | public: |
| 82 | UDPTouch(std::string ip_, int port_, int pad_, CemuhookUDP::Client* client_) | 80 | explicit UDPTouch(std::string ip_, int port_, u32 pad_, CemuhookUDP::Client* client_) |
| 83 | : ip(std::move(ip_)), port(port_), pad(pad_), client(client_) {} | 81 | : ip(std::move(ip_)), port(port_), pad(pad_), client(client_) {} |
| 84 | 82 | ||
| 85 | std::tuple<float, float, bool> GetStatus() const override { | 83 | std::tuple<float, float, bool> GetStatus() const override { |
| @@ -89,7 +87,7 @@ public: | |||
| 89 | private: | 87 | private: |
| 90 | const std::string ip; | 88 | const std::string ip; |
| 91 | const int port; | 89 | const int port; |
| 92 | const int pad; | 90 | const u32 pad; |
| 93 | CemuhookUDP::Client* client; | 91 | CemuhookUDP::Client* client; |
| 94 | mutable std::mutex mutex; | 92 | mutable std::mutex mutex; |
| 95 | }; | 93 | }; |
| @@ -104,11 +102,11 @@ UDPTouchFactory::UDPTouchFactory(std::shared_ptr<CemuhookUDP::Client> client_) | |||
| 104 | * - "port": the nth jcpad on the adapter | 102 | * - "port": the nth jcpad on the adapter |
| 105 | */ | 103 | */ |
| 106 | std::unique_ptr<Input::TouchDevice> UDPTouchFactory::Create(const Common::ParamPackage& params) { | 104 | std::unique_ptr<Input::TouchDevice> UDPTouchFactory::Create(const Common::ParamPackage& params) { |
| 107 | const std::string ip = params.Get("ip", "127.0.0.1"); | 105 | auto ip = params.Get("ip", "127.0.0.1"); |
| 108 | const int port = params.Get("port", 26760); | 106 | const auto port = params.Get("port", 26760); |
| 109 | const int pad = params.Get("pad_index", 0); | 107 | const auto pad = static_cast<u32>(params.Get("pad_index", 0)); |
| 110 | 108 | ||
| 111 | return std::make_unique<UDPTouch>(ip, port, pad, client.get()); | 109 | return std::make_unique<UDPTouch>(std::move(ip), port, pad, client.get()); |
| 112 | } | 110 | } |
| 113 | 111 | ||
| 114 | void UDPTouchFactory::BeginConfiguration() { | 112 | void UDPTouchFactory::BeginConfiguration() { |