mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 17:19:44 -06:00
Core::IsRunning: Avoid Global System Accessor
This commit is contained in:
@ -190,7 +190,7 @@ std::string StopMessage(bool main_thread, std::string_view message)
|
||||
|
||||
void DisplayMessage(std::string message, int time_in_ms)
|
||||
{
|
||||
if (!IsRunning())
|
||||
if (!IsRunning(Core::System::GetInstance()))
|
||||
return;
|
||||
|
||||
// Actually displaying non-ASCII could cause things to go pear-shaped
|
||||
@ -200,9 +200,8 @@ void DisplayMessage(std::string message, int time_in_ms)
|
||||
OSD::AddMessage(std::move(message), time_in_ms);
|
||||
}
|
||||
|
||||
bool IsRunning()
|
||||
bool IsRunning(Core::System& system)
|
||||
{
|
||||
auto& system = Core::System::GetInstance();
|
||||
return (GetState(system) != State::Uninitialized || s_hardware_initialized) && !s_is_stopping;
|
||||
}
|
||||
|
||||
@ -237,7 +236,7 @@ bool Init(Core::System& system, std::unique_ptr<BootParameters> boot, const Wind
|
||||
{
|
||||
if (s_emu_thread.joinable())
|
||||
{
|
||||
if (IsRunning())
|
||||
if (IsRunning(system))
|
||||
{
|
||||
PanicAlertFmtT("Emu Thread already running");
|
||||
return false;
|
||||
@ -842,7 +841,7 @@ static bool PauseAndLock(Core::System& system, bool do_lock, bool unpause_on_unl
|
||||
void RunOnCPUThread(Core::System& system, std::function<void()> function, bool wait_for_completion)
|
||||
{
|
||||
// If the CPU thread is not running, assume there is no active CPU thread we can race against.
|
||||
if (!IsRunning() || IsCPUThread())
|
||||
if (!IsRunning(system) || IsCPUThread())
|
||||
{
|
||||
function();
|
||||
return;
|
||||
@ -1038,7 +1037,7 @@ void HostDispatchJobs(Core::System& system)
|
||||
// Core::State::Uninitialized: s_is_booting -> s_hardware_initialized
|
||||
// We need to check variables in the same order as the state
|
||||
// transition, otherwise we race and get transient failures.
|
||||
if (!job.run_after_stop && !s_is_booting.IsSet() && !IsRunning())
|
||||
if (!job.run_after_stop && !s_is_booting.IsSet() && !IsRunning(system))
|
||||
continue;
|
||||
|
||||
guard.unlock();
|
||||
|
Reference in New Issue
Block a user