diff options
| author | german77 <juangerman-13@hotmail.com> | 2022-01-23 21:54:33 -0600 | 
|---|---|---|
| committer | german77 <juangerman-13@hotmail.com> | 2022-01-23 21:54:33 -0600 | 
| commit | ebf19616f4698700738656ae09b0d9705566b9a1 (patch) | |
| tree | bc7d846c3eb77831678b3308a2a238b3a995f2ab /src/yuzu/configuration | |
| parent | 2136ebccd65a27bc4aa64e5f9174abd994247641 (diff) | |
input_common: Add option to configure gyro threshold
Diffstat (limited to 'src/yuzu/configuration')
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 12 | 
1 files changed, 12 insertions, 0 deletions
| diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index d2132b408..365e97411 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp @@ -403,10 +403,22 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i          connect(button, &QPushButton::customContextMenuRequested,                  [=, this](const QPoint& menu_location) {                      QMenu context_menu; +                    Common::ParamPackage param = emulated_controller->GetMotionParam(motion_id);                      context_menu.addAction(tr("Clear"), [&] {                          emulated_controller->SetMotionParam(motion_id, {});                          motion_map[motion_id]->setText(tr("[not set]"));                      }); +                    if (param.Has("motion")) { +                        context_menu.addAction(tr("Set gyro threshold"), [&] { +                            const int gyro_threshold = +                                static_cast<int>(param.Get("threshold", 0.007f) * 1000.0f); +                            const int new_threshold = QInputDialog::getInt( +                                this, tr("Set threshold"), tr("Choose a value between 0% and 100%"), +                                gyro_threshold, 0, 100); +                            param.Set("threshold", new_threshold / 1000.0f); +                            emulated_controller->SetMotionParam(motion_id, param); +                        }); +                    }                      context_menu.exec(motion_map[motion_id]->mapToGlobal(menu_location));                  });      } | 
