From 6ca2da53e86766f54df1ae79e65bb220b41ed7ef Mon Sep 17 00:00:00 2001 From: JosJuice Date: Tue, 2 Jul 2024 17:27:04 +0200 Subject: Partially revert "Revert "Audit uses of IsRunning and GetState"" This reverts the revert commit bc67fc97c39628c76a4dbca411b0e8a9bfaf726a, except for the changes in BaseConfigLoader.cpp, which caused the bug that made us revert 72cf2bdb87f09deff22e1085de3290126aa4ad05. PR 12917 contains an improved change to BaseConfigLoader.cpp, which can be merged (or rejected) independently. A few changes have also been made based on review comments. --- Source/Core/DolphinQt/MainWindow.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Source/Core/DolphinQt/MainWindow.cpp') diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index aef6be7bc4..00f33cd255 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -910,7 +910,7 @@ void MainWindow::OnStopComplete() bool MainWindow::RequestStop() { - if (!Core::IsRunning(Core::System::GetInstance())) + if (Core::IsUninitialized(Core::System::GetInstance())) { Core::QueueHostJob([this](Core::System&) { OnStopComplete(); }, true); return true; @@ -1118,7 +1118,7 @@ void MainWindow::StartGame(std::unique_ptr&& parameters) } // If we're running, only start a new game once we've stopped the last. - if (Core::GetState(Core::System::GetInstance()) != Core::State::Uninitialized) + if (!Core::IsUninitialized(Core::System::GetInstance())) { if (!RequestStop()) return; @@ -1542,7 +1542,7 @@ void MainWindow::NetPlayInit() bool MainWindow::NetPlayJoin() { - if (Core::IsRunning(Core::System::GetInstance())) + if (!Core::IsUninitialized(Core::System::GetInstance())) { ModalMessageBox::critical(nullptr, tr("Error"), tr("Can't start a NetPlay Session while a game is still running!")); @@ -1609,7 +1609,7 @@ bool MainWindow::NetPlayJoin() bool MainWindow::NetPlayHost(const UICommon::GameFile& game) { - if (Core::IsRunning(Core::System::GetInstance())) + if (!Core::IsUninitialized(Core::System::GetInstance())) { ModalMessageBox::critical(nullptr, tr("Error"), tr("Can't start a NetPlay Session while a game is still running!")); @@ -1856,7 +1856,7 @@ void MainWindow::OnImportNANDBackup() result.wait(); - m_menu_bar->UpdateToolsMenu(Core::IsRunning(Core::System::GetInstance())); + m_menu_bar->UpdateToolsMenu(Core::State::Uninitialized); } void MainWindow::OnPlayRecording() @@ -1888,7 +1888,8 @@ void MainWindow::OnStartRecording() { auto& system = Core::System::GetInstance(); auto& movie = system.GetMovie(); - if (Core::GetState(system) == Core::State::Starting || movie.IsRecordingInput() || + if (Core::GetState(system) == Core::State::Starting || + Core::GetState(system) == Core::State::Stopping || movie.IsRecordingInput() || movie.IsPlayingInput()) { return; @@ -1920,7 +1921,7 @@ void MainWindow::OnStartRecording() { emit RecordingStatusChanged(true); - if (!Core::IsRunning(system)) + if (Core::IsUninitialized(system)) Play(); } } -- cgit v1.2.3