summaryrefslogtreecommitdiff
path: root/src/input_common/udp/udp.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2020-10-14 02:51:14 -0400
committerGravatar Lioncash2020-10-15 19:37:51 -0400
commit046c0c91a3ed665531f20955e7cfb86fe5b73213 (patch)
tree94382af9cc339cf5f384f4d0c8938dd593b4e1c5 /src/input_common/udp/udp.cpp
parentMerge pull request #4787 from lioncash/conversion (diff)
downloadyuzu-046c0c91a3ed665531f20955e7cfb86fe5b73213.tar.gz
yuzu-046c0c91a3ed665531f20955e7cfb86fe5b73213.tar.xz
yuzu-046c0c91a3ed665531f20955e7cfb86fe5b73213.zip
input_common/CMakeLists: Make some warnings errors
Makes the input_common code warnings consistent with the rest of the codebase.
Diffstat (limited to 'src/input_common/udp/udp.cpp')
-rw-r--r--src/input_common/udp/udp.cpp28
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
16class UDPMotion final : public Input::MotionDevice { 14class UDPMotion final : public Input::MotionDevice {
17public: 15public:
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:
25private: 23private:
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 */
42std::unique_ptr<Input::MotionDevice> UDPMotionFactory::Create(const Common::ParamPackage& params) { 40std::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
50void UDPMotionFactory::BeginConfiguration() { 48void UDPMotionFactory::BeginConfiguration() {
@@ -79,7 +77,7 @@ Common::ParamPackage UDPMotionFactory::GetNextInput() {
79 77
80class UDPTouch final : public Input::TouchDevice { 78class UDPTouch final : public Input::TouchDevice {
81public: 79public:
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:
89private: 87private:
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 */
106std::unique_ptr<Input::TouchDevice> UDPTouchFactory::Create(const Common::ParamPackage& params) { 104std::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
114void UDPTouchFactory::BeginConfiguration() { 112void UDPTouchFactory::BeginConfiguration() {