Play button is now be enabled and disabled at the correct times.

Game list is hidden while games are running.
Fixes issue 2078


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4923 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice
2010-01-22 21:41:25 +00:00
parent 8c2bae9802
commit c09ec17bb2
5 changed files with 26 additions and 35 deletions

View File

@ -464,8 +464,8 @@ void CFrame::InitBitmaps()
aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
}
// Game loading state
bool game_loading = false;
// Menu items
@ -474,16 +474,19 @@ void CFrame::InitBitmaps()
// 1. Show the game list and boot the selected game.
// 2. Default ISO
// 3. Boot last selected game
void CFrame::BootGame()
void CFrame::BootGame(const std::string& filename)
{
SCoreStartupParameter& StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter;
if (Core::GetState() != Core::CORE_UNINITIALIZED)
return;
// Start filename if non empty.
// 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 (m_GameListCtrl->GetSelectedISO() != NULL)
if (!filename.empty())
BootManager::BootCore(filename);
else if (m_GameListCtrl->GetSelectedISO() != NULL)
{
if (m_GameListCtrl->GetSelectedISO()->IsValid())
BootManager::BootCore(m_GameListCtrl->GetSelectedISO()->GetFileName());
@ -503,6 +506,7 @@ void CFrame::BootGame()
else
{
m_GameListCtrl->BrowseForDirectory();
game_loading = false;
m_GameListCtrl->Enable();
m_GameListCtrl->Show();
return;
@ -590,7 +594,7 @@ void CFrame::OnRecord(wxCommandEvent& WXUNUSED (event))
// TODO: Take controller settings from Gamecube Configuration menu
if(Frame::BeginRecordingInput(path.mb_str(), 1))
BootGame();
BootGame(std::string(""));
}
void CFrame::OnPlayRecording(wxCommandEvent& WXUNUSED (event))
@ -611,12 +615,9 @@ void CFrame::OnPlayRecording(wxCommandEvent& WXUNUSED (event))
return;
if(Frame::PlayInput(path.mb_str()))
BootGame();
BootGame(std::string(""));
}
// Game loading state
bool game_loading = false;
void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event))
{
if (Core::GetState() != Core::CORE_UNINITIALIZED)
@ -645,11 +646,11 @@ void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event))
}
else
// Core is uninitialized, start the game
StartGame();
StartGame(std::string(""));
}
// Prepare the GUI to start the game.
void CFrame::StartGame()
void CFrame::StartGame(const std::string& filename)
{
game_loading = true;
@ -664,7 +665,7 @@ void CFrame::StartGame()
m_GameListCtrl->Hide();
}
BootGame();
BootGame(filename);
}
void CFrame::OnBootDrive(wxCommandEvent& event)
@ -1068,7 +1069,7 @@ void CFrame::UpdateGUI()
if (!Initialized)
{
if (Core::GetStartupParameter().m_strFilename.empty())
if (m_GameListCtrl->IsEnabled())
{
// Prepare to load Default ISO, enable play button
if (!Core::GetStartupParameter().m_strDefaultGCM.empty())
@ -1093,13 +1094,6 @@ void CFrame::UpdateGUI()
GetMenuBar()->FindItem(IDM_PLAY)->Enable(false);
}
}
else
{
// Loading Default ELF automatically, disable play button
if (m_ToolBar)
m_ToolBar->EnableTool(IDM_PLAY, false);
GetMenuBar()->FindItem(IDM_PLAY)->Enable(false);
}
if (m_GameListCtrl && !game_loading)
{