diff options
| author | 2020-10-08 23:43:07 -0400 | |
|---|---|---|
| committer | 2020-11-15 23:33:20 -0500 | |
| commit | 652d6766d55acec6416dccb900a45c6660a86607 (patch) | |
| tree | 7f9c64b78ca02aa1f62de77e25fcacbb2fdc4291 | |
| parent | controllers/npad: Stop games from vibrating incorrect controllers (diff) | |
| download | yuzu-652d6766d55acec6416dccb900a45c6660a86607.tar.gz yuzu-652d6766d55acec6416dccb900a45c6660a86607.tar.xz yuzu-652d6766d55acec6416dccb900a45c6660a86607.zip | |
configure_input: Hook up the vibration percentage spinbox
This allows setting the vibration strength percentage anywhere from 1% to 100%.
Also hooks up the remaining motion button and checkbox in the Controller Applet.
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 3 | ||||
| -rw-r--r-- | src/core/settings.cpp | 1 | ||||
| -rw-r--r-- | src/core/settings.h | 1 | ||||
| -rw-r--r-- | src/yuzu/applets/controller.cpp | 4 | ||||
| -rw-r--r-- | src/yuzu/applets/controller.ui | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 4 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input.ui | 2 | ||||
| -rw-r--r-- | src/yuzu_cmd/config.cpp | 2 | ||||
| -rw-r--r-- | src/yuzu_cmd/default_ini.h | 7 | ||||
| -rw-r--r-- | src/yuzu_tester/config.cpp | 1 |
11 files changed, 26 insertions, 3 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index f865e3f5f..924f209c0 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp | |||
| @@ -703,7 +703,8 @@ void Controller_NPad::VibrateController(const std::vector<DeviceHandle>& vibrati | |||
| 703 | 703 | ||
| 704 | // TODO: Vibrate left/right vibration motors independently if possible. | 704 | // TODO: Vibrate left/right vibration motors independently if possible. |
| 705 | button_state[A - BUTTON_HID_BEGIN]->SetRumblePlay( | 705 | button_state[A - BUTTON_HID_BEGIN]->SetRumblePlay( |
| 706 | vibration_values[i].amp_high, vibration_values[i].amp_low, | 706 | vibration_values[i].amp_high * Settings::values.vibration_strength.GetValue() / 100, |
| 707 | vibration_values[i].amp_low * Settings::values.vibration_strength.GetValue() / 100, | ||
| 707 | vibration_values[i].freq_high, vibration_values[i].freq_low); | 708 | vibration_values[i].freq_high, vibration_values[i].freq_low); |
| 708 | 709 | ||
| 709 | latest_vibration_values[npad_index][device_index] = vibration_values[i]; | 710 | latest_vibration_values[npad_index][device_index] = vibration_values[i]; |
diff --git a/src/core/settings.cpp b/src/core/settings.cpp index aadbc3932..6e39aebb5 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp | |||
| @@ -150,6 +150,7 @@ void RestoreGlobalState() { | |||
| 150 | values.players.SetGlobal(true); | 150 | values.players.SetGlobal(true); |
| 151 | values.use_docked_mode.SetGlobal(true); | 151 | values.use_docked_mode.SetGlobal(true); |
| 152 | values.vibration_enabled.SetGlobal(true); | 152 | values.vibration_enabled.SetGlobal(true); |
| 153 | values.vibration_strength.SetGlobal(true); | ||
| 153 | values.motion_enabled.SetGlobal(true); | 154 | values.motion_enabled.SetGlobal(true); |
| 154 | } | 155 | } |
| 155 | 156 | ||
diff --git a/src/core/settings.h b/src/core/settings.h index edd2a00ca..496f47747 100644 --- a/src/core/settings.h +++ b/src/core/settings.h | |||
| @@ -170,6 +170,7 @@ struct Values { | |||
| 170 | Setting<bool> use_docked_mode; | 170 | Setting<bool> use_docked_mode; |
| 171 | 171 | ||
| 172 | Setting<bool> vibration_enabled; | 172 | Setting<bool> vibration_enabled; |
| 173 | Setting<int> vibration_strength; | ||
| 173 | 174 | ||
| 174 | Setting<bool> motion_enabled; | 175 | Setting<bool> motion_enabled; |
| 175 | std::string motion_device; | 176 | std::string motion_device; |
diff --git a/src/yuzu/applets/controller.cpp b/src/yuzu/applets/controller.cpp index 7697fe434..196b4f163 100644 --- a/src/yuzu/applets/controller.cpp +++ b/src/yuzu/applets/controller.cpp | |||
| @@ -266,6 +266,8 @@ void QtControllerSelectorDialog::ApplyConfiguration() { | |||
| 266 | OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue()); | 266 | OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue()); |
| 267 | 267 | ||
| 268 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); | 268 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); |
| 269 | Settings::values.vibration_strength.SetValue(ui->vibrationSpin->value()); | ||
| 270 | Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); | ||
| 269 | } | 271 | } |
| 270 | 272 | ||
| 271 | void QtControllerSelectorDialog::LoadConfiguration() { | 273 | void QtControllerSelectorDialog::LoadConfiguration() { |
| @@ -281,6 +283,8 @@ void QtControllerSelectorDialog::LoadConfiguration() { | |||
| 281 | UpdateDockedState(Settings::values.players.GetValue()[8].connected); | 283 | UpdateDockedState(Settings::values.players.GetValue()[8].connected); |
| 282 | 284 | ||
| 283 | ui->vibrationGroup->setChecked(Settings::values.vibration_enabled.GetValue()); | 285 | ui->vibrationGroup->setChecked(Settings::values.vibration_enabled.GetValue()); |
| 286 | ui->vibrationSpin->setValue(Settings::values.vibration_strength.GetValue()); | ||
| 287 | ui->motionGroup->setChecked(Settings::values.motion_enabled.GetValue()); | ||
| 284 | } | 288 | } |
| 285 | 289 | ||
| 286 | void QtControllerSelectorDialog::CallConfigureInputDialog() { | 290 | void QtControllerSelectorDialog::CallConfigureInputDialog() { |
diff --git a/src/yuzu/applets/controller.ui b/src/yuzu/applets/controller.ui index 2ab69a2d3..cc27b8ef4 100644 --- a/src/yuzu/applets/controller.ui +++ b/src/yuzu/applets/controller.ui | |||
| @@ -2349,7 +2349,7 @@ | |||
| 2349 | <number>1</number> | 2349 | <number>1</number> |
| 2350 | </property> | 2350 | </property> |
| 2351 | <property name="maximum"> | 2351 | <property name="maximum"> |
| 2352 | <number>200</number> | 2352 | <number>100</number> |
| 2353 | </property> | 2353 | </property> |
| 2354 | <property name="value"> | 2354 | <property name="value"> |
| 2355 | <number>100</number> | 2355 | <number>100</number> |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 296c58f58..820ef4098 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -493,6 +493,8 @@ void Config::ReadControlValues() { | |||
| 493 | ReadSettingGlobal(Settings::values.use_docked_mode, QStringLiteral("use_docked_mode"), false); | 493 | ReadSettingGlobal(Settings::values.use_docked_mode, QStringLiteral("use_docked_mode"), false); |
| 494 | ReadSettingGlobal(Settings::values.vibration_enabled, QStringLiteral("vibration_enabled"), | 494 | ReadSettingGlobal(Settings::values.vibration_enabled, QStringLiteral("vibration_enabled"), |
| 495 | true); | 495 | true); |
| 496 | ReadSettingGlobal(Settings::values.vibration_strength, QStringLiteral("vibration_strength"), | ||
| 497 | 100); | ||
| 496 | ReadSettingGlobal(Settings::values.motion_enabled, QStringLiteral("motion_enabled"), true); | 498 | ReadSettingGlobal(Settings::values.motion_enabled, QStringLiteral("motion_enabled"), true); |
| 497 | 499 | ||
| 498 | qt_config->endGroup(); | 500 | qt_config->endGroup(); |
| @@ -1150,6 +1152,8 @@ void Config::SaveControlValues() { | |||
| 1150 | WriteSettingGlobal(QStringLiteral("use_docked_mode"), Settings::values.use_docked_mode, false); | 1152 | WriteSettingGlobal(QStringLiteral("use_docked_mode"), Settings::values.use_docked_mode, false); |
| 1151 | WriteSettingGlobal(QStringLiteral("vibration_enabled"), Settings::values.vibration_enabled, | 1153 | WriteSettingGlobal(QStringLiteral("vibration_enabled"), Settings::values.vibration_enabled, |
| 1152 | true); | 1154 | true); |
| 1155 | WriteSettingGlobal(QStringLiteral("vibration_strength"), Settings::values.vibration_strength, | ||
| 1156 | 100); | ||
| 1153 | WriteSettingGlobal(QStringLiteral("motion_enabled"), Settings::values.motion_enabled, true); | 1157 | WriteSettingGlobal(QStringLiteral("motion_enabled"), Settings::values.motion_enabled, true); |
| 1154 | WriteSetting(QStringLiteral("motion_device"), | 1158 | WriteSetting(QStringLiteral("motion_device"), |
| 1155 | QString::fromStdString(Settings::values.motion_device), | 1159 | QString::fromStdString(Settings::values.motion_device), |
diff --git a/src/yuzu/configuration/configure_input.cpp b/src/yuzu/configuration/configure_input.cpp index 9a4de4c5d..84df547b9 100644 --- a/src/yuzu/configuration/configure_input.cpp +++ b/src/yuzu/configuration/configure_input.cpp | |||
| @@ -186,6 +186,7 @@ void ConfigureInput::ApplyConfiguration() { | |||
| 186 | OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue()); | 186 | OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue()); |
| 187 | 187 | ||
| 188 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); | 188 | Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); |
| 189 | Settings::values.vibration_strength.SetValue(ui->vibrationSpin->value()); | ||
| 189 | Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); | 190 | Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); |
| 190 | } | 191 | } |
| 191 | 192 | ||
| @@ -206,6 +207,7 @@ void ConfigureInput::LoadConfiguration() { | |||
| 206 | UpdateDockedState(Settings::values.players.GetValue()[8].connected); | 207 | UpdateDockedState(Settings::values.players.GetValue()[8].connected); |
| 207 | 208 | ||
| 208 | ui->vibrationGroup->setChecked(Settings::values.vibration_enabled.GetValue()); | 209 | ui->vibrationGroup->setChecked(Settings::values.vibration_enabled.GetValue()); |
| 210 | ui->vibrationSpin->setValue(Settings::values.vibration_strength.GetValue()); | ||
| 209 | ui->motionGroup->setChecked(Settings::values.motion_enabled.GetValue()); | 211 | ui->motionGroup->setChecked(Settings::values.motion_enabled.GetValue()); |
| 210 | } | 212 | } |
| 211 | 213 | ||
diff --git a/src/yuzu/configuration/configure_input.ui b/src/yuzu/configuration/configure_input.ui index b74481bda..cbd67d4c7 100644 --- a/src/yuzu/configuration/configure_input.ui +++ b/src/yuzu/configuration/configure_input.ui | |||
| @@ -215,7 +215,7 @@ | |||
| 215 | <number>1</number> | 215 | <number>1</number> |
| 216 | </property> | 216 | </property> |
| 217 | <property name="maximum"> | 217 | <property name="maximum"> |
| 218 | <number>200</number> | 218 | <number>100</number> |
| 219 | </property> | 219 | </property> |
| 220 | <property name="value"> | 220 | <property name="value"> |
| 221 | <number>100</number> | 221 | <number>100</number> |
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index feee02fcd..209350837 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.SetValue( | 291 | Settings::values.vibration_enabled.SetValue( |
| 292 | sdl2_config->GetBoolean("ControlsGeneral", "vibration_enabled", true)); | 292 | sdl2_config->GetBoolean("ControlsGeneral", "vibration_enabled", true)); |
| 293 | Settings::values.vibration_strength.SetValue( | ||
| 294 | sdl2_config->GetInteger("ControlsGeneral", "vibration_strength", 100)); | ||
| 293 | Settings::values.motion_enabled.SetValue( | 295 | Settings::values.motion_enabled.SetValue( |
| 294 | sdl2_config->GetBoolean("ControlsGeneral", "motion_enabled", true)); | 296 | sdl2_config->GetBoolean("ControlsGeneral", "motion_enabled", true)); |
| 295 | Settings::values.touchscreen.enabled = | 297 | Settings::values.touchscreen.enabled = |
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h index 796e27df4..53057c01c 100644 --- a/src/yuzu_cmd/default_ini.h +++ b/src/yuzu_cmd/default_ini.h | |||
| @@ -65,6 +65,13 @@ button_screenshot= | |||
| 65 | lstick= | 65 | lstick= |
| 66 | rstick= | 66 | rstick= |
| 67 | 67 | ||
| 68 | # Whether to enable or disable vibration | ||
| 69 | # 0: Disabled, 1 (default): Enabled | ||
| 70 | vibration_enabled= | ||
| 71 | |||
| 72 | # Vibration strength percentage (Default: 100) | ||
| 73 | vibration_strength= | ||
| 74 | |||
| 68 | # for motion input, the following devices are available: | 75 | # for motion input, the following devices are available: |
| 69 | # - "motion_emu" (default) for emulating motion input from mouse input. Required parameters: | 76 | # - "motion_emu" (default) for emulating motion input from mouse input. Required parameters: |
| 70 | # - "update_period": update period in milliseconds (default to 100) | 77 | # - "update_period": update period in milliseconds (default to 100) |
diff --git a/src/yuzu_tester/config.cpp b/src/yuzu_tester/config.cpp index 3a8a333f0..437302520 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.SetValue(true); | 78 | Settings::values.vibration_enabled.SetValue(true); |
| 79 | Settings::values.vibration_strength.SetValue(100); | ||
| 79 | Settings::values.motion_enabled.SetValue(true); | 80 | Settings::values.motion_enabled.SetValue(true); |
| 80 | Settings::values.touchscreen.enabled = ""; | 81 | Settings::values.touchscreen.enabled = ""; |
| 81 | Settings::values.touchscreen.device = ""; | 82 | Settings::values.touchscreen.device = ""; |