diff options
| author | 2020-07-04 00:40:48 -0400 | |
|---|---|---|
| committer | 2020-07-04 00:40:48 -0400 | |
| commit | d00972fce1fe5f2eb13c7e5d7e4e56036cb6bc91 (patch) | |
| tree | 3fd2a2bc5f6cc3ac29eef23759cc93d342152372 /src | |
| parent | Address lioncash feedback: Log formatting, extern const PadButtonArray, littl... (diff) | |
| download | yuzu-d00972fce1fe5f2eb13c7e5d7e4e56036cb6bc91.tar.gz yuzu-d00972fce1fe5f2eb13c7e5d7e4e56036cb6bc91.tar.xz yuzu-d00972fce1fe5f2eb13c7e5d7e4e56036cb6bc91.zip | |
Fix for always firing triggers on some controllers, trigger threshold more universal
Diffstat (limited to 'src')
| -rw-r--r-- | src/input_common/gcadapter/gc_adapter.cpp | 6 | ||||
| -rw-r--r-- | src/input_common/gcadapter/gc_adapter.h | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/input_common/gcadapter/gc_adapter.cpp b/src/input_common/gcadapter/gc_adapter.cpp index f58b0e11c..b39d2a3fb 100644 --- a/src/input_common/gcadapter/gc_adapter.cpp +++ b/src/input_common/gcadapter/gc_adapter.cpp | |||
| @@ -156,14 +156,12 @@ void Adapter::Read() { | |||
| 156 | pads[port].axis_value = pads[port].substick_y; | 156 | pads[port].axis_value = pads[port].substick_y; |
| 157 | pad_queue[port].Push(pads[port]); | 157 | pad_queue[port].Push(pads[port]); |
| 158 | } | 158 | } |
| 159 | if (pads[port].trigger_left > pads[port].TRIGGER_CENTER + pads[port].THRESHOLD || | 159 | if (pads[port].trigger_left > pads[port].TRIGGER_THRESHOLD) { |
| 160 | pads[port].trigger_left < pads[port].TRIGGER_CENTER - pads[port].THRESHOLD) { | ||
| 161 | pads[port].axis = GCAdapter::PadAxes::TriggerLeft; | 160 | pads[port].axis = GCAdapter::PadAxes::TriggerLeft; |
| 162 | pads[port].axis_value = pads[port].trigger_left; | 161 | pads[port].axis_value = pads[port].trigger_left; |
| 163 | pad_queue[port].Push(pads[port]); | 162 | pad_queue[port].Push(pads[port]); |
| 164 | } | 163 | } |
| 165 | if (pads[port].trigger_right > pads[port].TRIGGER_CENTER + pads[port].THRESHOLD || | 164 | if (pads[port].trigger_right > pads[port].TRIGGER_THRESHOLD) { |
| 166 | pads[port].trigger_right < pads[port].TRIGGER_CENTER - pads[port].THRESHOLD) { | ||
| 167 | pads[port].axis = GCAdapter::PadAxes::TriggerRight; | 165 | pads[port].axis = GCAdapter::PadAxes::TriggerRight; |
| 168 | pads[port].axis_value = pads[port].trigger_right; | 166 | pads[port].axis_value = pads[port].trigger_right; |
| 169 | pad_queue[port].Push(pads[port]); | 167 | pad_queue[port].Push(pads[port]); |
diff --git a/src/input_common/gcadapter/gc_adapter.h b/src/input_common/gcadapter/gc_adapter.h index 161d522ac..0ea6263eb 100644 --- a/src/input_common/gcadapter/gc_adapter.h +++ b/src/input_common/gcadapter/gc_adapter.h | |||
| @@ -63,9 +63,11 @@ struct GCPadStatus { | |||
| 63 | static constexpr u8 C_STICK_CENTER_X = 0x80; | 63 | static constexpr u8 C_STICK_CENTER_X = 0x80; |
| 64 | static constexpr u8 C_STICK_CENTER_Y = 0x80; | 64 | static constexpr u8 C_STICK_CENTER_Y = 0x80; |
| 65 | static constexpr u8 C_STICK_RADIUS = 0x7f; | 65 | static constexpr u8 C_STICK_RADIUS = 0x7f; |
| 66 | static constexpr u8 TRIGGER_CENTER = 20; | ||
| 67 | static constexpr u8 THRESHOLD = 10; | 66 | static constexpr u8 THRESHOLD = 10; |
| 68 | 67 | ||
| 68 | // 256/4, at least a quarter press to count as a press. For polling mostly | ||
| 69 | static constexpr u8 TRIGGER_THRESHOLD = 64; | ||
| 70 | |||
| 69 | u8 port{}; | 71 | u8 port{}; |
| 70 | PadAxes axis{PadAxes::Undefined}; | 72 | PadAxes axis{PadAxes::Undefined}; |
| 71 | u8 axis_value{255}; | 73 | u8 axis_value{255}; |