Migrate video backend setting to the new config system
Fixes https://bugs.dolphin-emu.org/issues/12087
This commit is contained in:
parent
393ce529af
commit
8df56cb319
|
@ -96,7 +96,6 @@ private:
|
|||
float m_OCFactor;
|
||||
bool m_OCEnable;
|
||||
bool m_bt_passthrough_enabled;
|
||||
std::string strBackend;
|
||||
std::string sBackend;
|
||||
std::string m_strGPUDeterminismMode;
|
||||
std::array<WiimoteSource, MAX_BBMOTES> iWiimoteSource;
|
||||
|
@ -127,7 +126,6 @@ void ConfigCache::SaveConfig(const SConfig& config)
|
|||
cpu_core = config.cpu_core;
|
||||
Volume = config.m_Volume;
|
||||
m_EmulationSpeed = config.m_EmulationSpeed;
|
||||
strBackend = config.m_strVideoBackend;
|
||||
sBackend = config.sBackend;
|
||||
m_strGPUDeterminismMode = config.m_strGPUDeterminismMode;
|
||||
m_OCFactor = config.m_OCFactor;
|
||||
|
@ -202,13 +200,11 @@ void ConfigCache::RestoreConfig(SConfig* config)
|
|||
config->m_EXIDevice[i] = m_EXIDevice[i];
|
||||
}
|
||||
|
||||
config->m_strVideoBackend = strBackend;
|
||||
config->sBackend = sBackend;
|
||||
config->m_strGPUDeterminismMode = m_strGPUDeterminismMode;
|
||||
config->m_OCFactor = m_OCFactor;
|
||||
config->m_OCEnable = m_OCEnable;
|
||||
config->m_bt_passthrough_enabled = m_bt_passthrough_enabled;
|
||||
VideoBackendBase::ActivateBackend(config->m_strVideoBackend);
|
||||
}
|
||||
|
||||
static ConfigCache config_cache;
|
||||
|
@ -269,7 +265,6 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
|||
core_section->Get("SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU);
|
||||
core_section->Get("FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed);
|
||||
core_section->Get("DSPHLE", &StartUp.bDSPHLE, StartUp.bDSPHLE);
|
||||
core_section->Get("GFXBackend", &StartUp.m_strVideoBackend, StartUp.m_strVideoBackend);
|
||||
core_section->Get("CPUCore", &StartUp.cpu_core, StartUp.cpu_core);
|
||||
core_section->Get("HLE_BS2", &StartUp.bHLE_BS2, StartUp.bHLE_BS2);
|
||||
core_section->Get("GameCubeLanguage", &StartUp.SelectedLanguage, StartUp.SelectedLanguage);
|
||||
|
@ -280,7 +275,6 @@ bool BootCore(std::unique_ptr<BootParameters> boot, const WindowSystemInfo& wsi)
|
|||
config_cache.bSetVolume = true;
|
||||
dsp_section->Get("EnableJIT", &StartUp.m_DSPEnableJIT, StartUp.m_DSPEnableJIT);
|
||||
dsp_section->Get("Backend", &StartUp.sBackend, StartUp.sBackend);
|
||||
VideoBackendBase::ActivateBackend(StartUp.m_strVideoBackend);
|
||||
core_section->Get("GPUDeterminismMode", &StartUp.m_strGPUDeterminismMode,
|
||||
StartUp.m_strGPUDeterminismMode);
|
||||
core_section->Get("Overclock", &StartUp.m_OCFactor, StartUp.m_OCFactor);
|
||||
|
|
|
@ -28,7 +28,7 @@ bool IsSettingSaveable(const Config::Location& config_location)
|
|||
return true;
|
||||
}
|
||||
|
||||
static constexpr std::array<const Config::Location*, 102> s_setting_saveable = {
|
||||
static constexpr std::array<const Config::Location*, 103> s_setting_saveable = {
|
||||
// Main.Core
|
||||
|
||||
&Config::MAIN_DEFAULT_ISO.location,
|
||||
|
@ -40,6 +40,7 @@ bool IsSettingSaveable(const Config::Location& config_location)
|
|||
&Config::MAIN_RAM_OVERRIDE_ENABLE.location,
|
||||
&Config::MAIN_MEM1_SIZE.location,
|
||||
&Config::MAIN_MEM2_SIZE.location,
|
||||
&Config::MAIN_GFX_BACKEND.location,
|
||||
|
||||
// Main.Display
|
||||
|
||||
|
|
|
@ -241,7 +241,6 @@ void SConfig::SaveCoreSettings(IniFile& ini)
|
|||
core->Set("EmulationSpeed", m_EmulationSpeed);
|
||||
core->Set("Overclock", m_OCFactor);
|
||||
core->Set("OverclockEnable", m_OCEnable);
|
||||
core->Set("GFXBackend", m_strVideoBackend);
|
||||
core->Set("GPUDeterminismMode", m_strGPUDeterminismMode);
|
||||
core->Set("PerfMapDir", m_perfDir);
|
||||
core->Set("EnableCustomRTC", bEnableCustomRTC);
|
||||
|
@ -517,7 +516,6 @@ void SConfig::LoadCoreSettings(IniFile& ini)
|
|||
core->Get("EmulationSpeed", &m_EmulationSpeed, 1.0f);
|
||||
core->Get("Overclock", &m_OCFactor, 1.0f);
|
||||
core->Get("OverclockEnable", &m_OCEnable, false);
|
||||
core->Get("GFXBackend", &m_strVideoBackend, "");
|
||||
core->Get("GPUDeterminismMode", &m_strGPUDeterminismMode, "auto");
|
||||
core->Get("PerfMapDir", &m_perfDir, "");
|
||||
core->Get("EnableCustomRTC", &bEnableCustomRTC, false);
|
||||
|
|
|
@ -180,7 +180,6 @@ struct SConfig
|
|||
|
||||
DiscIO::Region m_region;
|
||||
|
||||
std::string m_strVideoBackend;
|
||||
std::string m_strGPUDeterminismMode;
|
||||
|
||||
// set based on the string version
|
||||
|
|
|
@ -459,11 +459,7 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
|
|||
HLE::Clear();
|
||||
}};
|
||||
|
||||
// Backend info has to be initialized before we can initialize the backend.
|
||||
// This is because when we load the config, we validate it against the current backend info.
|
||||
// We also should have the correct adapter selected for creating the device in Initialize().
|
||||
g_video_backend->InitBackendInfo();
|
||||
g_Config.Refresh();
|
||||
VideoBackendBase::PopulateBackendInfo();
|
||||
|
||||
if (!g_video_backend->Initialize(wsi))
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ GeneralWidget::GeneralWidget(X11Utils::XRRConfiguration* xrr_config, GraphicsWin
|
|||
LoadSettings();
|
||||
ConnectWidgets();
|
||||
AddDescriptions();
|
||||
emit BackendChanged(QString::fromStdString(SConfig::GetInstance().m_strVideoBackend));
|
||||
emit BackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)));
|
||||
|
||||
connect(parent, &GraphicsWindow::BackendChanged, this, &GeneralWidget::OnBackendChanged);
|
||||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
|
||||
|
@ -150,14 +150,14 @@ void GeneralWidget::LoadSettings()
|
|||
{
|
||||
// Video Backend
|
||||
m_backend_combo->setCurrentIndex(m_backend_combo->findData(
|
||||
QVariant(QString::fromStdString(SConfig::GetInstance().m_strVideoBackend))));
|
||||
QVariant(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)))));
|
||||
}
|
||||
|
||||
void GeneralWidget::SaveSettings()
|
||||
{
|
||||
// Video Backend
|
||||
const auto current_backend = m_backend_combo->currentData().toString().toStdString();
|
||||
if (SConfig::GetInstance().m_strVideoBackend != current_backend)
|
||||
if (Config::Get(Config::MAIN_GFX_BACKEND) != current_backend)
|
||||
{
|
||||
auto warningMessage =
|
||||
g_available_video_backends[m_backend_combo->currentIndex()]->GetWarningMessage();
|
||||
|
@ -173,7 +173,7 @@ void GeneralWidget::SaveSettings()
|
|||
if (confirm_sw.exec() != QMessageBox::Yes)
|
||||
{
|
||||
m_backend_combo->setCurrentIndex(m_backend_combo->findData(
|
||||
QVariant(QString::fromStdString(SConfig::GetInstance().m_strVideoBackend))));
|
||||
QVariant(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)))));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include <QTabWidget>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
|
||||
#include "DolphinQt/Config/Graphics/AdvancedWidget.h"
|
||||
|
@ -32,7 +34,7 @@ GraphicsWindow::GraphicsWindow(X11Utils::XRRConfiguration* xrr_config, MainWindo
|
|||
setWindowTitle(tr("Graphics"));
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
OnBackendChanged(QString::fromStdString(SConfig::GetInstance().m_strVideoBackend));
|
||||
OnBackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)));
|
||||
}
|
||||
|
||||
void GraphicsWindow::CreateMainLayout()
|
||||
|
@ -77,7 +79,7 @@ void GraphicsWindow::CreateMainLayout()
|
|||
m_wrapped_advanced = GetWrappedWidget(m_advanced_widget, this, 50, 305);
|
||||
m_wrapped_software = GetWrappedWidget(m_software_renderer, this, 50, 305);
|
||||
|
||||
if (SConfig::GetInstance().m_strVideoBackend != "Software Renderer")
|
||||
if (Config::Get(Config::MAIN_GFX_BACKEND) != "Software Renderer")
|
||||
{
|
||||
m_tab_widget->addTab(m_wrapped_general, tr("General"));
|
||||
m_tab_widget->addTab(m_wrapped_enhancements, tr("Enhancements"));
|
||||
|
@ -94,8 +96,8 @@ void GraphicsWindow::CreateMainLayout()
|
|||
|
||||
void GraphicsWindow::OnBackendChanged(const QString& backend_name)
|
||||
{
|
||||
SConfig::GetInstance().m_strVideoBackend = backend_name.toStdString();
|
||||
VideoBackendBase::PopulateBackendInfo();
|
||||
Config::SetBase(Config::MAIN_GFX_BACKEND, backend_name.toStdString());
|
||||
VideoBackendBase::PopulateBackendInfoFromUI();
|
||||
|
||||
setWindowTitle(
|
||||
tr("%1 Graphics Configuration").arg(tr(g_video_backend->GetDisplayName().c_str())));
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <QVBoxLayout>
|
||||
|
||||
#include "Core/Config/GraphicsSettings.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
|
||||
#include "DolphinQt/Config/Graphics/GraphicsBool.h"
|
||||
|
@ -28,7 +29,7 @@ HacksWidget::HacksWidget(GraphicsWindow* parent) : GraphicsWidget(parent)
|
|||
AddDescriptions();
|
||||
|
||||
connect(parent, &GraphicsWindow::BackendChanged, this, &HacksWidget::OnBackendChanged);
|
||||
OnBackendChanged(QString::fromStdString(SConfig::GetInstance().m_strVideoBackend));
|
||||
OnBackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)));
|
||||
connect(&Settings::Instance(), &Settings::ConfigChanged, this, &HacksWidget::LoadSettings);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <QVBoxLayout>
|
||||
|
||||
#include "Core/Config/GraphicsSettings.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
|
||||
|
@ -30,7 +31,7 @@ SoftwareRendererWidget::SoftwareRendererWidget(GraphicsWindow* parent) : Graphic
|
|||
LoadSettings();
|
||||
ConnectWidgets();
|
||||
AddDescriptions();
|
||||
emit BackendChanged(QString::fromStdString(SConfig::GetInstance().m_strVideoBackend));
|
||||
emit BackendChanged(QString::fromStdString(Config::Get(Config::MAIN_GFX_BACKEND)));
|
||||
|
||||
connect(parent, &GraphicsWindow::BackendChanged, [this] { LoadSettings(); });
|
||||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
|
||||
|
@ -123,9 +124,11 @@ void SoftwareRendererWidget::LoadSettings()
|
|||
{
|
||||
for (const auto& backend : g_available_video_backends)
|
||||
{
|
||||
if (backend->GetName() == SConfig::GetInstance().m_strVideoBackend)
|
||||
if (backend->GetName() == Config::Get(Config::MAIN_GFX_BACKEND))
|
||||
{
|
||||
m_backend_combo->setCurrentIndex(
|
||||
m_backend_combo->findText(tr(backend->GetDisplayName().c_str())));
|
||||
}
|
||||
}
|
||||
|
||||
m_object_range_min->setValue(Config::Get(Config::GFX_SW_DRAW_START));
|
||||
|
@ -139,7 +142,7 @@ void SoftwareRendererWidget::SaveSettings()
|
|||
if (tr(backend->GetDisplayName().c_str()) == m_backend_combo->currentText())
|
||||
{
|
||||
const auto backend_name = backend->GetName();
|
||||
if (backend_name != SConfig::GetInstance().m_strVideoBackend)
|
||||
if (backend_name != Config::Get(Config::MAIN_GFX_BACKEND))
|
||||
emit BackendChanged(QString::fromStdString(backend_name));
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ void Init()
|
|||
VideoBackendBase::PopulateList();
|
||||
WiimoteReal::LoadSettings();
|
||||
GCAdapter::Init();
|
||||
VideoBackendBase::ActivateBackend(SConfig::GetInstance().m_strVideoBackend);
|
||||
VideoBackendBase::ActivateBackend(Config::Get(Config::MAIN_GFX_BACKEND));
|
||||
|
||||
Common::SetEnableAlert(SConfig::GetInstance().bUsePanicHandlers);
|
||||
}
|
||||
|
|
|
@ -14,9 +14,11 @@
|
|||
|
||||
#include "Common/ChunkFile.h"
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Common/Event.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
|
||||
|
@ -245,18 +247,21 @@ void VideoBackendBase::ActivateBackend(const std::string& name)
|
|||
|
||||
void VideoBackendBase::PopulateBackendInfo()
|
||||
{
|
||||
// If the core is running, the backend info will have been populated already.
|
||||
// If we did it here, the UI thread can race with the with the GPU thread.
|
||||
if (Core::IsRunning())
|
||||
return;
|
||||
|
||||
// We refresh the config after initializing the backend info, as system-specific settings
|
||||
// such as anti-aliasing, or the selected adapter may be invalid, and should be checked.
|
||||
ActivateBackend(SConfig::GetInstance().m_strVideoBackend);
|
||||
ActivateBackend(Config::Get(Config::MAIN_GFX_BACKEND));
|
||||
g_video_backend->InitBackendInfo();
|
||||
g_Config.Refresh();
|
||||
}
|
||||
|
||||
void VideoBackendBase::PopulateBackendInfoFromUI()
|
||||
{
|
||||
// If the core is running, the backend info will have been populated already.
|
||||
// If we did it here, the UI thread can race with the with the GPU thread.
|
||||
if (!Core::IsRunning())
|
||||
PopulateBackendInfo();
|
||||
}
|
||||
|
||||
void VideoBackendBase::DoState(PointerWrap& p)
|
||||
{
|
||||
if (!SConfig::GetInstance().bCPUThread)
|
||||
|
|
|
@ -64,8 +64,9 @@ public:
|
|||
static void ActivateBackend(const std::string& name);
|
||||
|
||||
// Fills the backend_info fields with the capabilities of the selected backend/device.
|
||||
// Called by the UI thread when the graphics config is opened.
|
||||
static void PopulateBackendInfo();
|
||||
// Called by the UI thread when the graphics config is opened.
|
||||
static void PopulateBackendInfoFromUI();
|
||||
|
||||
// Wrapper function which pushes the event to the GPU thread.
|
||||
void DoState(PointerWrap& p);
|
||||
|
|
Loading…
Reference in New Issue