diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp index 48e5a5f0f2..1b6f629c1c 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingWindow.cpp @@ -136,6 +136,8 @@ void MappingWindow::CreateMainLayout() void MappingWindow::ConnectWidgets() { + connect(&Settings::Instance(), &Settings::DevicesChanged, this, + &MappingWindow::OnGlobalDevicesChanged); connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject); connect(m_devices_refresh, &QPushButton::clicked, this, &MappingWindow::RefreshDevices); connect(m_devices_combo, static_cast(&QComboBox::currentIndexChanged), @@ -242,11 +244,15 @@ bool MappingWindow::IsMappingAllDevices() const } void MappingWindow::RefreshDevices() +{ + Core::RunAsCPUThread([&] { g_controller_interface.RefreshDevices(); }); +} + +void MappingWindow::OnGlobalDevicesChanged() { m_devices_combo->clear(); Core::RunAsCPUThread([&] { - g_controller_interface.RefreshDevices(); m_controller->UpdateReferences(g_controller_interface); const auto default_device = m_controller->GetDefaultDevice().ToString(); diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingWindow.h b/Source/Core/DolphinQt/Config/Mapping/MappingWindow.h index c0a9f47af2..0432286e01 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingWindow.h +++ b/Source/Core/DolphinQt/Config/Mapping/MappingWindow.h @@ -76,6 +76,7 @@ private: void OnSaveProfilePressed(); void OnDefaultFieldsPressed(); void OnDeviceChanged(int index); + void OnGlobalDevicesChanged(); ControllerEmu::EmulatedController* m_controller = nullptr;