summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/input_common/gcadapter/gc_adapter.cpp10
-rw-r--r--src/input_common/gcadapter/gc_adapter.h6
-rw-r--r--src/input_common/gcadapter/gc_poller.cpp8
-rw-r--r--src/input_common/gcadapter/gc_poller.h2
4 files changed, 15 insertions, 11 deletions
diff --git a/src/input_common/gcadapter/gc_adapter.cpp b/src/input_common/gcadapter/gc_adapter.cpp
index c031fc22a..38210ffcb 100644
--- a/src/input_common/gcadapter/gc_adapter.cpp
+++ b/src/input_common/gcadapter/gc_adapter.cpp
@@ -34,7 +34,7 @@ Adapter::Adapter() {
34 } 34 }
35} 35}
36 36
37GCPadStatus Adapter::GetPadStatus(int port, const std::array<u8, 37>& adapter_payload) { 37GCPadStatus Adapter::GetPadStatus(std::size_t port, const std::array<u8, 37>& adapter_payload) {
38 GCPadStatus pad = {}; 38 GCPadStatus pad = {};
39 bool get_origin = false; 39 bool get_origin = false;
40 40
@@ -199,7 +199,7 @@ void Adapter::StartScanThread() {
199 } 199 }
200 200
201 detect_thread_running = true; 201 detect_thread_running = true;
202 detect_thread = std::thread([=] { ScanThreadFunc(); }); 202 detect_thread = std::thread(&Adapter::ScanThreadFunc, this);
203} 203}
204 204
205void Adapter::StopScanThread() { 205void Adapter::StopScanThread() {
@@ -228,7 +228,7 @@ void Adapter::Setup() {
228 } 228 }
229 229
230 if (devices != nullptr) { 230 if (devices != nullptr) {
231 for (std::size_t index = 0; index < device_count; ++index) { 231 for (std::size_t index = 0; index < static_cast<std::size_t>(device_count); ++index) {
232 if (CheckDeviceAccess(devices[index])) { 232 if (CheckDeviceAccess(devices[index])) {
233 // GC Adapter found and accessible, registering it 233 // GC Adapter found and accessible, registering it
234 GetGCEndpoint(devices[index]); 234 GetGCEndpoint(devices[index]);
@@ -358,11 +358,11 @@ void Adapter::Reset() {
358 } 358 }
359} 359}
360 360
361bool Adapter::DeviceConnected(int port) { 361bool Adapter::DeviceConnected(std::size_t port) {
362 return adapter_controllers_status[port] != ControllerTypes::None; 362 return adapter_controllers_status[port] != ControllerTypes::None;
363} 363}
364 364
365void Adapter::ResetDeviceType(int port) { 365void Adapter::ResetDeviceType(std::size_t port) {
366 adapter_controllers_status[port] = ControllerTypes::None; 366 adapter_controllers_status[port] = ControllerTypes::None;
367} 367}
368 368
diff --git a/src/input_common/gcadapter/gc_adapter.h b/src/input_common/gcadapter/gc_adapter.h
index 1337c260e..120ce4c02 100644
--- a/src/input_common/gcadapter/gc_adapter.h
+++ b/src/input_common/gcadapter/gc_adapter.h
@@ -107,7 +107,7 @@ public:
107 const std::array<GCState, 4>& GetPadState() const; 107 const std::array<GCState, 4>& GetPadState() const;
108 108
109private: 109private:
110 GCPadStatus GetPadStatus(int port, const std::array<u8, 37>& adapter_payload); 110 GCPadStatus GetPadStatus(std::size_t port, const std::array<u8, 37>& adapter_payload);
111 111
112 void PadToState(const GCPadStatus& pad, GCState& state); 112 void PadToState(const GCPadStatus& pad, GCState& state);
113 113
@@ -120,10 +120,10 @@ private:
120 void StopScanThread(); 120 void StopScanThread();
121 121
122 /// Returns true if there is a device connected to port 122 /// Returns true if there is a device connected to port
123 bool DeviceConnected(int port); 123 bool DeviceConnected(std::size_t port);
124 124
125 /// Resets status of device connected to port 125 /// Resets status of device connected to port
126 void ResetDeviceType(int port); 126 void ResetDeviceType(std::size_t port);
127 127
128 /// Returns true if we successfully gain access to GC Adapter 128 /// Returns true if we successfully gain access to GC Adapter
129 bool CheckDeviceAccess(libusb_device* device); 129 bool CheckDeviceAccess(libusb_device* device);
diff --git a/src/input_common/gcadapter/gc_poller.cpp b/src/input_common/gcadapter/gc_poller.cpp
index 385ce8430..bddfa102f 100644
--- a/src/input_common/gcadapter/gc_poller.cpp
+++ b/src/input_common/gcadapter/gc_poller.cpp
@@ -6,6 +6,7 @@
6#include <list> 6#include <list>
7#include <mutex> 7#include <mutex>
8#include <utility> 8#include <utility>
9#include "common/assert.h"
9#include "common/threadsafe_queue.h" 10#include "common/threadsafe_queue.h"
10#include "input_common/gcadapter/gc_adapter.h" 11#include "input_common/gcadapter/gc_adapter.h"
11#include "input_common/gcadapter/gc_poller.h" 12#include "input_common/gcadapter/gc_poller.h"
@@ -94,9 +95,12 @@ std::unique_ptr<Input::ButtonDevice> GCButtonFactory::Create(const Common::Param
94 return std::make_unique<GCAxisButton>(port, axis, threshold, trigger_if_greater, 95 return std::make_unique<GCAxisButton>(port, axis, threshold, trigger_if_greater,
95 adapter.get()); 96 adapter.get());
96 } 97 }
98
99 UNREACHABLE();
100 return nullptr;
97} 101}
98 102
99Common::ParamPackage GCButtonFactory::GetNextInput() { 103Common::ParamPackage GCButtonFactory::GetNextInput() const {
100 Common::ParamPackage params; 104 Common::ParamPackage params;
101 GCAdapter::GCPadStatus pad; 105 GCAdapter::GCPadStatus pad;
102 auto& queue = adapter->GetPadQueue(); 106 auto& queue = adapter->GetPadQueue();
@@ -249,7 +253,7 @@ Common::ParamPackage GCAnalogFactory::GetNextInput() {
249 const u8 axis = static_cast<u8>(pad.axis); 253 const u8 axis = static_cast<u8>(pad.axis);
250 if (analog_x_axis == -1) { 254 if (analog_x_axis == -1) {
251 analog_x_axis = axis; 255 analog_x_axis = axis;
252 controller_number = port; 256 controller_number = static_cast<int>(port);
253 } else if (analog_y_axis == -1 && analog_x_axis != axis && controller_number == port) { 257 } else if (analog_y_axis == -1 && analog_x_axis != axis && controller_number == port) {
254 analog_y_axis = axis; 258 analog_y_axis = axis;
255 } 259 }
diff --git a/src/input_common/gcadapter/gc_poller.h b/src/input_common/gcadapter/gc_poller.h
index e96af7d51..0527f328f 100644
--- a/src/input_common/gcadapter/gc_poller.h
+++ b/src/input_common/gcadapter/gc_poller.h
@@ -25,7 +25,7 @@ public:
25 */ 25 */
26 std::unique_ptr<Input::ButtonDevice> Create(const Common::ParamPackage& params) override; 26 std::unique_ptr<Input::ButtonDevice> Create(const Common::ParamPackage& params) override;
27 27
28 Common::ParamPackage GetNextInput(); 28 Common::ParamPackage GetNextInput() const;
29 29
30 /// For device input configuration/polling 30 /// For device input configuration/polling
31 void BeginConfiguration(); 31 void BeginConfiguration();