Merge pull request #12761 from mitaclaw/core-global-system-5

Core::SetState: Avoid Global System Accessor
This commit is contained in:
Admiral H. Curtiss
2024-05-04 18:19:50 +02:00
committed by GitHub
7 changed files with 20 additions and 21 deletions

View File

@ -825,7 +825,7 @@ void MainWindow::Play(const std::optional<std::string>& savestate_path)
// Otherwise, prompt for a new game.
if (Core::GetState(Core::System::GetInstance()) == Core::State::Paused)
{
Core::SetState(Core::State::Running);
Core::SetState(Core::System::GetInstance(), Core::State::Running);
}
else
{
@ -853,7 +853,7 @@ void MainWindow::Play(const std::optional<std::string>& savestate_path)
void MainWindow::Pause()
{
Core::SetState(Core::State::Paused);
Core::SetState(Core::System::GetInstance(), Core::State::Paused);
}
void MainWindow::TogglePause()
@ -932,7 +932,7 @@ bool MainWindow::RequestStop()
bool pause = !Settings::Instance().GetNetPlayClient();
if (pause)
Core::SetState(Core::State::Paused);
Core::SetState(Core::System::GetInstance(), Core::State::Paused);
if (rendered_widget_was_active)
{
@ -962,7 +962,7 @@ bool MainWindow::RequestStop()
m_render_widget->SetWaitingForMessageBox(false);
if (pause)
Core::SetState(state);
Core::SetState(Core::System::GetInstance(), state);
return false;
}
@ -984,7 +984,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::System::GetInstance()) == Core::State::Paused)
Core::SetState(Core::State::Running);
Core::SetState(Core::System::GetInstance(), Core::State::Running);
// Tell NetPlay about the power event
if (NetPlay::IsNetPlayRunning())

View File

@ -424,7 +424,7 @@ bool RenderWidget::event(QEvent* event)
if (m_should_unpause_on_focus &&
Core::GetState(Core::System::GetInstance()) == Core::State::Paused)
{
Core::SetState(Core::State::Running);
Core::SetState(Core::System::GetInstance(), Core::State::Running);
}
m_should_unpause_on_focus = false;
@ -457,7 +457,7 @@ bool RenderWidget::event(QEvent* event)
if (!Core::IsCPUThread() && !Core::IsGPUThread())
{
m_should_unpause_on_focus = true;
Core::SetState(Core::State::Paused);
Core::SetState(Core::System::GetInstance(), Core::State::Paused);
}
}