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.
This commit is contained in:
parent
ad1b61af2e
commit
db7e746cb4
|
@ -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)
|
||||
|
|
|
@ -382,7 +382,7 @@ bool IsNetPlayRecording()
|
|||
|
||||
void ChangePads(bool instantly)
|
||||
{
|
||||
if (Core::GetState() == Core::CORE_UNINITIALIZED)
|
||||
if (!Core::IsRunning())
|
||||
return;
|
||||
|
||||
int controllers = 0;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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'."),
|
||||
|
|
Loading…
Reference in New Issue