summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorJules Blok <jules.blok@gmail.com>2014-07-08 00:47:57 +0200
committerJules Blok <jules.blok@gmail.com>2014-07-08 22:30:44 +0200
commitdb7e746cb423de5ca47be7a3df7c4918a610ff5a (patch)
tree43d90ab33c8001daa493173c717ab52bee3d494d /Source
parentad1b61af2e5d5b4c63c6d7ed052775e1c2858c39 (diff)
Check whether the core is running instead of checking if it is unitialized.
This properly handles the stopping state and more accurately represents the intended check.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/Debugger/Debugger_SymbolMap.cpp3
-rw-r--r--Source/Core/Core/Movie.cpp2
-rw-r--r--Source/Core/Core/State.cpp2
-rw-r--r--Source/Core/DolphinWX/ConfigMain.cpp12
-rw-r--r--Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp2
-rw-r--r--Source/Core/DolphinWX/Frame.cpp7
-rw-r--r--Source/Core/DolphinWX/FrameTools.cpp4
-rw-r--r--Source/Core/DolphinWX/MainNoGUI.cpp2
-rw-r--r--Source/Core/DolphinWX/VideoConfigDiag.cpp9
-rw-r--r--Source/Core/DolphinWX/VideoConfigDiag.h2
10 files changed, 21 insertions, 24 deletions
diff --git a/Source/Core/Core/Debugger/Debugger_SymbolMap.cpp b/Source/Core/Core/Debugger/Debugger_SymbolMap.cpp
index 112c4c310b..b0dab163a5 100644
--- a/Source/Core/Core/Debugger/Debugger_SymbolMap.cpp
+++ b/Source/Core/Core/Debugger/Debugger_SymbolMap.cpp
@@ -69,8 +69,7 @@ void WalkTheStack(const std::function<void(u32)>& stack_step)
// instead of "pointing ahead"
bool GetCallstack(std::vector<CallstackEntry> &output)
{
- if (Core::GetState() == Core::CORE_UNINITIALIZED ||
- !Memory::IsRAMAddress(PowerPC::ppcState.gpr[1]))
+ if (!Core::IsRunning() || !Memory::IsRAMAddress(PowerPC::ppcState.gpr[1]))
return false;
if (LR == 0)
diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp
index c90b0e2512..538248c909 100644
--- a/Source/Core/Core/Movie.cpp
+++ b/Source/Core/Core/Movie.cpp
@@ -382,7 +382,7 @@ bool IsNetPlayRecording()
void ChangePads(bool instantly)
{
- if (Core::GetState() == Core::CORE_UNINITIALIZED)
+ if (!Core::IsRunning())
return;
int controllers = 0;
diff --git a/Source/Core/Core/State.cpp b/Source/Core/Core/State.cpp
index 55cd1a2fa7..a4619ad752 100644
--- a/Source/Core/Core/State.cpp
+++ b/Source/Core/Core/State.cpp
@@ -424,7 +424,7 @@ void LoadFileStateData(const std::string& filename, std::vector<u8>& ret_data)
void LoadAs(const std::string& filename)
{
- if (Core::GetState() == Core::CORE_UNINITIALIZED)
+ if (!Core::IsRunning())
return;
// Stop the core while we load the state
diff --git a/Source/Core/DolphinWX/ConfigMain.cpp b/Source/Core/DolphinWX/ConfigMain.cpp
index c74400a73f..9208b70b08 100644
--- a/Source/Core/DolphinWX/ConfigMain.cpp
+++ b/Source/Core/DolphinWX/ConfigMain.cpp
@@ -230,7 +230,7 @@ void CConfigMain::SetSelectedTab(int tab)
// Used to restrict changing of some options while emulator is running
void CConfigMain::UpdateGUI()
{
- if (Core::GetState() != Core::CORE_UNINITIALIZED)
+ if (Core::IsRunning())
{
// Disable the Core stuff on GeneralPage
CPUThread->Disable();
@@ -669,7 +669,7 @@ void CConfigMain::CreateGUIControls()
Latency->Bind(wxEVT_SPINCTRL, &CConfigMain::AudioSettingsChanged, this);
- if (Core::GetState() != Core::CORE_UNINITIALIZED)
+ if (Core::IsRunning())
{
Latency->Disable();
BackendSelection->Disable();
@@ -888,7 +888,7 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
{
// Core - Basic
case ID_CPUTHREAD:
- if (Core::GetState() != Core::CORE_UNINITIALIZED)
+ if (Core::IsRunning())
return;
SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread = CPUThread->IsChecked();
break;
@@ -1099,7 +1099,7 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
{
strMemcard = filename;
- if (Core::GetState() != Core::CORE_UNINITIALIZED)
+ if (Core::IsRunning())
{
// Change memcard to the new file
ExpansionInterface::ChangeDevice(
@@ -1136,7 +1136,7 @@ void CConfigMain::ChooseSIDevice(wxString deviceName, int deviceNum)
SConfig::GetInstance().m_SIDevice[deviceNum] = tempType;
- if (Core::GetState() != Core::CORE_UNINITIALIZED)
+ if (Core::IsRunning())
{
// Change plugged device! :D
SerialInterface::ChangeDevice(tempType, deviceNum);
@@ -1172,7 +1172,7 @@ void CConfigMain::ChooseEXIDevice(wxString deviceName, int deviceNum)
SConfig::GetInstance().m_EXIDevice[deviceNum] = tempType;
- if (Core::GetState() != Core::CORE_UNINITIALIZED)
+ if (Core::IsRunning())
{
// Change plugged device! :D
ExpansionInterface::ChangeDevice(
diff --git a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp
index 41abb27300..9f3c081c16 100644
--- a/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp
+++ b/Source/Core/DolphinWX/Debugger/CodeWindowFunctions.cpp
@@ -219,7 +219,7 @@ void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event)
{
Parent->ClearStatusBar();
- if (Core::GetState() == Core::CORE_UNINITIALIZED) return;
+ if (!Core::IsRunning()) return;
std::string existing_map_file, writable_map_file;
bool map_exists = CBoot::FindMapFile(&existing_map_file,
diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp
index 38b8ae7df0..03cc67250d 100644
--- a/Source/Core/DolphinWX/Frame.cpp
+++ b/Source/Core/DolphinWX/Frame.cpp
@@ -217,7 +217,7 @@ WXLRESULT CRenderFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPa
case WM_CLOSE:
// Let Core finish initializing before accepting any WM_CLOSE messages
- if (Core::GetState() == Core::CORE_UNINITIALIZED) break;
+ if (!Core::IsRunning()) break;
// Use default action otherwise
default:
@@ -722,7 +722,7 @@ void CFrame::GetRenderWindowSize(int& x, int& y, int& width, int& height)
void CFrame::OnRenderWindowSizeRequest(int width, int height)
{
- if (Core::GetState() == Core::CORE_UNINITIALIZED ||
+ if (!Core::IsRunning() ||
!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderWindowAutoSize ||
RendererIsFullscreen() || m_RenderFrame->IsMaximized())
return;
@@ -1109,8 +1109,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
void CFrame::OnKeyUp(wxKeyEvent& event)
{
- if(Core::GetState() != Core::CORE_UNINITIALIZED &&
- (RendererHasFocus() || TASInputHasFocus()))
+ if(Core::IsRunning() && (RendererHasFocus() || TASInputHasFocus()))
{
if (IsHotkey(event, HK_TOGGLE_THROTTLE))
{
diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp
index 66a5aa6858..7cd29d7ef5 100644
--- a/Source/Core/DolphinWX/FrameTools.cpp
+++ b/Source/Core/DolphinWX/FrameTools.cpp
@@ -802,7 +802,7 @@ void CFrame::OnRecordExport(wxCommandEvent& WXUNUSED (event))
void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event))
{
- if (Core::GetState() != Core::CORE_UNINITIALIZED)
+ if (Core::IsRunning())
{
// Core is initialized and emulator is running
if (UseDebugger)
@@ -1581,7 +1581,7 @@ void CFrame::OnLoadLastState(wxCommandEvent& event)
void CFrame::OnSaveFirstState(wxCommandEvent& WXUNUSED(event))
{
- if (Core::GetState() != Core::CORE_UNINITIALIZED)
+ if (Core::IsRunningAndStarted())
State::SaveFirstSaved();
}
diff --git a/Source/Core/DolphinWX/MainNoGUI.cpp b/Source/Core/DolphinWX/MainNoGUI.cpp
index d4b75d83cb..0345e20b2b 100644
--- a/Source/Core/DolphinWX/MainNoGUI.cpp
+++ b/Source/Core/DolphinWX/MainNoGUI.cpp
@@ -131,7 +131,7 @@ void Host_SetWiiMoteConnectionState(int _State) {}
void X11_MainLoop()
{
bool fullscreen = SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen;
- while (Core::GetState() == Core::CORE_UNINITIALIZED)
+ while (!Core::IsRunning())
updateMainFrameEvent.Wait();
Display *dpy = XOpenDisplay(0);
diff --git a/Source/Core/DolphinWX/VideoConfigDiag.cpp b/Source/Core/DolphinWX/VideoConfigDiag.cpp
index 26d8b6c76e..2d70863452 100644
--- a/Source/Core/DolphinWX/VideoConfigDiag.cpp
+++ b/Source/Core/DolphinWX/VideoConfigDiag.cpp
@@ -246,7 +246,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
szr_basic->Add(label_backend, 1, wxALIGN_CENTER_VERTICAL, 5);
szr_basic->Add(choice_backend, 1, 0, 0);
- if (Core::GetState() != Core::CORE_UNINITIALIZED)
+ if (Core::IsRunning())
{
label_backend->Disable();
choice_backend->Disable();
@@ -291,7 +291,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
szr_display->Add(label_display_resolution, 1, wxALIGN_CENTER_VERTICAL, 0);
szr_display->Add(choice_display_resolution);
- if (Core::GetState() != Core::CORE_UNINITIALIZED)
+ if (Core::IsRunning())
{
label_display_resolution->Disable();
choice_display_resolution->Disable();
@@ -328,9 +328,8 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
szr_other->Add(CreateCheckBox(page_general, _("Hide Mouse Cursor"), wxGetTranslation(hide_mouse_cursor_desc), SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor));
szr_other->Add(render_to_main_cb = CreateCheckBox(page_general, _("Render to Main Window"), wxGetTranslation(render_to_main_win_desc), SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain));
- if (Core::GetState() != Core::CORE_UNINITIALIZED)
+ if (Core::IsRunning())
render_to_main_cb->Disable();
-
}
@@ -576,7 +575,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
wxCheckBox* const cb_prog_scan = new wxCheckBox(page_advanced, wxID_ANY, _("Enable Progressive Scan"));
RegisterControl(cb_prog_scan, wxGetTranslation(prog_scan_desc));
cb_prog_scan->Bind(wxEVT_CHECKBOX, &VideoConfigDiag::Event_ProgressiveScan, this);
- if (Core::GetState() != Core::CORE_UNINITIALIZED)
+ if (Core::IsRunning())
cb_prog_scan->Disable();
cb_prog_scan->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive);
diff --git a/Source/Core/DolphinWX/VideoConfigDiag.h b/Source/Core/DolphinWX/VideoConfigDiag.h
index 695a01ee7a..c17506351b 100644
--- a/Source/Core/DolphinWX/VideoConfigDiag.h
+++ b/Source/Core/DolphinWX/VideoConfigDiag.h
@@ -86,7 +86,7 @@ protected:
VideoBackend* new_backend = g_available_video_backends[ev.GetInt()];
if (g_video_backend != new_backend)
{
- bool do_switch = Core::GetState() == Core::CORE_UNINITIALIZED;
+ bool do_switch = !Core::IsRunning();
if (new_backend->GetName() == "Software Renderer")
{
do_switch = (wxYES == wxMessageBox(_("Software rendering is an order of magnitude slower than using the other backends.\nIt's only useful for debugging purposes.\nDo you really want to enable software rendering? If unsure, select 'No'."),