diff options
author | german77 <juangerman-13@hotmail.com> | 2021-04-25 18:45:42 +0200 |
---|---|---|
committer | german77 <juangerman-13@hotmail.com> | 2021-04-27 01:34:00 +0200 |
commit | 729545a9461a59e6e2b986db3aeb0346624ac8d8 (patch) | |
tree | 5ba3c39e9a2536457e1ee11f96cf92fbf6a8b97c /src/input_common | |
parent | Merge pull request #6246 from lioncash/shadow (diff) | |
download | yuzu-729545a9461a59e6e2b986db3aeb0346624ac8d8.tar yuzu-729545a9461a59e6e2b986db3aeb0346624ac8d8.tar.gz yuzu-729545a9461a59e6e2b986db3aeb0346624ac8d8.tar.bz2 yuzu-729545a9461a59e6e2b986db3aeb0346624ac8d8.tar.lz yuzu-729545a9461a59e6e2b986db3aeb0346624ac8d8.tar.xz yuzu-729545a9461a59e6e2b986db3aeb0346624ac8d8.tar.zst yuzu-729545a9461a59e6e2b986db3aeb0346624ac8d8.zip |
Diffstat (limited to 'src/input_common')
-rw-r--r-- | src/input_common/gcadapter/gc_adapter.cpp | 8 | ||||
-rw-r--r-- | src/input_common/gcadapter/gc_adapter.h | 1 |
2 files changed, 7 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() { diff --git a/src/input_common/gcadapter/gc_adapter.h b/src/input_common/gcadapter/gc_adapter.h index 7a6c545bd..e5de5e94f 100644 --- a/src/input_common/gcadapter/gc_adapter.h +++ b/src/input_common/gcadapter/gc_adapter.h @@ -70,6 +70,7 @@ struct GCController { PadButton last_button{}; std::array<s16, 6> axis_values{}; std::array<u8, 6> axis_origin{}; + u8 reset_origin_counter{}; }; class Adapter { |