configure_input: Accommodate for the mouse input device engine
This commit is contained in:
parent
ad50209383
commit
b254d528bc
|
@ -694,6 +694,8 @@ void ConfigureInputPlayer::UpdateInputDeviceCombobox() {
|
||||||
const auto current_guid = button_param->Get("guid", "");
|
const auto current_guid = button_param->Get("guid", "");
|
||||||
const auto current_port = button_param->Get("port", "");
|
const auto current_port = button_param->Get("port", "");
|
||||||
|
|
||||||
|
const bool is_keyboard_mouse = current_engine == "keyboard" || current_engine == "mouse";
|
||||||
|
|
||||||
UpdateInputDevices();
|
UpdateInputDevices();
|
||||||
|
|
||||||
if (buttons_empty) {
|
if (buttons_empty) {
|
||||||
|
@ -702,13 +704,22 @@ void ConfigureInputPlayer::UpdateInputDeviceCombobox() {
|
||||||
|
|
||||||
const bool all_one_device =
|
const bool all_one_device =
|
||||||
std::all_of(buttons_param.begin(), buttons_param.end(),
|
std::all_of(buttons_param.begin(), buttons_param.end(),
|
||||||
[current_engine, current_guid, current_port](const Common::ParamPackage param) {
|
[current_engine, current_guid, current_port,
|
||||||
|
is_keyboard_mouse](const Common::ParamPackage param) {
|
||||||
|
if (is_keyboard_mouse) {
|
||||||
|
return !param.Has("engine") || param.Get("engine", "") == "keyboard" ||
|
||||||
|
param.Get("engine", "") == "mouse";
|
||||||
|
}
|
||||||
return !param.Has("engine") || (param.Get("engine", "") == current_engine &&
|
return !param.Has("engine") || (param.Get("engine", "") == current_engine &&
|
||||||
param.Get("guid", "") == current_guid &&
|
param.Get("guid", "") == current_guid &&
|
||||||
param.Get("port", "") == current_port);
|
param.Get("port", "") == current_port);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (all_one_device) {
|
if (all_one_device) {
|
||||||
|
if (is_keyboard_mouse) {
|
||||||
|
ui->comboDevices->setCurrentIndex(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const auto devices_it = std::find_if(
|
const auto devices_it = std::find_if(
|
||||||
input_devices.begin(), input_devices.end(),
|
input_devices.begin(), input_devices.end(),
|
||||||
[current_engine, current_guid, current_port](const Common::ParamPackage param) {
|
[current_engine, current_guid, current_port](const Common::ParamPackage param) {
|
||||||
|
@ -1073,6 +1084,11 @@ bool ConfigureInputPlayer::IsInputAcceptable(const Common::ParamPackage& params)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keyboard/Mouse
|
||||||
|
if (ui->comboDevices->currentIndex() == 1) {
|
||||||
|
return params.Get("engine", "") == "keyboard" || params.Get("engine", "") == "mouse";
|
||||||
|
}
|
||||||
|
|
||||||
const auto current_input_device = input_devices[ui->comboDevices->currentIndex()];
|
const auto current_input_device = input_devices[ui->comboDevices->currentIndex()];
|
||||||
return params.Get("engine", "") == current_input_device.Get("class", "") &&
|
return params.Get("engine", "") == current_input_device.Get("class", "") &&
|
||||||
params.Get("guid", "") == current_input_device.Get("guid", "") &&
|
params.Get("guid", "") == current_input_device.Get("guid", "") &&
|
||||||
|
|
|
@ -99,7 +99,7 @@ void ConfigureVibration::SetVibrationDevices(std::size_t player_index) {
|
||||||
const auto guid = param.Get("guid", "");
|
const auto guid = param.Get("guid", "");
|
||||||
const auto port = param.Get("port", "");
|
const auto port = param.Get("port", "");
|
||||||
|
|
||||||
if (engine.empty() || engine == "keyboard") {
|
if (engine.empty() || engine == "keyboard" || engine == "mouse") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue