Remove references to global CoreThread (use accessor)

This commit is contained in:
Connor McLaughlin 2021-08-19 17:59:02 +10:00 committed by Kojin
parent 324a3d09e6
commit 6b2a865e57
4 changed files with 15 additions and 19 deletions

View File

@ -18,7 +18,6 @@
#include "DebugInterface.h" #include "DebugInterface.h"
#include "Memory.h" #include "Memory.h"
#include "R5900.h" #include "R5900.h"
#include "gui/AppCoreThread.h"
#include "Debug.h" #include "Debug.h"
#include "VU.h" #include "VU.h"
#include "GS.h" // Required for gsNonMirroredRead() #include "GS.h" // Required for gsNonMirroredRead()
@ -28,8 +27,6 @@
#include "IopMem.h" #include "IopMem.h"
#include "SymbolMap.h" #include "SymbolMap.h"
extern AppCoreThread CoreThread;
R5900DebugInterface r5900Debug; R5900DebugInterface r5900Debug;
R3000DebugInterface r3000Debug; R3000DebugInterface r3000Debug;

View File

@ -469,7 +469,7 @@ SocketIPC::IPCBuffer SocketIPC::ParseCommand(char* buf, char* ret_buffer, u32 bu
switch (m_vm->HasActiveMachine()) switch (m_vm->HasActiveMachine())
{ {
case true: case true:
if (CoreThread.IsClosing()) if (GetCoreThread().IsClosing())
status = Paused; status = Paused;
else else
status = Running; status = Running;

View File

@ -374,7 +374,7 @@ bool InputRecording::Play(wxWindow* parent, wxString filename)
// Either load the savestate, or restart the game // Either load the savestate, or restart the game
if (inputRecordingData.FromSaveState()) if (inputRecordingData.FromSaveState())
{ {
if (!CoreThread.IsOpen()) if (!GetCoreThread().IsOpen())
{ {
inputRec::consoleLog("Game is not open, aborting playing input recording which starts on a save-state."); inputRec::consoleLog("Game is not open, aborting playing input recording which starts on a save-state.");
inputRecordingData.Close(); inputRecordingData.Close();

View File

@ -20,7 +20,6 @@
#include "Counters.h" #include "Counters.h"
#include "DebugTools/Debug.h" #include "DebugTools/Debug.h"
#include "MemoryTypes.h" #include "MemoryTypes.h"
#include "gui/App.h"
#include "gui/MainFrame.h" #include "gui/MainFrame.h"
#include "InputRecording.h" #include "InputRecording.h"
@ -68,24 +67,24 @@ void InputRecordingControls::HandlePausingAndLocking()
frameLock = false; frameLock = false;
Resume(); Resume();
} }
else if (!emulationCurrentlyPaused && CoreThread.IsOpen() && CoreThread.IsRunning()) else if (!emulationCurrentlyPaused && GetCoreThread().IsOpen() && GetCoreThread().IsRunning())
{ {
emulationCurrentlyPaused = true; emulationCurrentlyPaused = true;
CoreThread.PauseSelf(); GetCoreThread().PauseSelf();
} }
} }
else if (pauseEmulation && CoreThread.IsOpen() && CoreThread.IsRunning()) else if (pauseEmulation && GetCoreThread().IsOpen() && GetCoreThread().IsRunning())
{ {
emulationCurrentlyPaused = true; emulationCurrentlyPaused = true;
CoreThread.PauseSelf(); GetCoreThread().PauseSelf();
} }
} }
void InputRecordingControls::ResumeCoreThreadIfStarted() void InputRecordingControls::ResumeCoreThreadIfStarted()
{ {
if (resumeEmulation && CoreThread.IsOpen()) if (resumeEmulation && GetCoreThread().IsOpen())
{ {
CoreThread.Resume(); GetCoreThread().Resume();
resumeEmulation = false; resumeEmulation = false;
emulationCurrentlyPaused = false; emulationCurrentlyPaused = false;
} }
@ -115,7 +114,7 @@ bool InputRecordingControls::IsFrameAdvancing()
bool InputRecordingControls::IsPaused() bool InputRecordingControls::IsPaused()
{ {
return emulationCurrentlyPaused && CoreThread.IsOpen() && CoreThread.IsPaused(); return emulationCurrentlyPaused && GetCoreThread().IsOpen() && GetCoreThread().IsPaused();
} }
void InputRecordingControls::Pause() void InputRecordingControls::Pause()
@ -126,13 +125,13 @@ void InputRecordingControls::Pause()
void InputRecordingControls::PauseImmediately() void InputRecordingControls::PauseImmediately()
{ {
if (!CoreThread.IsPaused()) if (!GetCoreThread().IsPaused())
{ {
Pause(); Pause();
if (CoreThread.IsOpen() && CoreThread.IsRunning()) if (GetCoreThread().IsOpen() && GetCoreThread().IsRunning())
{ {
emulationCurrentlyPaused = true; emulationCurrentlyPaused = true;
CoreThread.PauseSelf(); GetCoreThread().PauseSelf();
} }
} }
} }
@ -150,13 +149,13 @@ void InputRecordingControls::Resume()
void InputRecordingControls::ResumeImmediately() void InputRecordingControls::ResumeImmediately()
{ {
if (CoreThread.IsPaused()) if (GetCoreThread().IsPaused())
{ {
Resume(); Resume();
if (CoreThread.IsRunning()) if (GetCoreThread().IsRunning())
{ {
emulationCurrentlyPaused = false; emulationCurrentlyPaused = false;
CoreThread.Resume(); GetCoreThread().Resume();
} }
} }
} }