Disallow changing the backend when running when software renderer is currently selected

It already is disabled for other backends, but this didn't happen with the software renderer.  Attempting to change it while running causes the change to visually happen (including switching to the normal render settings UI instead of the barren one for the software renderer), but doesn't actually change the backend itself (it'll still use the software renderer at the next launch).
This commit is contained in:
Pokechu22 2019-06-08 16:02:01 -07:00
parent d927cd2b03
commit adfbbe3a02
2 changed files with 14 additions and 3 deletions

View File

@ -13,6 +13,7 @@
#include "Core/Config/GraphicsSettings.h" #include "Core/Config/GraphicsSettings.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "DolphinQt/Config/Graphics/GraphicsBool.h" #include "DolphinQt/Config/Graphics/GraphicsBool.h"
#include "DolphinQt/Config/Graphics/GraphicsWindow.h" #include "DolphinQt/Config/Graphics/GraphicsWindow.h"
@ -26,12 +27,15 @@
SoftwareRendererWidget::SoftwareRendererWidget(GraphicsWindow* parent) : GraphicsWidget(parent) SoftwareRendererWidget::SoftwareRendererWidget(GraphicsWindow* parent) : GraphicsWidget(parent)
{ {
CreateWidgets(); CreateWidgets();
connect(parent, &GraphicsWindow::BackendChanged, [this] { LoadSettings(); });
LoadSettings(); LoadSettings();
ConnectWidgets(); ConnectWidgets();
AddDescriptions(); AddDescriptions();
emit BackendChanged(QString::fromStdString(SConfig::GetInstance().m_strVideoBackend));
connect(parent, &GraphicsWindow::BackendChanged, [this] { LoadSettings(); });
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
[=](Core::State state) { OnEmulationStateChanged(state != Core::State::Uninitialized); });
OnEmulationStateChanged(Core::GetState() != Core::State::Uninitialized);
} }
void SoftwareRendererWidget::CreateWidgets() void SoftwareRendererWidget::CreateWidgets()
@ -180,3 +184,8 @@ void SoftwareRendererWidget::AddDescriptions()
AddDescription(m_dump_tev_stages, TR_DUMP_TEV_STAGES_DESCRIPTION); AddDescription(m_dump_tev_stages, TR_DUMP_TEV_STAGES_DESCRIPTION);
AddDescription(m_dump_tev_fetches, TR_DUMP_TEV_FETCHES_DESCRIPTION); AddDescription(m_dump_tev_fetches, TR_DUMP_TEV_FETCHES_DESCRIPTION);
} }
void SoftwareRendererWidget::OnEmulationStateChanged(bool running)
{
m_backend_combo->setEnabled(!running);
}

View File

@ -28,6 +28,8 @@ private:
void ConnectWidgets(); void ConnectWidgets();
void AddDescriptions(); void AddDescriptions();
void OnEmulationStateChanged(bool running);
QComboBox* m_backend_combo; QComboBox* m_backend_combo;
QCheckBox* m_show_statistics; QCheckBox* m_show_statistics;
QCheckBox* m_dump_textures; QCheckBox* m_dump_textures;