summaryrefslogtreecommitdiff
path: root/src/input_common/drivers/gc_adapter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/input_common/drivers/gc_adapter.cpp')
-rw-r--r--src/input_common/drivers/gc_adapter.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/input_common/drivers/gc_adapter.cpp b/src/input_common/drivers/gc_adapter.cpp
index 155caae42..f4dd24e7d 100644
--- a/src/input_common/drivers/gc_adapter.cpp
+++ b/src/input_common/drivers/gc_adapter.cpp
@@ -1,6 +1,5 @@
1// Copyright 2014 Dolphin Emulator Project 1// SPDX-FileCopyrightText: 2014 Dolphin Emulator Project
2// Licensed under GPLv2+ 2// SPDX-License-Identifier: GPL-2.0-or-later
3// Refer to the license.txt file included.
4 3
5#include <fmt/format.h> 4#include <fmt/format.h>
6#include <libusb.h> 5#include <libusb.h>
@@ -91,7 +90,7 @@ GCAdapter::~GCAdapter() {
91 90
92void GCAdapter::AdapterInputThread(std::stop_token stop_token) { 91void GCAdapter::AdapterInputThread(std::stop_token stop_token) {
93 LOG_DEBUG(Input, "Input thread started"); 92 LOG_DEBUG(Input, "Input thread started");
94 Common::SetCurrentThreadName("yuzu:input:GCAdapter"); 93 Common::SetCurrentThreadName("GCAdapter");
95 s32 payload_size{}; 94 s32 payload_size{};
96 AdapterPayload adapter_payload{}; 95 AdapterPayload adapter_payload{};
97 96
@@ -215,7 +214,7 @@ void GCAdapter::UpdateStateAxes(std::size_t port, const AdapterPayload& adapter_
215} 214}
216 215
217void GCAdapter::AdapterScanThread(std::stop_token stop_token) { 216void GCAdapter::AdapterScanThread(std::stop_token stop_token) {
218 Common::SetCurrentThreadName("yuzu:input:ScanGCAdapter"); 217 Common::SetCurrentThreadName("ScanGCAdapter");
219 usb_adapter_handle = nullptr; 218 usb_adapter_handle = nullptr;
220 pads = {}; 219 pads = {};
221 while (!stop_token.stop_requested() && !Setup()) { 220 while (!stop_token.stop_requested() && !Setup()) {
@@ -524,4 +523,20 @@ Common::Input::ButtonNames GCAdapter::GetUIName(const Common::ParamPackage& para
524 return Common::Input::ButtonNames::Invalid; 523 return Common::Input::ButtonNames::Invalid;
525} 524}
526 525
526bool GCAdapter::IsStickInverted(const Common::ParamPackage& params) {
527 if (!params.Has("port")) {
528 return false;
529 }
530
531 const auto x_axis = static_cast<PadAxes>(params.Get("axis_x", 0));
532 const auto y_axis = static_cast<PadAxes>(params.Get("axis_y", 0));
533 if (x_axis != PadAxes::StickY && x_axis != PadAxes::SubstickY) {
534 return false;
535 }
536 if (y_axis != PadAxes::StickX && y_axis != PadAxes::SubstickX) {
537 return false;
538 }
539 return true;
540}
541
527} // namespace InputCommon 542} // namespace InputCommon