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.
This commit is contained in:
parent
797564599f
commit
5b6268d26a
|
@ -389,7 +389,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
|
||||||
// Try to read sixaxis sensor states
|
// Try to read sixaxis sensor states
|
||||||
std::array<MotionDevice, 2> motion_devices;
|
std::array<MotionDevice, 2> motion_devices;
|
||||||
|
|
||||||
if (sixaxis_sensors_enabled) {
|
if (sixaxis_sensors_enabled && Settings::values.motion_enabled) {
|
||||||
sixaxis_at_rest = true;
|
sixaxis_at_rest = true;
|
||||||
for (std::size_t e = 0; e < motion_devices.size(); ++e) {
|
for (std::size_t e = 0; e < motion_devices.size(); ++e) {
|
||||||
const auto& device = motions[i][e];
|
const auto& device = motions[i][e];
|
||||||
|
|
|
@ -152,6 +152,7 @@ struct Values {
|
||||||
|
|
||||||
bool vibration_enabled;
|
bool vibration_enabled;
|
||||||
|
|
||||||
|
bool motion_enabled;
|
||||||
std::string motion_device;
|
std::string motion_device;
|
||||||
std::string touch_device;
|
std::string touch_device;
|
||||||
TouchscreenInput touchscreen;
|
TouchscreenInput touchscreen;
|
||||||
|
|
|
@ -445,6 +445,7 @@ void Config::ReadControlValues() {
|
||||||
|
|
||||||
Settings::values.vibration_enabled =
|
Settings::values.vibration_enabled =
|
||||||
ReadSetting(QStringLiteral("vibration_enabled"), true).toBool();
|
ReadSetting(QStringLiteral("vibration_enabled"), true).toBool();
|
||||||
|
Settings::values.motion_enabled = ReadSetting(QStringLiteral("motion_enabled"), true).toBool();
|
||||||
Settings::values.use_docked_mode =
|
Settings::values.use_docked_mode =
|
||||||
ReadSetting(QStringLiteral("use_docked_mode"), false).toBool();
|
ReadSetting(QStringLiteral("use_docked_mode"), false).toBool();
|
||||||
|
|
||||||
|
@ -1091,6 +1092,7 @@ void Config::SaveControlValues() {
|
||||||
SaveMotionTouchValues();
|
SaveMotionTouchValues();
|
||||||
|
|
||||||
WriteSetting(QStringLiteral("vibration_enabled"), Settings::values.vibration_enabled, true);
|
WriteSetting(QStringLiteral("vibration_enabled"), Settings::values.vibration_enabled, true);
|
||||||
|
WriteSetting(QStringLiteral("motion_enabled"), Settings::values.motion_enabled, true);
|
||||||
WriteSetting(QStringLiteral("motion_device"),
|
WriteSetting(QStringLiteral("motion_device"),
|
||||||
QString::fromStdString(Settings::values.motion_device),
|
QString::fromStdString(Settings::values.motion_device),
|
||||||
QStringLiteral("engine:motion_emu,update_period:100,sensitivity:0.01"));
|
QStringLiteral("engine:motion_emu,update_period:100,sensitivity:0.01"));
|
||||||
|
|
|
@ -133,6 +133,10 @@ void ConfigureInput::Initialize(InputCommon::InputSubsystem* input_subsystem) {
|
||||||
CallConfigureDialog<ConfigureMotionTouch>(*this, input_subsystem);
|
CallConfigureDialog<ConfigureMotionTouch>(*this, input_subsystem);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(ui->motionButton, &QPushButton::clicked, [this, input_subsystem] {
|
||||||
|
CallConfigureDialog<ConfigureMotionTouch>(*this, input_subsystem);
|
||||||
|
});
|
||||||
|
|
||||||
connect(ui->buttonClearAll, &QPushButton::clicked, [this] { ClearAll(); });
|
connect(ui->buttonClearAll, &QPushButton::clicked, [this] { ClearAll(); });
|
||||||
connect(ui->buttonRestoreDefaults, &QPushButton::clicked, [this] { RestoreDefaults(); });
|
connect(ui->buttonRestoreDefaults, &QPushButton::clicked, [this] { RestoreDefaults(); });
|
||||||
|
|
||||||
|
@ -159,6 +163,7 @@ void ConfigureInput::ApplyConfiguration() {
|
||||||
OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode);
|
OnDockedModeChanged(pre_docked_mode, Settings::values.use_docked_mode);
|
||||||
|
|
||||||
Settings::values.vibration_enabled = ui->vibrationGroup->isChecked();
|
Settings::values.vibration_enabled = ui->vibrationGroup->isChecked();
|
||||||
|
Settings::values.motion_enabled = ui->motionGroup->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInput::changeEvent(QEvent* event) {
|
void ConfigureInput::changeEvent(QEvent* event) {
|
||||||
|
@ -179,6 +184,7 @@ void ConfigureInput::LoadConfiguration() {
|
||||||
Settings::ControllerType::Handheld);
|
Settings::ControllerType::Handheld);
|
||||||
|
|
||||||
ui->vibrationGroup->setChecked(Settings::values.vibration_enabled);
|
ui->vibrationGroup->setChecked(Settings::values.vibration_enabled);
|
||||||
|
ui->motionGroup->setChecked(Settings::values.motion_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInput::LoadPlayerControllerIndices() {
|
void ConfigureInput::LoadPlayerControllerIndices() {
|
||||||
|
@ -205,6 +211,7 @@ void ConfigureInput::RestoreDefaults() {
|
||||||
ui->radioDocked->setChecked(true);
|
ui->radioDocked->setChecked(true);
|
||||||
ui->radioUndocked->setChecked(false);
|
ui->radioUndocked->setChecked(false);
|
||||||
ui->vibrationGroup->setChecked(true);
|
ui->vibrationGroup->setChecked(true);
|
||||||
|
ui->motionGroup->setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInput::UpdateDockedState(bool is_handheld) {
|
void ConfigureInput::UpdateDockedState(bool is_handheld) {
|
||||||
|
|
|
@ -340,11 +340,6 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||||
motions_param[motion_id].Clear();
|
motions_param[motion_id].Clear();
|
||||||
motion_map[motion_id]->setText(tr("[not set]"));
|
motion_map[motion_id]->setText(tr("[not set]"));
|
||||||
});
|
});
|
||||||
context_menu.addAction(tr("Restore Default"), [&] {
|
|
||||||
motions_param[motion_id] = Common::ParamPackage{
|
|
||||||
InputCommon::GenerateKeyboardParam(Config::default_motions[motion_id])};
|
|
||||||
motion_map[motion_id]->setText(ButtonToText(motions_param[motion_id]));
|
|
||||||
});
|
|
||||||
context_menu.exec(motion_map[motion_id]->mapToGlobal(menu_location));
|
context_menu.exec(motion_map[motion_id]->mapToGlobal(menu_location));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -738,7 +733,11 @@ void ConfigureInputPlayer::UpdateMappingWithDefaults() {
|
||||||
void ConfigureInputPlayer::HandleClick(
|
void ConfigureInputPlayer::HandleClick(
|
||||||
QPushButton* button, std::function<void(const Common::ParamPackage&)> new_input_setter,
|
QPushButton* button, std::function<void(const Common::ParamPackage&)> new_input_setter,
|
||||||
InputCommon::Polling::DeviceType type) {
|
InputCommon::Polling::DeviceType type) {
|
||||||
button->setText(tr("[waiting]"));
|
if (button == ui->buttonMotionLeft || button == ui->buttonMotionRight) {
|
||||||
|
button->setText(tr("Shake!"));
|
||||||
|
} else {
|
||||||
|
button->setText(tr("[waiting]"));
|
||||||
|
}
|
||||||
button->setFocus();
|
button->setFocus();
|
||||||
|
|
||||||
// The first two input devices are always Any and Keyboard/Mouse. If the user filtered to a
|
// The first two input devices are always Any and Keyboard/Mouse. If the user filtered to a
|
||||||
|
|
|
@ -290,6 +290,8 @@ void Config::ReadValues() {
|
||||||
|
|
||||||
Settings::values.vibration_enabled =
|
Settings::values.vibration_enabled =
|
||||||
sdl2_config->GetBoolean("ControlsGeneral", "vibration_enabled", true);
|
sdl2_config->GetBoolean("ControlsGeneral", "vibration_enabled", true);
|
||||||
|
Settings::values.motion_enabled =
|
||||||
|
sdl2_config->GetBoolean("ControlsGeneral", "motion_enabled", true);
|
||||||
Settings::values.touchscreen.enabled =
|
Settings::values.touchscreen.enabled =
|
||||||
sdl2_config->GetBoolean("ControlsGeneral", "touch_enabled", true);
|
sdl2_config->GetBoolean("ControlsGeneral", "touch_enabled", true);
|
||||||
Settings::values.touchscreen.device =
|
Settings::values.touchscreen.device =
|
||||||
|
|
|
@ -76,6 +76,7 @@ void Config::ReadValues() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings::values.vibration_enabled = true;
|
Settings::values.vibration_enabled = true;
|
||||||
|
Settings::values.motion_enabled = true;
|
||||||
Settings::values.touchscreen.enabled = "";
|
Settings::values.touchscreen.enabled = "";
|
||||||
Settings::values.touchscreen.device = "";
|
Settings::values.touchscreen.device = "";
|
||||||
Settings::values.touchscreen.finger = 0;
|
Settings::values.touchscreen.finger = 0;
|
||||||
|
|
Loading…
Reference in New Issue