yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

Merge pull request #4314 from lioncash/input-warn

gcadapter: Tidy up compiler warnings
This commit is contained in:
bunnei 2020-07-14 10:20:12 -04:00 committed by GitHub
commit 393cdb15f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 11 deletions

View File

@ -34,7 +34,7 @@ Adapter::Adapter() {
} }
} }
GCPadStatus Adapter::GetPadStatus(int port, const std::array<u8, 37>& adapter_payload) { GCPadStatus Adapter::GetPadStatus(std::size_t port, const std::array<u8, 37>& adapter_payload) {
GCPadStatus pad = {}; GCPadStatus pad = {};
bool get_origin = false; bool get_origin = false;
@ -199,7 +199,7 @@ void Adapter::StartScanThread() {
} }
detect_thread_running = true; detect_thread_running = true;
detect_thread = std::thread([=] { ScanThreadFunc(); }); detect_thread = std::thread(&Adapter::ScanThreadFunc, this);
} }
void Adapter::StopScanThread() { void Adapter::StopScanThread() {
@ -228,7 +228,7 @@ void Adapter::Setup() {
} }
if (devices != nullptr) { if (devices != nullptr) {
for (std::size_t index = 0; index < device_count; ++index) { for (std::size_t index = 0; index < static_cast<std::size_t>(device_count); ++index) {
if (CheckDeviceAccess(devices[index])) { if (CheckDeviceAccess(devices[index])) {
// GC Adapter found and accessible, registering it // GC Adapter found and accessible, registering it
GetGCEndpoint(devices[index]); GetGCEndpoint(devices[index]);
@ -358,11 +358,11 @@ void Adapter::Reset() {
} }
} }
bool Adapter::DeviceConnected(int port) { bool Adapter::DeviceConnected(std::size_t port) {
return adapter_controllers_status[port] != ControllerTypes::None; return adapter_controllers_status[port] != ControllerTypes::None;
} }
void Adapter::ResetDeviceType(int port) { void Adapter::ResetDeviceType(std::size_t port) {
adapter_controllers_status[port] = ControllerTypes::None; adapter_controllers_status[port] = ControllerTypes::None;
} }

View File

@ -107,7 +107,7 @@ public:
const std::array<GCState, 4>& GetPadState() const; const std::array<GCState, 4>& GetPadState() const;
private: private:
GCPadStatus GetPadStatus(int port, const std::array<u8, 37>& adapter_payload); GCPadStatus GetPadStatus(std::size_t port, const std::array<u8, 37>& adapter_payload);
void PadToState(const GCPadStatus& pad, GCState& state); void PadToState(const GCPadStatus& pad, GCState& state);
@ -120,10 +120,10 @@ private:
void StopScanThread(); void StopScanThread();
/// Returns true if there is a device connected to port /// Returns true if there is a device connected to port
bool DeviceConnected(int port); bool DeviceConnected(std::size_t port);
/// Resets status of device connected to port /// Resets status of device connected to port
void ResetDeviceType(int port); void ResetDeviceType(std::size_t port);
/// Returns true if we successfully gain access to GC Adapter /// Returns true if we successfully gain access to GC Adapter
bool CheckDeviceAccess(libusb_device* device); bool CheckDeviceAccess(libusb_device* device);

View File

@ -6,6 +6,7 @@
#include <list> #include <list>
#include <mutex> #include <mutex>
#include <utility> #include <utility>
#include "common/assert.h"
#include "common/threadsafe_queue.h" #include "common/threadsafe_queue.h"
#include "input_common/gcadapter/gc_adapter.h" #include "input_common/gcadapter/gc_adapter.h"
#include "input_common/gcadapter/gc_poller.h" #include "input_common/gcadapter/gc_poller.h"
@ -94,9 +95,12 @@ std::unique_ptr<Input::ButtonDevice> GCButtonFactory::Create(const Common::Param
return std::make_unique<GCAxisButton>(port, axis, threshold, trigger_if_greater, return std::make_unique<GCAxisButton>(port, axis, threshold, trigger_if_greater,
adapter.get()); adapter.get());
} }
UNREACHABLE();
return nullptr;
} }
Common::ParamPackage GCButtonFactory::GetNextInput() { Common::ParamPackage GCButtonFactory::GetNextInput() const {
Common::ParamPackage params; Common::ParamPackage params;
GCAdapter::GCPadStatus pad; GCAdapter::GCPadStatus pad;
auto& queue = adapter->GetPadQueue(); auto& queue = adapter->GetPadQueue();
@ -249,7 +253,7 @@ Common::ParamPackage GCAnalogFactory::GetNextInput() {
const u8 axis = static_cast<u8>(pad.axis); const u8 axis = static_cast<u8>(pad.axis);
if (analog_x_axis == -1) { if (analog_x_axis == -1) {
analog_x_axis = axis; analog_x_axis = axis;
controller_number = port; controller_number = static_cast<int>(port);
} else if (analog_y_axis == -1 && analog_x_axis != axis && controller_number == port) { } else if (analog_y_axis == -1 && analog_x_axis != axis && controller_number == port) {
analog_y_axis = axis; analog_y_axis = axis;
} }

View File

@ -25,7 +25,7 @@ public:
*/ */
std::unique_ptr<Input::ButtonDevice> Create(const Common::ParamPackage& params) override; std::unique_ptr<Input::ButtonDevice> Create(const Common::ParamPackage& params) override;
Common::ParamPackage GetNextInput(); Common::ParamPackage GetNextInput() const;
/// For device input configuration/polling /// For device input configuration/polling
void BeginConfiguration(); void BeginConfiguration();