summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-11-27 01:55:28 +0100
committergerman77 <juangerman-13@hotmail.com>2021-11-27 01:55:28 +0100
commita4a0638bc8043ddaea13025dd7e07b198cdb3cee (patch)
tree206e482be788e1000ebe81dbe191b2129c4cd5c1
parentinput_common: Fully implement UDP controllers (diff)
downloadyuzu-a4a0638bc8043ddaea13025dd7e07b198cdb3cee.tar
yuzu-a4a0638bc8043ddaea13025dd7e07b198cdb3cee.tar.gz
yuzu-a4a0638bc8043ddaea13025dd7e07b198cdb3cee.tar.bz2
yuzu-a4a0638bc8043ddaea13025dd7e07b198cdb3cee.tar.lz
yuzu-a4a0638bc8043ddaea13025dd7e07b198cdb3cee.tar.xz
yuzu-a4a0638bc8043ddaea13025dd7e07b198cdb3cee.tar.zst
yuzu-a4a0638bc8043ddaea13025dd7e07b198cdb3cee.zip
Diffstat (limited to '')
-rw-r--r--src/yuzu/applets/qt_controller.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/yuzu/applets/qt_controller.cpp b/src/yuzu/applets/qt_controller.cpp
index 6a2cdda63..eaa0f39f2 100644
--- a/src/yuzu/applets/qt_controller.cpp
+++ b/src/yuzu/applets/qt_controller.cpp
@@ -29,7 +29,7 @@ namespace {
void UpdateController(Core::HID::EmulatedController* controller,
Core::HID::NpadStyleIndex controller_type, bool connected) {
- if (controller->IsConnected()) {
+ if (controller->IsConnected(true)) {
controller->Disconnect();
}
controller->SetNpadStyleIndex(controller_type);
@@ -139,6 +139,7 @@ QtControllerSelectorDialog::QtControllerSelectorDialog(
DisableUnsupportedPlayers();
for (std::size_t player_index = 0; player_index < NUM_PLAYERS; ++player_index) {
+ system.HIDCore().GetEmulatedControllerByIndex(player_index)->EnableConfiguration();
SetEmulatedControllers(player_index);
}
@@ -233,20 +234,24 @@ void QtControllerSelectorDialog::ApplyConfiguration() {
Settings::values.vibration_enabled.SetValue(ui->vibrationGroup->isChecked());
Settings::values.motion_enabled.SetValue(ui->motionGroup->isChecked());
+ for (std::size_t player_index = 0; player_index < NUM_PLAYERS; ++player_index) {
+ system.HIDCore().GetEmulatedControllerByIndex(player_index)->DisableConfiguration();
+ }
}
void QtControllerSelectorDialog::LoadConfiguration() {
const auto* handheld = system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld);
for (std::size_t index = 0; index < NUM_PLAYERS; ++index) {
const auto* controller = system.HIDCore().GetEmulatedControllerByIndex(index);
- const auto connected = controller->IsConnected() || (index == 0 && handheld->IsConnected());
+ const auto connected =
+ controller->IsConnected(true) || (index == 0 && handheld->IsConnected(true));
player_groupboxes[index]->setChecked(connected);
connected_controller_checkboxes[index]->setChecked(connected);
emulated_controllers[index]->setCurrentIndex(
- GetIndexFromControllerType(controller->GetNpadStyleIndex(), index));
+ GetIndexFromControllerType(controller->GetNpadStyleIndex(true), index));
}
- UpdateDockedState(handheld->IsConnected());
+ UpdateDockedState(handheld->IsConnected(true));
ui->vibrationGroup->setChecked(Settings::values.vibration_enabled.GetValue());
ui->motionGroup->setChecked(Settings::values.motion_enabled.GetValue());
@@ -510,8 +515,8 @@ void QtControllerSelectorDialog::UpdateControllerState(std::size_t player_index)
const auto player_connected = player_groupboxes[player_index]->isChecked() &&
controller_type != Core::HID::NpadStyleIndex::Handheld;
- if (controller->GetNpadStyleIndex() == controller_type &&
- controller->IsConnected() == player_connected) {
+ if (controller->GetNpadStyleIndex(true) == controller_type &&
+ controller->IsConnected(true) == player_connected) {
// Set vibration devices in the event that the input device has changed.
ConfigureVibration::SetVibrationDevices(player_index);
return;
@@ -633,7 +638,7 @@ void QtControllerSelectorDialog::DisableUnsupportedPlayers() {
for (std::size_t index = max_supported_players; index < NUM_PLAYERS; ++index) {
auto* controller = system.HIDCore().GetEmulatedControllerByIndex(index);
// Disconnect any unsupported players here and disable or hide them if applicable.
- UpdateController(controller, controller->GetNpadStyleIndex(), false);
+ UpdateController(controller, controller->GetNpadStyleIndex(true), false);
// Hide the player widgets when max_supported_controllers is less than or equal to 4.
if (max_supported_players <= 4) {
player_widgets[index]->hide();