diff options
author | bunnei <bunneidev@gmail.com> | 2021-04-30 21:02:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-30 21:02:05 +0200 |
commit | aab57b79754e268c142b8ad7c5db11affe0a4cca (patch) | |
tree | 57648315ad6f151b9c935ffbb1798ea58993c0c3 /src/input_common/gcadapter/gc_adapter.cpp | |
parent | Merge pull request #6226 from german77/sevensix (diff) | |
parent | input_common: Reset GC sticks center by measuring multiple packets (diff) | |
download | yuzu-aab57b79754e268c142b8ad7c5db11affe0a4cca.tar yuzu-aab57b79754e268c142b8ad7c5db11affe0a4cca.tar.gz yuzu-aab57b79754e268c142b8ad7c5db11affe0a4cca.tar.bz2 yuzu-aab57b79754e268c142b8ad7c5db11affe0a4cca.tar.lz yuzu-aab57b79754e268c142b8ad7c5db11affe0a4cca.tar.xz yuzu-aab57b79754e268c142b8ad7c5db11affe0a4cca.tar.zst yuzu-aab57b79754e268c142b8ad7c5db11affe0a4cca.zip |
Diffstat (limited to 'src/input_common/gcadapter/gc_adapter.cpp')
-rw-r--r-- | src/input_common/gcadapter/gc_adapter.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/input_common/gcadapter/gc_adapter.cpp b/src/input_common/gcadapter/gc_adapter.cpp index ec3167bea..320f51ee6 100644 --- a/src/input_common/gcadapter/gc_adapter.cpp +++ b/src/input_common/gcadapter/gc_adapter.cpp @@ -155,8 +155,12 @@ void Adapter::UpdateStateAxes(std::size_t port, const AdapterPayload& adapter_pa for (const PadAxes axis : axes) { const auto index = static_cast<std::size_t>(axis); const u8 axis_value = adapter_payload[offset + 3 + index]; - if (pads[port].axis_origin[index] == 255) { + if (pads[port].reset_origin_counter <= 18) { + if (pads[port].axis_origin[index] != axis_value) { + pads[port].reset_origin_counter = 0; + } pads[port].axis_origin[index] = axis_value; + pads[port].reset_origin_counter++; } pads[port].axis_values[index] = static_cast<s16>(axis_value - pads[port].axis_origin[index]); @@ -375,7 +379,7 @@ void Adapter::ResetDevice(std::size_t port) { pads[port].buttons = 0; pads[port].last_button = PadButton::Undefined; pads[port].axis_values.fill(0); - pads[port].axis_origin.fill(255); + pads[port].reset_origin_counter = 0; } void Adapter::Reset() { |