Do not BootGame if there are no items in the GameListCtrl, fix test to see if cancel was chosen from File > Open.

Fixes issue 1046.
it does leak 10kB every time that GetSelectedISO is called, I am not too worried about this. The other ways of accomplishing this would be more complicated, for little gain. Feel free to revert everything except line 466 of FrameTools.cpp :P

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3625 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2009-07-01 04:55:53 +00:00
parent 656ba06e40
commit 52e424485f
3 changed files with 8 additions and 7 deletions

View File

@ -508,8 +508,8 @@ void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event))
// 2. All Regions are set to hide
// Otherwise call BootGame to either...
// 1. Boot the selected iso
// 2. Call BrowseForDirectory and boot the default or last loaded iso.
// TODO: (LPFaint99) We shouldn't boot an iso after BrowseForDirectory
// 2. Boot the default or last loaded iso.
// 3. Call BrowseForDirectory if the gamelist is empty
if (!m_GameListCtrl->GetGameNames().size() &&
!((SConfig::GetInstance().m_ListGC ||
SConfig::GetInstance().m_ListWii ||

View File

@ -420,8 +420,9 @@ void CFrame::BootGame()
}
UpdateGUI();
}
// Start the selected ISO
else if (m_GameListCtrl->GetSelectedISO() != 0)
// Start the selected ISO, return if gamelist is empty
else if (m_GameListCtrl->GetSelectedISO() == 0) return;
else if (m_GameListCtrl->GetSelectedISO()->IsValid())
{
BootManager::BootCore(m_GameListCtrl->GetSelectedISO()->GetFileName());
}
@ -462,7 +463,7 @@ void CFrame::DoOpen(bool Boot)
wxFD_OPEN | wxFD_PREVIEW | wxFD_FILE_MUST_EXIST,
this);
bool fileChosen = path ? true : false;
bool fileChosen = !path.IsEmpty();
std::string currentDir2 = File::GetCurrentDirectory();

View File

@ -727,8 +727,8 @@ const GameListItem * CGameListCtrl::GetSelectedISO()
else
{
long item = GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
if (item == -1) // -1 means the selection is bogus, not a gamelistitem
return 0;
if (item == wxNOT_FOUND)
return new GameListItem("");
else
{
// Here is a little workaround for multiselections: