diff options
| author | 2022-09-09 21:53:53 -0700 | |
|---|---|---|
| committer | 2022-09-09 21:53:53 -0700 | |
| commit | 16080b6e4e28b49e0e320879ebbab34199fb81c2 (patch) | |
| tree | e9adadbf420f68f4325542d1c1e2a90bf4fdfcd0 /src/core/hid/emulated_controller.cpp | |
| parent | Merge pull request #8864 from german77/toggle_analog (diff) | |
| parent | core: hid: Fix GC triggers overwritting ZL and ZR buttons (diff) | |
| download | yuzu-16080b6e4e28b49e0e320879ebbab34199fb81c2.tar.gz yuzu-16080b6e4e28b49e0e320879ebbab34199fb81c2.tar.xz yuzu-16080b6e4e28b49e0e320879ebbab34199fb81c2.zip | |
Merge pull request #8863 from german77/triggers
core: hid: Fix GC triggers overwriting ZL and ZR buttons
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
| -rw-r--r-- | src/core/hid/emulated_controller.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index f9f902c2d..01c43be93 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp | |||
| @@ -562,6 +562,16 @@ void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback | |||
| 562 | return; | 562 | return; |
| 563 | } | 563 | } |
| 564 | 564 | ||
| 565 | // GC controllers have triggers not buttons | ||
| 566 | if (npad_type == NpadStyleIndex::GameCube) { | ||
| 567 | if (index == Settings::NativeButton::ZR) { | ||
| 568 | return; | ||
| 569 | } | ||
| 570 | if (index == Settings::NativeButton::ZL) { | ||
| 571 | return; | ||
| 572 | } | ||
| 573 | } | ||
| 574 | |||
| 565 | switch (index) { | 575 | switch (index) { |
| 566 | case Settings::NativeButton::A: | 576 | case Settings::NativeButton::A: |
| 567 | controller.npad_button_state.a.Assign(current_status.value); | 577 | controller.npad_button_state.a.Assign(current_status.value); |
| @@ -738,6 +748,11 @@ void EmulatedController::SetTrigger(const Common::Input::CallbackStatus& callbac | |||
| 738 | return; | 748 | return; |
| 739 | } | 749 | } |
| 740 | 750 | ||
| 751 | // Only GC controllers have analog triggers | ||
| 752 | if (npad_type != NpadStyleIndex::GameCube) { | ||
| 753 | return; | ||
| 754 | } | ||
| 755 | |||
| 741 | const auto& trigger = controller.trigger_values[index]; | 756 | const auto& trigger = controller.trigger_values[index]; |
| 742 | 757 | ||
| 743 | switch (index) { | 758 | switch (index) { |