summaryrefslogtreecommitdiff
path: root/src/input_common/gcadapter/gc_adapter.cpp
diff options
context:
space:
mode:
authorGravatar Ameer2020-07-14 13:04:02 -0400
committerGravatar Ameer2020-07-14 13:04:02 -0400
commit93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3 (patch)
treec4ab9e3acff296733b00effd85371bf04db6491f /src/input_common/gcadapter/gc_adapter.cpp
parentBreak out of scan loop if can't find adapter on first run (diff)
parentMerge pull request #4294 from MerryMage/cpu-opt-settings (diff)
downloadyuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar.gz
yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar.xz
yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.zip
Rebase to master
Diffstat (limited to '')
-rw-r--r--src/input_common/gcadapter/gc_adapter.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/input_common/gcadapter/gc_adapter.cpp b/src/input_common/gcadapter/gc_adapter.cpp
index 05607e033..898a278a9 100644
--- a/src/input_common/gcadapter/gc_adapter.cpp
+++ b/src/input_common/gcadapter/gc_adapter.cpp
@@ -4,6 +4,7 @@
4 4
5#include <chrono> 5#include <chrono>
6#include <thread> 6#include <thread>
7#include <libusb.h>
7#include "common/logging/log.h" 8#include "common/logging/log.h"
8#include "input_common/gcadapter/gc_adapter.h" 9#include "input_common/gcadapter/gc_adapter.h"
9 10
@@ -34,7 +35,7 @@ Adapter::Adapter() {
34 } 35 }
35} 36}
36 37
37GCPadStatus Adapter::GetPadStatus(int port, const std::array<u8, 37>& adapter_payload) { 38GCPadStatus Adapter::GetPadStatus(std::size_t port, const std::array<u8, 37>& adapter_payload) {
38 GCPadStatus pad = {}; 39 GCPadStatus pad = {};
39 40
40 ControllerTypes type = ControllerTypes(adapter_payload[1 + (9 * port)] >> 4); 41 ControllerTypes type = ControllerTypes(adapter_payload[1 + (9 * port)] >> 4);
@@ -205,7 +206,7 @@ void Adapter::StartScanThread() {
205 } 206 }
206 207
207 detect_thread_running = true; 208 detect_thread_running = true;
208 detect_thread = std::thread([=] { ScanThreadFunc(); }); 209 detect_thread = std::thread(&Adapter::ScanThreadFunc, this);
209} 210}
210 211
211void Adapter::StopScanThread() { 212void Adapter::StopScanThread() {
@@ -234,7 +235,7 @@ void Adapter::Setup() {
234 } 235 }
235 236
236 if (devices != nullptr) { 237 if (devices != nullptr) {
237 for (std::size_t index = 0; index < device_count; ++index) { 238 for (std::size_t index = 0; index < static_cast<std::size_t>(device_count); ++index) {
238 if (CheckDeviceAccess(devices[index])) { 239 if (CheckDeviceAccess(devices[index])) {
239 // GC Adapter found and accessible, registering it 240 // GC Adapter found and accessible, registering it
240 GetGCEndpoint(devices[index]); 241 GetGCEndpoint(devices[index]);
@@ -368,11 +369,11 @@ void Adapter::Reset() {
368 } 369 }
369} 370}
370 371
371bool Adapter::DeviceConnected(int port) { 372bool Adapter::DeviceConnected(std::size_t port) {
372 return adapter_controllers_status[port] != ControllerTypes::None; 373 return adapter_controllers_status[port] != ControllerTypes::None;
373} 374}
374 375
375void Adapter::ResetDeviceType(int port) { 376void Adapter::ResetDeviceType(std::size_t port) {
376 adapter_controllers_status[port] = ControllerTypes::None; 377 adapter_controllers_status[port] = ControllerTypes::None;
377} 378}
378 379