Core::IsRunning: Avoid Global System Accessor

This commit is contained in:
mitaclaw
2024-04-08 20:33:55 -07:00
parent b71fdef356
commit 0df401b164
25 changed files with 90 additions and 74 deletions

View File

@ -11,6 +11,7 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/System.h"
#include "DolphinQt/Settings.h"
@ -22,11 +23,11 @@ CheatWarningWidget::CheatWarningWidget(const std::string& game_id, bool restart_
ConnectWidgets();
connect(&Settings::Instance(), &Settings::EnableCheatsChanged, this,
[this] { Update(Core::IsRunning()); });
[this] { Update(Core::IsRunning(Core::System::GetInstance())); });
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
[this](Core::State state) { Update(state == Core::State::Running); });
Update(Core::IsRunning());
Update(Core::IsRunning(Core::System::GetInstance()));
}
void CheatWarningWidget::CreateWidgets()

View File

@ -191,16 +191,16 @@ void GamecubeControllersWidget::SaveSettings()
{
Config::ConfigChangeCallbackGuard config_guard;
auto& system = Core::System::GetInstance();
for (size_t i = 0; i < m_gc_groups.size(); ++i)
{
const SerialInterface::SIDevices si_device =
FromGCMenuIndex(m_gc_controller_boxes[i]->currentIndex());
Config::SetBaseOrCurrent(Config::GetInfoForSIDevice(static_cast<int>(i)), si_device);
if (Core::IsRunning())
if (Core::IsRunning(system))
{
Core::System::GetInstance().GetSerialInterface().ChangeDevice(si_device,
static_cast<s32>(i));
system.GetSerialInterface().ChangeDevice(si_device, static_cast<s32>(i));
}
}
}

View File

@ -361,7 +361,7 @@ void GeneralWidget::OnBackendChanged(const QString& backend_name)
const bool supports_adapters = !adapters.empty();
m_adapter_combo->setCurrentIndex(g_Config.iAdapter);
m_adapter_combo->setEnabled(supports_adapters && !Core::IsRunning());
m_adapter_combo->setEnabled(supports_adapters && !Core::IsRunning(Core::System::GetInstance()));
static constexpr char TR_ADAPTER_AVAILABLE_DESCRIPTION[] =
QT_TR_NOOP("Selects a hardware adapter to use.<br><br>"