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

@ -499,7 +499,7 @@ void MainWindow::CreateComponents()
connect(m_breakpoint_widget, &BreakpointWidget::BreakpointsChanged, m_memory_widget,
&MemoryWidget::Update);
connect(m_breakpoint_widget, &BreakpointWidget::ShowCode, [this](u32 address) {
if (Core::GetState() == Core::State::Paused)
if (Core::GetState(Core::System::GetInstance()) == Core::State::Paused)
m_code_widget->SetAddress(address, CodeViewWidget::SetAddressUpdate::WithDetailedUpdate);
});
connect(m_breakpoint_widget, &BreakpointWidget::ShowMemory, m_memory_widget,
@ -823,7 +823,7 @@ void MainWindow::Play(const std::optional<std::string>& savestate_path)
// Otherwise, play the default game.
// Otherwise, play the last played game, if there is one.
// Otherwise, prompt for a new game.
if (Core::GetState() == Core::State::Paused)
if (Core::GetState(Core::System::GetInstance()) == Core::State::Paused)
{
Core::SetState(Core::State::Running);
}
@ -858,7 +858,7 @@ void MainWindow::Pause()
void MainWindow::TogglePause()
{
if (Core::GetState() == Core::State::Paused)
if (Core::GetState(Core::System::GetInstance()) == Core::State::Paused)
{
Play();
}
@ -926,7 +926,7 @@ bool MainWindow::RequestStop()
Common::ScopeGuard confirm_lock([this] { m_stop_confirm_showing = false; });
const Core::State state = Core::GetState();
const Core::State state = Core::GetState(Core::System::GetInstance());
// Only pause the game, if NetPlay is not running
bool pause = !Settings::Instance().GetNetPlayClient();
@ -983,7 +983,7 @@ bool MainWindow::RequestStop()
// Unpause because gracefully shutting down needs the game to actually request a shutdown.
// TODO: Do not unpause in debug mode to allow debugging until the complete shutdown.
if (Core::GetState() == Core::State::Paused)
if (Core::GetState(Core::System::GetInstance()) == Core::State::Paused)
Core::SetState(Core::State::Running);
// Tell NetPlay about the power event
@ -1017,7 +1017,7 @@ void MainWindow::Reset()
void MainWindow::FrameAdvance()
{
Core::DoFrameStep();
Core::DoFrameStep(Core::System::GetInstance());
}
void MainWindow::FullScreen()
@ -1108,7 +1108,7 @@ void MainWindow::StartGame(std::unique_ptr<BootParameters>&& parameters)
}
// If we're running, only start a new game once we've stopped the last.
if (Core::GetState() != Core::State::Uninitialized)
if (Core::GetState(Core::System::GetInstance()) != Core::State::Uninitialized)
{
if (!RequestStop())
return;
@ -1660,8 +1660,8 @@ void MainWindow::NetPlayQuit()
void MainWindow::UpdateScreenSaverInhibition()
{
const bool inhibit =
Config::Get(Config::MAIN_DISABLE_SCREENSAVER) && (Core::GetState() == Core::State::Running);
const bool inhibit = Config::Get(Config::MAIN_DISABLE_SCREENSAVER) &&
(Core::GetState(Core::System::GetInstance()) == Core::State::Running);
if (inhibit == m_is_screensaver_inhibited)
return;