Core::GetState: Avoid Global System Accessor

This commit is contained in:
mitaclaw
2024-03-28 11:35:13 -07:00
parent db0cd82326
commit eb92d6f0a8
42 changed files with 135 additions and 101 deletions

View File

@ -11,6 +11,7 @@
#include "Core/Core.h"
#include "Core/NetPlayProto.h"
#include "Core/System.h"
#include "DolphinQt/Host.h"
#include "DolphinQt/Resources.h"
#include "DolphinQt/Settings.h"
@ -36,7 +37,7 @@ ToolBar::ToolBar(QWidget* parent) : QToolBar(parent)
[this](Core::State state) { OnEmulationStateChanged(state); });
connect(Host::GetInstance(), &Host::UpdateDisasmDialog, this,
[this] { OnEmulationStateChanged(Core::GetState()); });
[this] { OnEmulationStateChanged(Core::GetState(Core::System::GetInstance())); });
connect(&Settings::Instance(), &Settings::DebugModeToggled, this, &ToolBar::OnDebugModeToggled);
@ -51,7 +52,7 @@ ToolBar::ToolBar(QWidget* parent) : QToolBar(parent)
connect(&Settings::Instance(), &Settings::GameListRefreshStarted, this,
[this] { m_refresh_action->setEnabled(true); });
OnEmulationStateChanged(Core::GetState());
OnEmulationStateChanged(Core::GetState(Core::System::GetInstance()));
OnDebugModeToggled(Settings::Instance().IsDebugModeEnabled());
}
@ -65,7 +66,7 @@ void ToolBar::OnEmulationStateChanged(Core::State state)
bool playing = running && state != Core::State::Paused;
UpdatePausePlayButtonState(playing);
bool paused = Core::GetState() == Core::State::Paused;
const bool paused = Core::GetState(Core::System::GetInstance()) == Core::State::Paused;
m_step_action->setEnabled(paused);
m_step_over_action->setEnabled(paused);
m_step_out_action->setEnabled(paused);
@ -87,7 +88,7 @@ void ToolBar::OnDebugModeToggled(bool enabled)
m_show_pc_action->setVisible(enabled);
m_set_pc_action->setVisible(enabled);
bool paused = Core::GetState() == Core::State::Paused;
const bool paused = Core::GetState(Core::System::GetInstance()) == Core::State::Paused;
m_step_action->setEnabled(paused);
m_step_over_action->setEnabled(paused);
m_step_out_action->setEnabled(paused);
@ -180,7 +181,7 @@ void ToolBar::UpdateIcons()
m_open_action->setIcon(Resources::GetThemeIcon("open"));
m_refresh_action->setIcon(Resources::GetThemeIcon("refresh"));
const Core::State state = Core::GetState();
const Core::State state = Core::GetState(Core::System::GetInstance());
const bool playing = state != Core::State::Uninitialized && state != Core::State::Paused;
if (!playing)
m_pause_play_action->setIcon(Resources::GetThemeIcon("play"));