Core::SetState: Avoid Global System Accessor
This commit is contained in:
1 parent
c23562b7b5
commit
0b04975c26
7 files changed
+20
-21
No files matched your search
@@ -354,9 +354,9 @@ static void CPUSetInitialExecutionState(bool force_paused = false)
|
||||
{
|
||||
// The CPU starts in stepping state, and will wait until a new state is set before executing.
|
||||
// SetState must be called on the host thread, so we defer it for later.
|
||||
QueueHostJob([force_paused](Core::System&) {
|
||||
QueueHostJob([force_paused](Core::System& system) {
|
||||
bool paused = SConfig::GetInstance().bBootToPause || force_paused;
|
||||
SetState(paused ? State::Paused : State::Running);
|
||||
SetState(system, paused ? State::Paused : State::Running);
|
||||
Host_UpdateDisasmDialog();
|
||||
Host_UpdateMainFrame();
|
||||
Host_Message(HostMessageID::WMUserCreate);
|
||||
@@ -700,13 +700,12 @@ static void EmuThread(Core::System& system, std::unique_ptr<BootParameters> boot
|
||||
|
||||
// Set or get the running state
|
||||
|
||||
void SetState(State state, bool report_state_change)
|
||||
void SetState(Core::System& system, State state, bool report_state_change)
|
||||
{
|
||||
// State cannot be controlled until the CPU Thread is operational
|
||||
if (!IsRunningAndStarted())
|
||||
return;
|
||||
|
||||
auto& system = Core::System::GetInstance();
|
||||
switch (state)
|
||||
{
|
||||
case State::Paused:
|
||||
@@ -1061,12 +1060,12 @@ void DoFrameStep(Core::System& system)
|
||||
// if already paused, frame advance for 1 frame
|
||||
s_stop_frame_step = false;
|
||||
s_frame_step = true;
|
||||
SetState(State::Running, false);
|
||||
SetState(system, State::Running, false);
|
||||
}
|
||||
else if (!s_frame_step)
|
||||
{
|
||||
// if not paused yet, pause immediately instead
|
||||
SetState(State::Paused);
|
||||
SetState(system, State::Paused);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user