mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
settings: Fix mouse and keyboard mappings
This commit is contained in:
parent
cc651c7c99
commit
464c4d26ac
10 changed files with 100 additions and 103 deletions
|
@ -246,7 +246,7 @@ std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices() const {
|
||||||
devices.begin(), devices.end(), [param](const Common::ParamPackage param_) {
|
devices.begin(), devices.end(), [param](const Common::ParamPackage param_) {
|
||||||
return param.Get("engine", "") == param_.Get("engine", "") &&
|
return param.Get("engine", "") == param_.Get("engine", "") &&
|
||||||
param.Get("guid", "") == param_.Get("guid", "") &&
|
param.Get("guid", "") == param_.Get("guid", "") &&
|
||||||
param.Get("port", "") == param_.Get("port", "");
|
param.Get("port", 0) == param_.Get("port", 0);
|
||||||
});
|
});
|
||||||
if (devices_it != devices.end()) {
|
if (devices_it != devices.end()) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -254,7 +254,7 @@ std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices() const {
|
||||||
Common::ParamPackage device{};
|
Common::ParamPackage device{};
|
||||||
device.Set("engine", param.Get("engine", ""));
|
device.Set("engine", param.Get("engine", ""));
|
||||||
device.Set("guid", param.Get("guid", ""));
|
device.Set("guid", param.Get("guid", ""));
|
||||||
device.Set("port", param.Get("port", ""));
|
device.Set("port", param.Get("port", 0));
|
||||||
devices.push_back(device);
|
devices.push_back(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices() const {
|
||||||
devices.begin(), devices.end(), [param](const Common::ParamPackage param_) {
|
devices.begin(), devices.end(), [param](const Common::ParamPackage param_) {
|
||||||
return param.Get("engine", "") == param_.Get("engine", "") &&
|
return param.Get("engine", "") == param_.Get("engine", "") &&
|
||||||
param.Get("guid", "") == param_.Get("guid", "") &&
|
param.Get("guid", "") == param_.Get("guid", "") &&
|
||||||
param.Get("port", "") == param_.Get("port", "");
|
param.Get("port", 0) == param_.Get("port", 0);
|
||||||
});
|
});
|
||||||
if (devices_it != devices.end()) {
|
if (devices_it != devices.end()) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -277,7 +277,7 @@ std::vector<Common::ParamPackage> EmulatedController::GetMappedDevices() const {
|
||||||
Common::ParamPackage device{};
|
Common::ParamPackage device{};
|
||||||
device.Set("engine", param.Get("engine", ""));
|
device.Set("engine", param.Get("engine", ""));
|
||||||
device.Set("guid", param.Get("guid", ""));
|
device.Set("guid", param.Get("guid", ""));
|
||||||
device.Set("port", param.Get("port", ""));
|
device.Set("port", param.Get("port", 0));
|
||||||
devices.push_back(device);
|
devices.push_back(device);
|
||||||
}
|
}
|
||||||
return devices;
|
return devices;
|
||||||
|
|
|
@ -162,17 +162,22 @@ void EmulatedDevices::SetKeyboardButton(Input::CallbackStatus callback, std::siz
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(german77): Do this properly
|
UpdateKey(index, current_status.value);
|
||||||
// switch (index) {
|
|
||||||
// case Settings::NativeKeyboard::A:
|
|
||||||
// interface_status.keyboard_state.a.Assign(current_status.value);
|
|
||||||
// break;
|
|
||||||
// ....
|
|
||||||
// }
|
|
||||||
|
|
||||||
TriggerOnChange(DeviceTriggerType::Keyboard);
|
TriggerOnChange(DeviceTriggerType::Keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EmulatedDevices::UpdateKey(std::size_t key_index, bool status) {
|
||||||
|
constexpr u8 KEYS_PER_BYTE = 8;
|
||||||
|
auto& entry = device_status.keyboard_state.key[key_index / KEYS_PER_BYTE];
|
||||||
|
const u8 mask = 1 << (key_index % KEYS_PER_BYTE);
|
||||||
|
if (status) {
|
||||||
|
entry = entry | mask;
|
||||||
|
} else {
|
||||||
|
entry = entry & ~mask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void EmulatedDevices::SetKeyboardModifier(Input::CallbackStatus callback, std::size_t index) {
|
void EmulatedDevices::SetKeyboardModifier(Input::CallbackStatus callback, std::size_t index) {
|
||||||
if (index >= device_status.keyboard_moddifier_values.size()) {
|
if (index >= device_status.keyboard_moddifier_values.size()) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -143,6 +143,9 @@ public:
|
||||||
void DeleteCallback(int key);
|
void DeleteCallback(int key);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/// Helps assigning a value to keyboard_state
|
||||||
|
void UpdateKey(std::size_t key_index, bool status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the touch status of the console
|
* Updates the touch status of the console
|
||||||
* @param callback: A CallbackStatus containing the key status
|
* @param callback: A CallbackStatus containing the key status
|
||||||
|
|
|
@ -121,12 +121,27 @@ void Mouse::StopPanning() {
|
||||||
std::vector<Common::ParamPackage> Mouse::GetInputDevices() const {
|
std::vector<Common::ParamPackage> Mouse::GetInputDevices() const {
|
||||||
std::vector<Common::ParamPackage> devices;
|
std::vector<Common::ParamPackage> devices;
|
||||||
devices.emplace_back(Common::ParamPackage{
|
devices.emplace_back(Common::ParamPackage{
|
||||||
{"engine", "keyboard"},
|
{"engine", GetEngineName()},
|
||||||
{"display", "Keyboard/Mouse"},
|
{"display", "Keyboard/Mouse"},
|
||||||
});
|
});
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AnalogMapping Mouse::GetAnalogMappingForDevice(
|
||||||
|
[[maybe_unused]] const Common::ParamPackage& params) {
|
||||||
|
// Only overwrite different buttons from default
|
||||||
|
AnalogMapping mapping = {};
|
||||||
|
Common::ParamPackage right_analog_params;
|
||||||
|
right_analog_params.Set("engine", GetEngineName());
|
||||||
|
right_analog_params.Set("axis_x", 0);
|
||||||
|
right_analog_params.Set("axis_y", 1);
|
||||||
|
right_analog_params.Set("threshold", 0.5f);
|
||||||
|
right_analog_params.Set("range", 1.0f);
|
||||||
|
right_analog_params.Set("deadzone", 0.0f);
|
||||||
|
mapping.insert_or_assign(Settings::NativeAnalog::RStick, std::move(right_analog_params));
|
||||||
|
return mapping;
|
||||||
|
}
|
||||||
|
|
||||||
std::string Mouse::GetUIName(const Common::ParamPackage& params) const {
|
std::string Mouse::GetUIName(const Common::ParamPackage& params) const {
|
||||||
if (params.Has("button")) {
|
if (params.Has("button")) {
|
||||||
return fmt::format("Mouse {}", params.Get("button", 0));
|
return fmt::format("Mouse {}", params.Get("button", 0));
|
||||||
|
|
|
@ -55,6 +55,7 @@ public:
|
||||||
void ReleaseAllButtons();
|
void ReleaseAllButtons();
|
||||||
|
|
||||||
std::vector<Common::ParamPackage> GetInputDevices() const override;
|
std::vector<Common::ParamPackage> GetInputDevices() const override;
|
||||||
|
AnalogMapping GetAnalogMappingForDevice(const Common::ParamPackage& params) override;
|
||||||
std::string GetUIName(const Common::ParamPackage& params) const override;
|
std::string GetUIName(const Common::ParamPackage& params) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -202,6 +202,8 @@ void InputEngine::TriggerOnButtonChange(const PadIdentifier& identifier, int but
|
||||||
if (!configuring || !mapping_callback.on_data) {
|
if (!configuring || !mapping_callback.on_data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PreSetButton(identifier, button);
|
||||||
if (value == GetButton(identifier, button)) {
|
if (value == GetButton(identifier, button)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,6 +143,9 @@ struct InputSubsystem::Impl {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const std::string engine = params.Get("engine", "");
|
const std::string engine = params.Get("engine", "");
|
||||||
|
if (engine == mouse->GetEngineName()) {
|
||||||
|
return mouse->GetAnalogMappingForDevice(params);
|
||||||
|
}
|
||||||
if (engine == gcadapter->GetEngineName()) {
|
if (engine == gcadapter->GetEngineName()) {
|
||||||
return gcadapter->GetAnalogMappingForDevice(params);
|
return gcadapter->GetAnalogMappingForDevice(params);
|
||||||
}
|
}
|
||||||
|
|
|
@ -478,37 +478,39 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
|
||||||
UpdateControllerEnabledButtons();
|
UpdateControllerEnabledButtons();
|
||||||
UpdateControllerButtonNames();
|
UpdateControllerButtonNames();
|
||||||
UpdateMotionButtons();
|
UpdateMotionButtons();
|
||||||
connect(ui->comboControllerType, qOverload<int>(&QComboBox::currentIndexChanged), [this, player_index](int) {
|
connect(ui->comboControllerType, qOverload<int>(&QComboBox::currentIndexChanged),
|
||||||
UpdateControllerAvailableButtons();
|
[this, player_index](int) {
|
||||||
UpdateControllerEnabledButtons();
|
UpdateControllerAvailableButtons();
|
||||||
UpdateControllerButtonNames();
|
UpdateControllerEnabledButtons();
|
||||||
UpdateMotionButtons();
|
UpdateControllerButtonNames();
|
||||||
const Core::HID::NpadType type = GetControllerTypeFromIndex(ui->comboControllerType->currentIndex());
|
UpdateMotionButtons();
|
||||||
|
const Core::HID::NpadType type =
|
||||||
|
GetControllerTypeFromIndex(ui->comboControllerType->currentIndex());
|
||||||
|
|
||||||
if (player_index == 0) {
|
if (player_index == 0) {
|
||||||
auto* emulated_controller_p1 =
|
auto* emulated_controller_p1 =
|
||||||
system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
|
system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1);
|
||||||
auto* emulated_controller_hanheld =
|
auto* emulated_controller_hanheld =
|
||||||
system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
|
||||||
bool is_connected = emulated_controller->IsConnected(true);
|
bool is_connected = emulated_controller->IsConnected(true);
|
||||||
|
|
||||||
emulated_controller_p1->SetNpadType(type);
|
emulated_controller_p1->SetNpadType(type);
|
||||||
emulated_controller_hanheld->SetNpadType(type);
|
emulated_controller_hanheld->SetNpadType(type);
|
||||||
if (is_connected) {
|
if (is_connected) {
|
||||||
if (type == Core::HID::NpadType::Handheld) {
|
if (type == Core::HID::NpadType::Handheld) {
|
||||||
emulated_controller_p1->Disconnect();
|
emulated_controller_p1->Disconnect();
|
||||||
emulated_controller_hanheld->Connect();
|
emulated_controller_hanheld->Connect();
|
||||||
emulated_controller = emulated_controller_hanheld;
|
emulated_controller = emulated_controller_hanheld;
|
||||||
} else {
|
} else {
|
||||||
emulated_controller_hanheld->Disconnect();
|
emulated_controller_hanheld->Disconnect();
|
||||||
emulated_controller_p1->Connect();
|
emulated_controller_p1->Connect();
|
||||||
emulated_controller = emulated_controller_p1;
|
emulated_controller = emulated_controller_p1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ui->controllerFrame->SetController(emulated_controller);
|
||||||
}
|
}
|
||||||
}
|
emulated_controller->SetNpadType(type);
|
||||||
ui->controllerFrame->SetController(emulated_controller);
|
});
|
||||||
}
|
|
||||||
emulated_controller->SetNpadType(type);
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(ui->comboDevices, qOverload<int>(&QComboBox::activated), this,
|
connect(ui->comboDevices, qOverload<int>(&QComboBox::activated), this,
|
||||||
&ConfigureInputPlayer::UpdateMappingWithDefaults);
|
&ConfigureInputPlayer::UpdateMappingWithDefaults);
|
||||||
|
@ -555,7 +557,7 @@ ConfigureInputPlayer::~ConfigureInputPlayer() {
|
||||||
} else {
|
} else {
|
||||||
emulated_controller->DisableConfiguration();
|
emulated_controller->DisableConfiguration();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
void ConfigureInputPlayer::ApplyConfiguration() {
|
void ConfigureInputPlayer::ApplyConfiguration() {
|
||||||
if (player_index == 0) {
|
if (player_index == 0) {
|
||||||
|
@ -642,7 +644,7 @@ void ConfigureInputPlayer::UpdateInputDeviceCombobox() {
|
||||||
|
|
||||||
const auto first_engine = devices[0].Get("engine", "");
|
const auto first_engine = devices[0].Get("engine", "");
|
||||||
const auto first_guid = devices[0].Get("guid", "");
|
const auto first_guid = devices[0].Get("guid", "");
|
||||||
const auto first_port = devices[0].Get("port", "");
|
const auto first_port = devices[0].Get("port", 0);
|
||||||
|
|
||||||
if (devices.size() == 1) {
|
if (devices.size() == 1) {
|
||||||
const auto devices_it =
|
const auto devices_it =
|
||||||
|
@ -650,7 +652,7 @@ void ConfigureInputPlayer::UpdateInputDeviceCombobox() {
|
||||||
[first_engine, first_guid, first_port](const Common::ParamPackage param) {
|
[first_engine, first_guid, first_port](const Common::ParamPackage param) {
|
||||||
return param.Get("engine", "") == first_engine &&
|
return param.Get("engine", "") == first_engine &&
|
||||||
param.Get("guid", "") == first_guid &&
|
param.Get("guid", "") == first_guid &&
|
||||||
param.Get("port", "") == first_port;
|
param.Get("port", 0) == first_port;
|
||||||
});
|
});
|
||||||
const int device_index =
|
const int device_index =
|
||||||
devices_it != input_devices.end()
|
devices_it != input_devices.end()
|
||||||
|
@ -662,7 +664,7 @@ void ConfigureInputPlayer::UpdateInputDeviceCombobox() {
|
||||||
|
|
||||||
const auto second_engine = devices[1].Get("engine", "");
|
const auto second_engine = devices[1].Get("engine", "");
|
||||||
const auto second_guid = devices[1].Get("guid", "");
|
const auto second_guid = devices[1].Get("guid", "");
|
||||||
const auto second_port = devices[1].Get("port", "");
|
const auto second_port = devices[1].Get("port", 0);
|
||||||
|
|
||||||
const bool is_keyboard_mouse = (first_engine == "keyboard" || first_engine == "mouse") &&
|
const bool is_keyboard_mouse = (first_engine == "keyboard" || first_engine == "mouse") &&
|
||||||
(second_engine == "keyboard" || second_engine == "mouse");
|
(second_engine == "keyboard" || second_engine == "mouse");
|
||||||
|
@ -684,7 +686,7 @@ void ConfigureInputPlayer::UpdateInputDeviceCombobox() {
|
||||||
param.Get("guid2", "") == second_guid) ||
|
param.Get("guid2", "") == second_guid) ||
|
||||||
(param.Get("guid", "") == second_guid && param.Get("guid2", "") == first_guid);
|
(param.Get("guid", "") == second_guid && param.Get("guid2", "") == first_guid);
|
||||||
return param.Get("engine", "") == first_engine && is_guid_valid &&
|
return param.Get("engine", "") == first_engine && is_guid_valid &&
|
||||||
param.Get("port", "") == first_port;
|
param.Get("port", 0) == first_port;
|
||||||
});
|
});
|
||||||
const int device_index =
|
const int device_index =
|
||||||
devices_it != input_devices.end()
|
devices_it != input_devices.end()
|
||||||
|
@ -1096,8 +1098,8 @@ void ConfigureInputPlayer::UpdateMappingWithDefaults() {
|
||||||
emulated_controller->SetMotionParam(motion_id, {});
|
emulated_controller->SetMotionParam(motion_id, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset keyboard bindings
|
// Reset keyboard or mouse bindings
|
||||||
if (ui->comboDevices->currentIndex() == 1) {
|
if (ui->comboDevices->currentIndex() == 1 || ui->comboDevices->currentIndex() == 2) {
|
||||||
for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; ++button_id) {
|
for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; ++button_id) {
|
||||||
emulated_controller->SetButtonParam(
|
emulated_controller->SetButtonParam(
|
||||||
button_id, Common::ParamPackage{InputCommon::GenerateKeyboardParam(
|
button_id, Common::ParamPackage{InputCommon::GenerateKeyboardParam(
|
||||||
|
@ -1122,63 +1124,30 @@ void ConfigureInputPlayer::UpdateMappingWithDefaults() {
|
||||||
Config::default_motions[motion_id])});
|
Config::default_motions[motion_id])});
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateUI();
|
// If mouse is selected we want to override with mappings from the driver
|
||||||
return;
|
if (ui->comboDevices->currentIndex() == 1) {
|
||||||
}
|
UpdateUI();
|
||||||
|
return;
|
||||||
// Reset keyboard with mouse bindings
|
|
||||||
if (ui->comboDevices->currentIndex() == 2) {
|
|
||||||
for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; ++button_id) {
|
|
||||||
emulated_controller->SetButtonParam(
|
|
||||||
button_id, Common::ParamPackage{InputCommon::GenerateKeyboardParam(
|
|
||||||
Config::default_buttons[button_id])});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::ParamPackage left_analog_param{};
|
|
||||||
for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; ++sub_button_id) {
|
|
||||||
Common::ParamPackage params{InputCommon::GenerateKeyboardParam(
|
|
||||||
Config::default_analogs[Settings::NativeAnalog::LStick][sub_button_id])};
|
|
||||||
SetAnalogParam(params, left_analog_param, analog_sub_buttons[sub_button_id]);
|
|
||||||
}
|
|
||||||
left_analog_param.Set("modifier",
|
|
||||||
InputCommon::GenerateKeyboardParam(
|
|
||||||
Config::default_stick_mod[Settings::NativeAnalog::LStick]));
|
|
||||||
emulated_controller->SetStickParam(Settings::NativeAnalog::LStick, left_analog_param);
|
|
||||||
|
|
||||||
Common::ParamPackage right_analog_param{};
|
|
||||||
right_analog_param.Set("engine", "mouse");
|
|
||||||
right_analog_param.Set("port", 0);
|
|
||||||
right_analog_param.Set("axis_x", 0);
|
|
||||||
right_analog_param.Set("axis_y", 1);
|
|
||||||
emulated_controller->SetStickParam(Settings::NativeAnalog::RStick,
|
|
||||||
std::move(right_analog_param));
|
|
||||||
|
|
||||||
for (int motion_id = 0; motion_id < Settings::NativeMotion::NumMotions; ++motion_id) {
|
|
||||||
emulated_controller->SetMotionParam(
|
|
||||||
motion_id, Common::ParamPackage{InputCommon::GenerateKeyboardParam(
|
|
||||||
Config::default_motions[motion_id])});
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateUI();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset controller bindings
|
// Reset controller bindings
|
||||||
const auto& device = input_devices[ui->comboDevices->currentIndex()];
|
const auto& device = input_devices[ui->comboDevices->currentIndex()];
|
||||||
auto button_mapping = input_subsystem->GetButtonMappingForDevice(device);
|
auto button_mappings = input_subsystem->GetButtonMappingForDevice(device);
|
||||||
auto analog_mapping = input_subsystem->GetAnalogMappingForDevice(device);
|
auto analog_mappings = input_subsystem->GetAnalogMappingForDevice(device);
|
||||||
auto motion_mapping = input_subsystem->GetMotionMappingForDevice(device);
|
auto motion_mappings = input_subsystem->GetMotionMappingForDevice(device);
|
||||||
for (std::size_t i = 0; i < button_mapping.size(); ++i) {
|
|
||||||
emulated_controller->SetButtonParam(
|
for (const auto& button_mapping : button_mappings) {
|
||||||
i, button_mapping[static_cast<Settings::NativeButton::Values>(i)]);
|
const std::size_t index = button_mapping.first;
|
||||||
|
emulated_controller->SetButtonParam(index, button_mapping.second);
|
||||||
}
|
}
|
||||||
for (std::size_t i = 0; i < analog_mapping.size(); ++i) {
|
for (const auto& analog_mapping : analog_mappings) {
|
||||||
emulated_controller->SetStickParam(
|
const std::size_t index = analog_mapping.first;
|
||||||
i, analog_mapping[static_cast<Settings::NativeAnalog::Values>(i)]);
|
emulated_controller->SetStickParam(index, analog_mapping.second);
|
||||||
}
|
}
|
||||||
for (std::size_t i = 0; i < motion_mapping.size(); ++i) {
|
for (const auto& motion_mapping : motion_mappings) {
|
||||||
emulated_controller->SetMotionParam(
|
const std::size_t index = motion_mapping.first;
|
||||||
i, motion_mapping[static_cast<Settings::NativeMotion::Values>(i)]);
|
emulated_controller->SetMotionParam(index, motion_mapping.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateUI();
|
UpdateUI();
|
||||||
|
@ -1237,7 +1206,7 @@ bool ConfigureInputPlayer::IsInputAcceptable(const Common::ParamPackage& params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keyboard/Mouse
|
// Keyboard/Mouse
|
||||||
if (ui->comboDevices->currentIndex() == 2) {
|
if (ui->comboDevices->currentIndex() == 1 || ui->comboDevices->currentIndex() == 2) {
|
||||||
return params.Get("engine", "") == "keyboard" || params.Get("engine", "") == "mouse";
|
return params.Get("engine", "") == "keyboard" || params.Get("engine", "") == "mouse";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1245,7 +1214,7 @@ bool ConfigureInputPlayer::IsInputAcceptable(const Common::ParamPackage& params)
|
||||||
return params.Get("engine", "") == current_input_device.Get("engine", "") &&
|
return params.Get("engine", "") == current_input_device.Get("engine", "") &&
|
||||||
(params.Get("guid", "") == current_input_device.Get("guid", "") ||
|
(params.Get("guid", "") == current_input_device.Get("guid", "") ||
|
||||||
params.Get("guid", "") == current_input_device.Get("guid2", "")) &&
|
params.Get("guid", "") == current_input_device.Get("guid2", "")) &&
|
||||||
params.Get("port", "") == current_input_device.Get("port", "");
|
params.Get("port", 0) == current_input_device.Get("port", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureInputPlayer::mousePressEvent(QMouseEvent* event) {
|
void ConfigureInputPlayer::mousePressEvent(QMouseEvent* event) {
|
||||||
|
|
|
@ -97,7 +97,7 @@ void ConfigureVibration::SetVibrationDevices(std::size_t player_index) {
|
||||||
|
|
||||||
const auto engine = param.Get("engine", "");
|
const auto engine = param.Get("engine", "");
|
||||||
const auto guid = param.Get("guid", "");
|
const auto guid = param.Get("guid", "");
|
||||||
const auto port = param.Get("port", "");
|
const auto port = param.Get("port", 0);
|
||||||
|
|
||||||
if (engine.empty() || engine == "keyboard" || engine == "mouse" || engine == "tas") {
|
if (engine.empty() || engine == "keyboard" || engine == "mouse" || engine == "tas") {
|
||||||
continue;
|
continue;
|
||||||
|
@ -105,7 +105,7 @@ void ConfigureVibration::SetVibrationDevices(std::size_t player_index) {
|
||||||
|
|
||||||
vibration_param_str += fmt::format("engine:{}", engine);
|
vibration_param_str += fmt::format("engine:{}", engine);
|
||||||
|
|
||||||
if (!port.empty()) {
|
if (port != 0) {
|
||||||
vibration_param_str += fmt::format(",port:{}", port);
|
vibration_param_str += fmt::format(",port:{}", port);
|
||||||
}
|
}
|
||||||
if (!guid.empty()) {
|
if (!guid.empty()) {
|
||||||
|
|
|
@ -21,8 +21,7 @@ ControllerDialog::ControllerDialog(Core::System& system, QWidget* parent)
|
||||||
Qt::WindowMaximizeButtonHint);
|
Qt::WindowMaximizeButtonHint);
|
||||||
|
|
||||||
widget = new PlayerControlPreview(this);
|
widget = new PlayerControlPreview(this);
|
||||||
widget->SetController(system.HIDCore().GetEmulatedController(
|
widget->SetController(system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1));
|
||||||
Core::HID::NpadIdType::Player1));
|
|
||||||
QLayout* layout = new QVBoxLayout(this);
|
QLayout* layout = new QVBoxLayout(this);
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
layout->addWidget(widget);
|
layout->addWidget(widget);
|
||||||
|
|
Loading…
Reference in a new issue