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

@ -901,7 +901,7 @@ void MainWindow::OnStopComplete()
bool MainWindow::RequestStop()
{
if (!Core::IsRunning())
if (!Core::IsRunning(Core::System::GetInstance()))
{
Core::QueueHostJob([this](Core::System&) { OnStopComplete(); }, true);
return true;
@ -1532,7 +1532,7 @@ void MainWindow::NetPlayInit()
bool MainWindow::NetPlayJoin()
{
if (Core::IsRunning())
if (Core::IsRunning(Core::System::GetInstance()))
{
ModalMessageBox::critical(nullptr, tr("Error"),
tr("Can't start a NetPlay Session while a game is still running!"));
@ -1599,7 +1599,7 @@ bool MainWindow::NetPlayJoin()
bool MainWindow::NetPlayHost(const UICommon::GameFile& game)
{
if (Core::IsRunning())
if (Core::IsRunning(Core::System::GetInstance()))
{
ModalMessageBox::critical(nullptr, tr("Error"),
tr("Can't start a NetPlay Session while a game is still running!"));
@ -1846,7 +1846,7 @@ void MainWindow::OnImportNANDBackup()
result.wait();
m_menu_bar->UpdateToolsMenu(Core::IsRunning());
m_menu_bar->UpdateToolsMenu(Core::IsRunning(Core::System::GetInstance()));
}
void MainWindow::OnPlayRecording()
@ -1876,8 +1876,9 @@ void MainWindow::OnPlayRecording()
void MainWindow::OnStartRecording()
{
auto& movie = Core::System::GetInstance().GetMovie();
if ((!Core::IsRunningAndStarted() && Core::IsRunning()) || movie.IsRecordingInput() ||
auto& system = Core::System::GetInstance();
auto& movie = system.GetMovie();
if ((!Core::IsRunningAndStarted() && Core::IsRunning(system)) || movie.IsRecordingInput() ||
movie.IsPlayingInput())
{
return;
@ -1909,7 +1910,7 @@ void MainWindow::OnStartRecording()
{
emit RecordingStatusChanged(true);
if (!Core::IsRunning())
if (!Core::IsRunning(system))
Play();
}
}
@ -1970,10 +1971,11 @@ void MainWindow::ShowTASInput()
}
}
auto& system = Core::System::GetInstance();
for (int i = 0; i < num_wii_controllers; i++)
{
if (Config::Get(Config::GetInfoForWiimoteSource(i)) == WiimoteSource::Emulated &&
(!Core::IsRunning() || Core::System::GetInstance().IsWii()))
(!Core::IsRunning(system) || system.IsWii()))
{
SetQWidgetWindowDecorations(m_wii_tas_input_windows[i]);
m_wii_tas_input_windows[i]->show();