diff --git a/rpcs3/rpcs3qt/pad_settings_dialog.cpp b/rpcs3/rpcs3qt/pad_settings_dialog.cpp index 6f892adc68..f21e1db444 100644 --- a/rpcs3/rpcs3qt/pad_settings_dialog.cpp +++ b/rpcs3/rpcs3qt/pad_settings_dialog.cpp @@ -1519,7 +1519,8 @@ void pad_settings_dialog::ChangeHandler() ui->chooseDevice->setPlaceholderText(tr("No Device Detected")); } - m_device_name.clear(); + // Keep the configured device name + m_device_name = GetDeviceName(); } // Handle running timers @@ -1611,11 +1612,7 @@ void pad_settings_dialog::ChangeDevice(int index) } const pad_device_info info = user_data.value(); - m_device_name = info.name; - if (!g_cfg_input.player[GetPlayerIndex()]->device.from_string(m_device_name)) - { - cfg_log.error("Failed to convert device string: %s", m_device_name); - } + SetDeviceName(info.name); } void pad_settings_dialog::HandleDeviceClassChange(u32 class_id) const @@ -1949,6 +1946,21 @@ cfg_pad& pad_settings_dialog::GetPlayerConfig() const return g_cfg_input.player[GetPlayerIndex()]->config; } +std::string pad_settings_dialog::GetDeviceName() const +{ + return g_cfg_input.player[GetPlayerIndex()]->device.to_string(); +} + +void pad_settings_dialog::SetDeviceName(const std::string& name) +{ + m_device_name = name; + + if (!g_cfg_input.player[GetPlayerIndex()]->device.from_string(m_device_name)) + { + cfg_log.error("Failed to convert device string: %s", m_device_name); + } +} + void pad_settings_dialog::ResizeDialog() { // Widgets diff --git a/rpcs3/rpcs3qt/pad_settings_dialog.h b/rpcs3/rpcs3qt/pad_settings_dialog.h index 2c63eda3f0..e0433fb8fb 100644 --- a/rpcs3/rpcs3qt/pad_settings_dialog.h +++ b/rpcs3/rpcs3qt/pad_settings_dialog.h @@ -218,6 +218,12 @@ private: /** Returns the current player config */ cfg_pad& GetPlayerConfig() const; + /** Sets the device name (member and config) */ + void SetDeviceName(const std::string& name); + + /** Gets the device name from config */ + std::string GetDeviceName() const; + /** Resizes the dialog. We need to do this because the main scroll area can't determine the size on its own. */ void ResizeDialog();