From 1c68f4231b98faa5a5b286f3029471220b388d0d Mon Sep 17 00:00:00 2001 From: Patrick Ferry <8967997+PatrickFerry@users.noreply.github.com> Date: Sat, 23 Dec 2023 23:31:52 +0000 Subject: Qt: Handle Overridden Graphics Backend This fixes an issue where the game specific graphics backend would be saved as the global setting after playing a game. This also now displays the currently running graphics backend when looking in the graphics configuration window. --- Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp') diff --git a/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp index aa4a7c5563..5981c21348 100644 --- a/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp @@ -182,7 +182,10 @@ void GeneralWidget::SaveSettings() { // Video Backend const auto current_backend = m_backend_combo->currentData().toString().toStdString(); - if (Config::Get(Config::MAIN_GFX_BACKEND) != current_backend) + if (Config::Get(Config::MAIN_GFX_BACKEND) == current_backend) + return; + + if (Config::GetActiveLayerForConfig(Config::MAIN_GFX_BACKEND) == Config::LayerType::Base) { auto warningMessage = VideoBackendBase::GetAvailableBackends()[m_backend_combo->currentIndex()] ->GetWarningMessage(); @@ -203,8 +206,10 @@ void GeneralWidget::SaveSettings() return; } } - emit BackendChanged(QString::fromStdString(current_backend)); } + + Config::SetBaseOrCurrent(Config::MAIN_GFX_BACKEND, current_backend); + emit BackendChanged(QString::fromStdString(current_backend)); } void GeneralWidget::OnEmulationStateChanged(bool running) @@ -215,6 +220,10 @@ void GeneralWidget::OnEmulationStateChanged(bool running) const bool supports_adapters = !g_Config.backend_info.Adapters.empty(); m_adapter_combo->setEnabled(!running && supports_adapters); + + std::string current_backend = m_backend_combo->currentData().toString().toStdString(); + if (Config::Get(Config::MAIN_GFX_BACKEND) != current_backend) + emit BackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND))); } void GeneralWidget::AddDescriptions() -- cgit v1.2.3