Compare commits

...

1 Commits

Author SHA1 Message Date
german
328e6c1d27 Use vibration strength from settings 2020-10-01 18:16:59 -05:00
5 changed files with 13 additions and 2 deletions

View File

@@ -681,8 +681,9 @@ void Controller_NPad::VibrateController(const std::vector<u32>& controllers,
const auto& button_state = buttons[i];
if (button_state[A - BUTTON_HID_BEGIN]) {
if (button_state[A - BUTTON_HID_BEGIN]->SetRumblePlay(
vibrations[0].amp_high, vibrations[0].amp_low, vibrations[0].freq_high,
vibrations[0].freq_low)) {
vibrations[0].amp_high * Settings::values.vibration_strength,
vibrations[0].amp_low * Settings::values.vibration_strength,
vibrations[0].freq_high, vibrations[0].freq_low)) {
success = false;
}
}

View File

@@ -151,6 +151,7 @@ struct Values {
AnalogsRaw debug_pad_analogs;
bool vibration_enabled;
f32 vibration_strength;
bool motion_enabled;
std::string motion_device;

View File

@@ -254,6 +254,7 @@ void QtControllerSelectorDialog::ApplyConfiguration() {
OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode);
Settings::values.vibration_enabled = ui->vibrationGroup->isChecked();
Settings::values.vibration_strength = ui->vibrationSpin->value() * 0.01f;
}
void QtControllerSelectorDialog::LoadConfiguration() {
@@ -269,6 +270,7 @@ void QtControllerSelectorDialog::LoadConfiguration() {
UpdateDockedState(Settings::values.players[8].connected);
ui->vibrationGroup->setChecked(Settings::values.vibration_enabled);
ui->vibrationSpin->setValue(Settings::values.vibration_strength * 100);
}
void QtControllerSelectorDialog::CallConfigureInputDialog() {

View File

@@ -445,6 +445,8 @@ void Config::ReadControlValues() {
Settings::values.vibration_enabled =
ReadSetting(QStringLiteral("vibration_enabled"), true).toBool();
Settings::values.vibration_strength =
ReadSetting(QStringLiteral("vibration_strength"), 100).toInt() * 0.01f;
Settings::values.motion_enabled = ReadSetting(QStringLiteral("motion_enabled"), true).toBool();
Settings::values.use_docked_mode =
ReadSetting(QStringLiteral("use_docked_mode"), false).toBool();
@@ -1092,6 +1094,8 @@ void Config::SaveControlValues() {
SaveMotionTouchValues();
WriteSetting(QStringLiteral("vibration_enabled"), Settings::values.vibration_enabled, true);
WriteSetting(QStringLiteral("vibration_strength"), Settings::values.vibration_strength * 100,
true);
WriteSetting(QStringLiteral("motion_enabled"), Settings::values.motion_enabled, true);
WriteSetting(QStringLiteral("motion_device"),
QString::fromStdString(Settings::values.motion_device),

View File

@@ -176,6 +176,7 @@ void ConfigureInput::ApplyConfiguration() {
OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode);
Settings::values.vibration_enabled = ui->vibrationGroup->isChecked();
Settings::values.vibration_strength = ui->vibrationSpin->value() * 0.01f;
Settings::values.motion_enabled = ui->motionGroup->isChecked();
}
@@ -196,6 +197,7 @@ void ConfigureInput::LoadConfiguration() {
UpdateDockedState(Settings::values.players[8].connected);
ui->vibrationGroup->setChecked(Settings::values.vibration_enabled);
ui->vibrationSpin->setValue(Settings::values.vibration_strength * 100);
ui->motionGroup->setChecked(Settings::values.motion_enabled);
}
@@ -223,6 +225,7 @@ void ConfigureInput::RestoreDefaults() {
ui->radioDocked->setChecked(true);
ui->radioUndocked->setChecked(false);
ui->vibrationGroup->setChecked(true);
ui->vibrationSpin->setValue(100);
ui->motionGroup->setChecked(true);
}