If hardware fails to initialize when emulation starts, die gracefully. This should fix issue 4602.

Also don't try to save and load states when the emulator is not running.  This should fix most of issu 4600.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7607 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2011-06-18 04:04:48 +00:00
parent b705b92075
commit c2475f852e
3 changed files with 27 additions and 11 deletions

View File

@ -208,7 +208,11 @@ bool Init()
void Stop() // - Hammertime! void Stop() // - Hammertime!
{ {
if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN) if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN)
{
if (g_EmuThread.joinable())
g_EmuThread.join();
return; return;
}
const SCoreStartupParameter& _CoreParameter = const SCoreStartupParameter& _CoreParameter =
SConfig::GetInstance().m_LocalCoreStartupParameter; SConfig::GetInstance().m_LocalCoreStartupParameter;
@ -346,6 +350,7 @@ void EmuThread()
if (!g_video_backend->Initialize(g_pWindowHandle)) if (!g_video_backend->Initialize(g_pWindowHandle))
{ {
PanicAlert("Failed to initialize video backend!"); PanicAlert("Failed to initialize video backend!");
Host_Message(WM_USER_STOP);
return; return;
} }
@ -357,6 +362,7 @@ void EmuThread()
HW::Shutdown(); HW::Shutdown();
g_video_backend->Shutdown(); g_video_backend->Shutdown();
PanicAlert("Failed to initialize DSP emulator!"); PanicAlert("Failed to initialize DSP emulator!");
Host_Message(WM_USER_STOP);
return; return;
} }

View File

@ -1021,7 +1021,8 @@ void CFrame::DoPause()
// Stop the emulation // Stop the emulation
void CFrame::DoStop() void CFrame::DoStop()
{ {
if (Core::GetState() != Core::CORE_UNINITIALIZED) if (Core::GetState() != Core::CORE_UNINITIALIZED ||
m_RenderParent != NULL)
{ {
#if defined __WXGTK__ #if defined __WXGTK__
wxMutexGuiLeave(); wxMutexGuiLeave();
@ -1466,33 +1467,42 @@ void CFrame::OnSaveStateToFile(wxCommandEvent& WXUNUSED (event))
void CFrame::OnLoadLastState(wxCommandEvent& WXUNUSED (event)) void CFrame::OnLoadLastState(wxCommandEvent& WXUNUSED (event))
{ {
if (Core::GetState() != Core::CORE_UNINITIALIZED)
State::LoadLastSaved(); State::LoadLastSaved();
} }
void CFrame::OnUndoLoadState(wxCommandEvent& WXUNUSED (event)) void CFrame::OnUndoLoadState(wxCommandEvent& WXUNUSED (event))
{ {
if (Core::GetState() != Core::CORE_UNINITIALIZED)
State::UndoLoadState(); State::UndoLoadState();
} }
void CFrame::OnUndoSaveState(wxCommandEvent& WXUNUSED (event)) void CFrame::OnUndoSaveState(wxCommandEvent& WXUNUSED (event))
{ {
if (Core::GetState() != Core::CORE_UNINITIALIZED)
State::UndoSaveState(); State::UndoSaveState();
} }
void CFrame::OnLoadState(wxCommandEvent& event) void CFrame::OnLoadState(wxCommandEvent& event)
{
if (Core::GetState() != Core::CORE_UNINITIALIZED)
{ {
int id = event.GetId(); int id = event.GetId();
int slot = id - IDM_LOADSLOT1 + 1; int slot = id - IDM_LOADSLOT1 + 1;
State::Load(slot); State::Load(slot);
} }
}
void CFrame::OnSaveState(wxCommandEvent& event) void CFrame::OnSaveState(wxCommandEvent& event)
{
if (Core::GetState() != Core::CORE_UNINITIALIZED)
{ {
int id = event.GetId(); int id = event.GetId();
int slot = id - IDM_SAVESLOT1 + 1; int slot = id - IDM_SAVESLOT1 + 1;
State::Save(slot); State::Save(slot);
} }
}
void CFrame::OnFrameSkip(wxCommandEvent& event) void CFrame::OnFrameSkip(wxCommandEvent& event)
{ {