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

View File

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