From ebf19616f4698700738656ae09b0d9705566b9a1 Mon Sep 17 00:00:00 2001 From: german77 Date: Sun, 23 Jan 2022 21:54:33 -0600 Subject: input_common: Add option to configure gyro threshold --- src/yuzu/configuration/configure_input_player.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/yuzu/configuration/configure_input_player.cpp') 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(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)); }); } -- cgit v1.2.3