diff options
| author | 2020-09-05 09:42:01 -0400 | |
|---|---|---|
| committer | 2020-09-05 09:46:34 -0400 | |
| commit | 5b6268d26a178f8104c7075daf24df37147a202b (patch) | |
| tree | a869445ef861705679cfba39fdfabf418e2ccf80 /src | |
| parent | Minor cleanup (diff) | |
| download | yuzu-5b6268d26a178f8104c7075daf24df37147a202b.tar.gz yuzu-5b6268d26a178f8104c7075daf24df37147a202b.tar.xz yuzu-5b6268d26a178f8104c7075daf24df37147a202b.zip | |
configure_input: Hook up the motion button and checkbox
This allows toggling motion on or off, and allows access to the motion configuration.
Also changes the [waiting] text for motion buttons to Shake! as this is how motion is connected to a player.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 2 | ||||
| -rw-r--r-- | src/core/settings.h | 1 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input.cpp | 7 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.cpp | 11 | ||||
| -rw-r--r-- | src/yuzu_cmd/config.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu_tester/config.cpp | 1 |
7 files changed, 19 insertions, 7 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 510fa3071..b3b1a3a8a 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -389,7 +389,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* | |||
| 389 | // Try to read sixaxis sensor states | 389 | // Try to read sixaxis sensor states |
| 390 | std::array<MotionDevice, 2> motion_devices; | 390 | std::array<MotionDevice, 2> motion_devices; |
| 391 | 391 | ||
| 392 | if (sixaxis_sensors_enabled) { | 392 | if (sixaxis_sensors_enabled && Settings::values.motion_enabled) { |
| 393 | sixaxis_at_rest = true; | 393 | sixaxis_at_rest = true; |
| 394 | for (std::size_t e = 0; e < motion_devices.size(); ++e) { | 394 | for (std::size_t e = 0; e < motion_devices.size(); ++e) { |
| 395 | const auto& device = motions[i][e]; | 395 | const auto& device = motions[i][e]; |
diff --git a/src/core/settings.h b/src/core/settings.h index 80f0d95a7..9834f44bb 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -152,6 +152,7 @@ struct Values { | |||
| 152 | 152 | ||
| 153 | bool vibration_enabled; | 153 | bool vibration_enabled; |
| 154 | 154 | ||
| 155 | bool motion_enabled; | ||
| 155 | std::string motion_device; | 156 | std::string motion_device; |
| 156 | std::string touch_device; | 157 | std::string touch_device; |
| 157 | TouchscreenInput touchscreen; | 158 | TouchscreenInput touchscreen; |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 40ca42b75..d2913d613 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -445,6 +445,7 @@ void Config::ReadControlValues() { | |||
| 445 | 445 | ||
| 446 | Settings::values.vibration_enabled = | 446 | Settings::values.vibration_enabled = |
| 447 | ReadSetting(QStringLiteral("vibration_enabled"), true).toBool(); | 447 | ReadSetting(QStringLiteral("vibration_enabled"), true).toBool(); |
| 448 | Settings::values.motion_enabled = ReadSetting(QStringLiteral("motion_enabled"), true).toBool(); | ||
| 448 | Settings::values.use_docked_mode = | 449 | Settings::values.use_docked_mode = |
| 449 | ReadSetting(QStringLiteral("use_docked_mode"), false).toBool(); | 450 | ReadSetting(QStringLiteral("use_docked_mode"), false).toBool(); |
| 450 | 451 | ||
| @@ -1091,6 +1092,7 @@ void Config::SaveControlValues() { | |||
| 1091 | SaveMotionTouchValues(); | 1092 | SaveMotionTouchValues(); |
| 1092 | 1093 | ||
| 1093 | WriteSetting(QStringLiteral("vibration_enabled"), Settings::values.vibration_enabled, true); | 1094 | WriteSetting(QStringLiteral("vibration_enabled"), Settings::values.vibration_enabled, true); |
| 1095 | WriteSetting(QStringLiteral("motion_enabled"), Settings::values.motion_enabled, true); | ||
| 1094 | WriteSetting(QStringLiteral("motion_device"), | 1096 | WriteSetting(QStringLiteral("motion_device"), |
| 1095 | QString::fromStdString(Settings::values.motion_device), | 1097 | QString::fromStdString(Settings::values.motion_device), |
| 1096 | QStringLiteral("engine:motion_emu,update_period:100,sensitivity:0.01")); | 1098 | QStringLiteral("engine:motion_emu,update_period:100,sensitivity:0.01")); |
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp index ae3e31762..1c54355d1 100644 --- a/src/yuzu/configuration/configure_input.cpp +++ b/src/yuzu/configuration/configure_input.cpp | |||
| @@ -133,6 +133,10 @@ void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem) { | |||
| 133 | CallConfigureDialog<ConfigureMotionTouch>(*this, input_subsystem); | 133 | CallConfigureDialog<ConfigureMotionTouch>(*this, input_subsystem); |
| 134 | }); | 134 | }); |
| 135 | 135 | ||
| 136 | connect(ui->motionButton, &QPushButton::clicked, [this, input_subsystem] { | ||
| 137 | CallConfigureDialog<ConfigureMotionTouch>(*this, input_subsystem); | ||
| 138 | }); | ||
| 139 | |||
| 136 | connect(ui->buttonClearAll, &QPushButton::clicked, [this] { ClearAll(); }); | 140 | connect(ui->buttonClearAll, &QPushButton::clicked, [this] { ClearAll(); }); |
| 137 | connect(ui->buttonRestoreDefaults, &QPushButton::clicked, [this] { RestoreDefaults(); }); | 141 | connect(ui->buttonRestoreDefaults, &QPushButton::clicked, [this] { RestoreDefaults(); }); |
| 138 | 142 | ||
| @@ -159,6 +163,7 @@ void ConfigureInput::ApplyConfiguration() { | |||
| 159 | OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode); | 163 | OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode); |
| 160 | 164 | ||
| 161 | Settings::values.vibration_enabled = ui->vibrationGroup->isChecked(); | 165 | Settings::values.vibration_enabled = ui->vibrationGroup->isChecked(); |
| 166 | Settings::values.motion_enabled = ui->motionGroup->isChecked(); | ||
| 162 | } | 167 | } |
| 163 | 168 | ||
| 164 | void ConfigureInput::changeEvent(QEvent* event) { | 169 | void ConfigureInput::changeEvent(QEvent* event) { |
| @@ -179,6 +184,7 @@ void ConfigureInput::LoadConfiguration() { | |||
| 179 | Settings::ControllerType::Handheld); | 184 | Settings::ControllerType::Handheld); |
| 180 | 185 | ||
| 181 | ui->vibrationGroup->setChecked(Settings::values.vibration_enabled); | 186 | ui->vibrationGroup->setChecked(Settings::values.vibration_enabled); |
| 187 | ui->motionGroup->setChecked(Settings::values.motion_enabled); | ||
| 182 | } | 188 | } |
| 183 | 189 | ||
| 184 | void ConfigureInput::LoadPlayerControllerIndices() { | 190 | void ConfigureInput::LoadPlayerControllerIndices() { |
| @@ -205,6 +211,7 @@ void ConfigureInput::RestoreDefaults() { | |||
| 205 | ui->radioDocked->setChecked(true); | 211 | ui->radioDocked->setChecked(true); |
| 206 | ui->radioUndocked->setChecked(false); | 212 | ui->radioUndocked->setChecked(false); |
| 207 | ui->vibrationGroup->setChecked(true); | 213 | ui->vibrationGroup->setChecked(true); |
| 214 | ui->motionGroup->setChecked(true); | ||
| 208 | } | 215 | } |
| 209 | 216 | ||
| 210 | void ConfigureInput::UpdateDockedState(bool is_handheld) { | 217 | void ConfigureInput::UpdateDockedState(bool is_handheld) { |
diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index 55ea7ccde..9d7f23459 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp | |||
| @@ -340,11 +340,6 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i | |||
| 340 | motions_param[motion_id].Clear(); | 340 | motions_param[motion_id].Clear(); |
| 341 | motion_map[motion_id]->setText(tr("[not set]")); | 341 | motion_map[motion_id]->setText(tr("[not set]")); |
| 342 | }); | 342 | }); |
| 343 | context_menu.addAction(tr("Restore Default"), [&] { | ||
| 344 | motions_param[motion_id] = Common::ParamPackage{ | ||
| 345 | InputCommon::GenerateKeyboardParam(Config::default_motions[motion_id])}; | ||
| 346 | motion_map[motion_id]->setText(ButtonToText(motions_param[motion_id])); | ||
| 347 | }); | ||
| 348 | context_menu.exec(motion_map[motion_id]->mapToGlobal(menu_location)); | 343 | context_menu.exec(motion_map[motion_id]->mapToGlobal(menu_location)); |
| 349 | }); | 344 | }); |
| 350 | } | 345 | } |
| @@ -738,7 +733,11 @@ void ConfigureInputPlayer::UpdateMappingWithDefaults() { | |||
| 738 | void ConfigureInputPlayer::HandleClick( | 733 | void ConfigureInputPlayer::HandleClick( |
| 739 | QPushButton* button, std::function<void(const Common::ParamPackage&)> new_input_setter, | 734 | QPushButton* button, std::function<void(const Common::ParamPackage&)> new_input_setter, |
| 740 | InputCommon::Polling::DeviceType type) { | 735 | InputCommon::Polling::DeviceType type) { |
| 741 | button->setText(tr("[waiting]")); | 736 | if (button == ui->buttonMotionLeft || button == ui->buttonMotionRight) { |
| 737 | button->setText(tr("Shake!")); | ||
| 738 | } else { | ||
| 739 | button->setText(tr("[waiting]")); | ||
| 740 | } | ||
| 742 | button->setFocus(); | 741 | button->setFocus(); |
| 743 | 742 | ||
| 744 | // The first two input devices are always Any and Keyboard/Mouse. If the user filtered to a | 743 | // The first two input devices are always Any and Keyboard/Mouse. If the user filtered to a |
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index e9f1c6500..23448e747 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp | |||
| @@ -290,6 +290,8 @@ void Config::ReadValues() { | |||
| 290 | 290 | ||
| 291 | Settings::values.vibration_enabled = | 291 | Settings::values.vibration_enabled = |
| 292 | sdl2_config->GetBoolean("ControlsGeneral", "vibration_enabled", true); | 292 | sdl2_config->GetBoolean("ControlsGeneral", "vibration_enabled", true); |
| 293 | Settings::values.motion_enabled = | ||
| 294 | sdl2_config->GetBoolean("ControlsGeneral", "motion_enabled", true); | ||
| 293 | Settings::values.touchscreen.enabled = | 295 | Settings::values.touchscreen.enabled = |
| 294 | sdl2_config->GetBoolean("ControlsGeneral", "touch_enabled", true); | 296 | sdl2_config->GetBoolean("ControlsGeneral", "touch_enabled", true); |
| 295 | Settings::values.touchscreen.device = | 297 | Settings::values.touchscreen.device = |
diff --git a/src/yuzu_tester/config.cpp b/src/yuzu_tester/config.cpp index aaf59129a..bc273fb51 100644 --- a/src/yuzu_tester/config.cpp +++ b/src/yuzu_tester/config.cpp | |||
| @@ -76,6 +76,7 @@ void Config::ReadValues() { | |||
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | Settings::values.vibration_enabled = true; | 78 | Settings::values.vibration_enabled = true; |
| 79 | Settings::values.motion_enabled = true; | ||
| 79 | Settings::values.touchscreen.enabled = ""; | 80 | Settings::values.touchscreen.enabled = ""; |
| 80 | Settings::values.touchscreen.device = ""; | 81 | Settings::values.touchscreen.device = ""; |
| 81 | Settings::values.touchscreen.finger = 0; | 82 | Settings::values.touchscreen.finger = 0; |