diff options
author | Morph <39850852+Morph1984@users.noreply.github.com> | 2020-10-09 05:43:07 +0200 |
---|---|---|
committer | Morph <39850852+Morph1984@users.noreply.github.com> | 2020-11-16 05:33:20 +0100 |
commit | 652d6766d55acec6416dccb900a45c6660a86607 (patch) | |
tree | 7f9c64b78ca02aa1f62de77e25fcacbb2fdc4291 | |
parent | controllers/npad: Stop games from vibrating incorrect controllers (diff) | |
download | yuzu-652d6766d55acec6416dccb900a45c6660a86607.tar yuzu-652d6766d55acec6416dccb900a45c6660a86607.tar.gz yuzu-652d6766d55acec6416dccb900a45c6660a86607.tar.bz2 yuzu-652d6766d55acec6416dccb900a45c6660a86607.tar.lz yuzu-652d6766d55acec6416dccb900a45c6660a86607.tar.xz yuzu-652d6766d55acec6416dccb900a45c6660a86607.tar.zst yuzu-652d6766d55acec6416dccb900a45c6660a86607.zip |
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 // TODO: Vibrate left/right vibration motors independently if possible. button_state[A - BUTTON_HID_BEGIN]->SetRumblePlay( - vibration_values[i].amp_high, vibration_values[i].amp_low, + vibration_values[i].amp_high * Settings::values.vibration_strength.GetValue() / 100, + vibration_values[i].amp_low * Settings::values.vibration_strength.GetValue() / 100, vibration_values[i].freq_high, vibration_values[i].freq_low); 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() { values.players.SetGlobal(true); values.use_docked_mode.SetGlobal(true); values.vibration_enabled.SetGlobal(true); + values.vibration_strength.SetGlobal(true); values.motion_enabled.SetGlobal(true); } 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 { Setting<bool> use_docked_mode; Setting<bool> vibration_enabled; + Setting<int> vibration_strength; Setting<bool> motion_enabled; 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() { OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue()); Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); + Settings::values.vibration_strength.SetValue(ui->vibrationSpin->value()); + Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); } void QtControllerSelectorDialog::LoadConfiguration() { @@ -281,6 +283,8 @@ void QtControllerSelectorDialog::LoadConfiguration() { UpdateDockedState(Settings::values.players.GetValue()[8].connected); ui->vibrationGroup->setChecked(Settings::values.vibration_enabled.GetValue()); + ui->vibrationSpin->setValue(Settings::values.vibration_strength.GetValue()); + ui->motionGroup->setChecked(Settings::values.motion_enabled.GetValue()); } 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 @@ <number>1</number> </property> <property name="maximum"> - <number>200</number> + <number>100</number> </property> <property name="value"> <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() { ReadSettingGlobal(Settings::values.use_docked_mode, QStringLiteral("use_docked_mode"), false); ReadSettingGlobal(Settings::values.vibration_enabled, QStringLiteral("vibration_enabled"), true); + ReadSettingGlobal(Settings::values.vibration_strength, QStringLiteral("vibration_strength"), + 100); ReadSettingGlobal(Settings::values.motion_enabled, QStringLiteral("motion_enabled"), true); qt_config->endGroup(); @@ -1150,6 +1152,8 @@ void Config::SaveControlValues() { WriteSettingGlobal(QStringLiteral("use_docked_mode"), Settings::values.use_docked_mode, false); WriteSettingGlobal(QStringLiteral("vibration_enabled"), Settings::values.vibration_enabled, true); + WriteSettingGlobal(QStringLiteral("vibration_strength"), Settings::values.vibration_strength, + 100); WriteSettingGlobal(QStringLiteral("motion_enabled"), Settings::values.motion_enabled, true); WriteSetting(QStringLiteral("motion_device"), 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() { OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode.GetValue()); Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked()); + Settings::values.vibration_strength.SetValue(ui->vibrationSpin->value()); Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked()); } @@ -206,6 +207,7 @@ void ConfigureInput::LoadConfiguration() { UpdateDockedState(Settings::values.players.GetValue()[8].connected); ui->vibrationGroup->setChecked(Settings::values.vibration_enabled.GetValue()); + ui->vibrationSpin->setValue(Settings::values.vibration_strength.GetValue()); ui->motionGroup->setChecked(Settings::values.motion_enabled.GetValue()); } 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 @@ <number>1</number> </property> <property name="maximum"> - <number>200</number> + <number>100</number> </property> <property name="value"> <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() { Settings::values.vibration_enabled.SetValue( sdl2_config->GetBoolean("ControlsGeneral", "vibration_enabled", true)); + Settings::values.vibration_strength.SetValue( + sdl2_config->GetInteger("ControlsGeneral", "vibration_strength", 100)); Settings::values.motion_enabled.SetValue( sdl2_config->GetBoolean("ControlsGeneral", "motion_enabled", true)); 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= lstick= rstick= +# Whether to enable or disable vibration +# 0: Disabled, 1 (default): Enabled +vibration_enabled= + +# Vibration strength percentage (Default: 100) +vibration_strength= + # for motion input, the following devices are available: # - "motion_emu" (default) for emulating motion input from mouse input. Required parameters: # - "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() { } Settings::values.vibration_enabled.SetValue(true); + Settings::values.vibration_strength.SetValue(100); Settings::values.motion_enabled.SetValue(true); Settings::values.touchscreen.enabled = ""; Settings::values.touchscreen.device = ""; |