diff options
| author | 2019-10-14 13:04:49 -0400 | |
|---|---|---|
| committer | 2019-10-14 13:04:49 -0400 | |
| commit | c274fd588dfcb3c9068e00e260e85aaa72ed4216 (patch) | |
| tree | 28f6efaf4f6e4639812e1537d37e6d5f7d2d40da | |
| parent | Merge pull request #2930 from DarkLordZach/gamecard-partitions (diff) | |
| parent | fixed clang format & addressed feedback (diff) | |
| download | yuzu-c274fd588dfcb3c9068e00e260e85aaa72ed4216.tar.gz yuzu-c274fd588dfcb3c9068e00e260e85aaa72ed4216.tar.xz yuzu-c274fd588dfcb3c9068e00e260e85aaa72ed4216.zip | |
Merge pull request #2968 from FreddyFunk/fix-zl-zr-analog-triggers
yuzu/configure_input_player: Fix input handling for ZL and ZR from controllers with analog triggers
Diffstat (limited to '')
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index a968cfb5d..67c9a7c6d 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp | |||
| @@ -245,10 +245,24 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i | |||
| 245 | 245 | ||
| 246 | button->setContextMenuPolicy(Qt::CustomContextMenu); | 246 | button->setContextMenuPolicy(Qt::CustomContextMenu); |
| 247 | connect(button, &QPushButton::clicked, [=] { | 247 | connect(button, &QPushButton::clicked, [=] { |
| 248 | HandleClick( | 248 | HandleClick(button_map[button_id], |
| 249 | button_map[button_id], | 249 | [=](Common::ParamPackage params) { |
| 250 | [=](const Common::ParamPackage& params) { buttons_param[button_id] = params; }, | 250 | // Workaround for ZL & ZR for analog triggers like on XBOX controllors. |
| 251 | InputCommon::Polling::DeviceType::Button); | 251 | // Analog triggers (from controllers like the XBOX controller) would not |
| 252 | // work due to a different range of their signals (from 0 to 255 on | ||
| 253 | // analog triggers instead of -32768 to 32768 on analog joysticks). The | ||
| 254 | // SDL driver misinterprets analog triggers as analog joysticks. | ||
| 255 | // TODO: reinterpret the signal range for analog triggers to map the | ||
| 256 | // values correctly. This is required for the correct emulation of the | ||
| 257 | // analog triggers of the GameCube controller. | ||
| 258 | if (button_id == Settings::NativeButton::ZL || | ||
| 259 | button_id == Settings::NativeButton::ZR) { | ||
| 260 | params.Set("direction", "+"); | ||
| 261 | params.Set("threshold", "0.5"); | ||
| 262 | } | ||
| 263 | buttons_param[button_id] = std::move(params); | ||
| 264 | }, | ||
| 265 | InputCommon::Polling::DeviceType::Button); | ||
| 252 | }); | 266 | }); |
| 253 | connect(button, &QPushButton::customContextMenuRequested, [=](const QPoint& menu_location) { | 267 | connect(button, &QPushButton::customContextMenuRequested, [=](const QPoint& menu_location) { |
| 254 | QMenu context_menu; | 268 | QMenu context_menu; |