Several little fixes.

Fixed a segfault in linux when a cd/dvd drive is empty or invalid and "Boot from DVD" or "Show Drives" are selected.
On all platforms if a game fails to load show the game list again.
The other things here are essentially code cleanup and won't be noticeable by most users.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5204 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice
2010-03-17 01:54:40 +00:00
parent a7b03fd2cd
commit 721935c6ff
9 changed files with 54 additions and 39 deletions

View File

@ -470,6 +470,7 @@ bool game_loading = false;
// 3. Boot last selected game
void CFrame::BootGame(const std::string& filename)
{
bool success = false;
SCoreStartupParameter& StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter;
if (Core::GetState() != Core::CORE_UNINITIALIZED)
@ -479,23 +480,23 @@ void CFrame::BootGame(const std::string& filename)
// Start the selected ISO, or try one of the saved paths.
// If all that fails, ask to add a dir and don't boot
if (!filename.empty())
BootManager::BootCore(filename);
success = BootManager::BootCore(filename);
else if (m_GameListCtrl->GetSelectedISO() != NULL)
{
if (m_GameListCtrl->GetSelectedISO()->IsValid())
BootManager::BootCore(m_GameListCtrl->GetSelectedISO()->GetFileName());
success = BootManager::BootCore(m_GameListCtrl->GetSelectedISO()->GetFileName());
}
else if (!StartUp.m_strDefaultGCM.empty()
&& wxFileExists(wxString(StartUp.m_strDefaultGCM.c_str(), wxConvUTF8)))
{
BootManager::BootCore(StartUp.m_strDefaultGCM);
success = BootManager::BootCore(StartUp.m_strDefaultGCM);
}
else
{
if (!SConfig::GetInstance().m_LastFilename.empty()
&& wxFileExists(wxString(SConfig::GetInstance().m_LastFilename.c_str(), wxConvUTF8)))
{
BootManager::BootCore(SConfig::GetInstance().m_LastFilename);
success = BootManager::BootCore(SConfig::GetInstance().m_LastFilename);
}
else
{
@ -506,6 +507,12 @@ void CFrame::BootGame(const std::string& filename)
return;
}
}
if (!success)
{
game_loading = false;
m_GameListCtrl->Enable();
m_GameListCtrl->Show();
}
}
// Open file to boot
@ -546,13 +553,7 @@ void CFrame::DoOpen(bool Boot)
{
if (!fileChosen)
return;
BootManager::BootCore(std::string(path.mb_str()));
// Game has been started, hide the game list
if (m_GameListCtrl->IsShown())
{
m_GameListCtrl->Disable();
m_GameListCtrl->Hide();
}
StartGame(std::string(path.mb_str()));
}
else
{
@ -661,7 +662,7 @@ void CFrame::StartGame(const std::string& filename)
void CFrame::OnBootDrive(wxCommandEvent& event)
{
BootManager::BootCore(drives[event.GetId()-IDM_DRIVE1].c_str());
StartGame(drives[event.GetId()-IDM_DRIVE1]);
}