mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
Logical reorderring of the GUI boot sequence. Also a little clean up in the OpenGL plugin.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5379 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -483,9 +483,6 @@ void CFrame::InitBitmaps()
|
||||
aNormalFile = wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_OTHER, wxSize(16,16));
|
||||
}
|
||||
|
||||
// Game loading state
|
||||
bool game_loading = false;
|
||||
|
||||
// Menu items
|
||||
|
||||
// Start the game or change the disc.
|
||||
@ -495,7 +492,7 @@ bool game_loading = false;
|
||||
// 3. Boot last selected game
|
||||
void CFrame::BootGame(const std::string& filename)
|
||||
{
|
||||
bool success = false;
|
||||
std::string bootfile = filename;
|
||||
SCoreStartupParameter& StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter;
|
||||
|
||||
if (Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||
@ -504,44 +501,30 @@ void CFrame::BootGame(const std::string& filename)
|
||||
// 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 (!filename.empty())
|
||||
success = BootManager::BootCore(filename);
|
||||
else if (m_GameListCtrl->GetSelectedISO() != NULL)
|
||||
if (bootfile.empty())
|
||||
{
|
||||
if (m_GameListCtrl->GetSelectedISO()->IsValid())
|
||||
success = BootManager::BootCore(m_GameListCtrl->GetSelectedISO()->GetFileName());
|
||||
}
|
||||
else if (!StartUp.m_strDefaultGCM.empty()
|
||||
&& wxFileExists(wxString(StartUp.m_strDefaultGCM.c_str(), wxConvUTF8)))
|
||||
{
|
||||
success = BootManager::BootCore(StartUp.m_strDefaultGCM);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!SConfig::GetInstance().m_LastFilename.empty()
|
||||
&& wxFileExists(wxString(SConfig::GetInstance().m_LastFilename.c_str(), wxConvUTF8)))
|
||||
if (m_GameListCtrl->GetSelectedISO() != NULL)
|
||||
{
|
||||
success = BootManager::BootCore(SConfig::GetInstance().m_LastFilename);
|
||||
if (m_GameListCtrl->GetSelectedISO()->IsValid())
|
||||
bootfile = m_GameListCtrl->GetSelectedISO()->GetFileName();
|
||||
}
|
||||
else if (!StartUp.m_strDefaultGCM.empty()
|
||||
&& wxFileExists(wxString(StartUp.m_strDefaultGCM.c_str(), wxConvUTF8)))
|
||||
bootfile = StartUp.m_strDefaultGCM;
|
||||
else
|
||||
{
|
||||
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
||||
m_RenderFrame->Destroy();
|
||||
m_GameListCtrl->BrowseForDirectory();
|
||||
game_loading = false;
|
||||
m_GameListCtrl->Enable();
|
||||
m_GameListCtrl->Show();
|
||||
return;
|
||||
if (!SConfig::GetInstance().m_LastFilename.empty()
|
||||
&& wxFileExists(wxString(SConfig::GetInstance().m_LastFilename.c_str(), wxConvUTF8)))
|
||||
bootfile = SConfig::GetInstance().m_LastFilename;
|
||||
else
|
||||
{
|
||||
m_GameListCtrl->BrowseForDirectory();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!success)
|
||||
{
|
||||
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
||||
m_RenderFrame->Destroy();
|
||||
game_loading = false;
|
||||
m_GameListCtrl->Enable();
|
||||
m_GameListCtrl->Show();
|
||||
}
|
||||
if (!bootfile.empty())
|
||||
StartGame(bootfile);
|
||||
}
|
||||
|
||||
// Open file to boot
|
||||
@ -582,7 +565,7 @@ void CFrame::DoOpen(bool Boot)
|
||||
{
|
||||
if (!fileChosen)
|
||||
return;
|
||||
StartGame(std::string(path.mb_str()));
|
||||
BootGame(std::string(path.mb_str()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -667,13 +650,12 @@ void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event))
|
||||
}
|
||||
else
|
||||
// Core is uninitialized, start the game
|
||||
StartGame(std::string(""));
|
||||
BootGame(std::string(""));
|
||||
}
|
||||
|
||||
void CFrame::OnRenderParentClose(wxCloseEvent& event)
|
||||
{
|
||||
if ((Core::GetState() == Core::CORE_RUN) || (Core::GetState() == Core::CORE_PAUSE))
|
||||
DoStop();
|
||||
DoStop();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
@ -689,30 +671,27 @@ void CFrame::OnRenderParentMove(wxMoveEvent& event)
|
||||
|
||||
void CFrame::OnRenderParentResize(wxSizeEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
if (Core::GetState() == Core::CORE_RUN || Core::GetState() == Core::CORE_PAUSE)
|
||||
int width, height;
|
||||
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain &&
|
||||
!RendererIsFullscreen() && !m_RenderFrame->IsMaximized())
|
||||
{
|
||||
int width, height;
|
||||
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain &&
|
||||
!RendererIsFullscreen() && !m_RenderFrame->IsMaximized())
|
||||
{
|
||||
m_RenderFrame->GetSize(&width, &height);
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth = width;
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight = height;
|
||||
}
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
int x, y;
|
||||
m_RenderParent->GetSize(&width, &height);
|
||||
m_RenderParent->GetPosition(&x, &y);
|
||||
X11_SendClientEvent("RESIZE", x, y, width, height);
|
||||
#endif
|
||||
m_RenderFrame->GetSize(&width, &height);
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth = width;
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight = height;
|
||||
}
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
int x, y;
|
||||
m_RenderParent->GetSize(&width, &height);
|
||||
m_RenderParent->GetPosition(&x, &y);
|
||||
X11_SendClientEvent("RESIZE", x, y, width, height);
|
||||
#endif
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
// Prepare the GUI to start the game.
|
||||
void CFrame::StartGame(const std::string& filename)
|
||||
{
|
||||
game_loading = true;
|
||||
m_bGameLoading = true;
|
||||
|
||||
if (m_ToolBar)
|
||||
m_ToolBar->EnableTool(IDM_PLAY, false);
|
||||
@ -746,27 +725,41 @@ void CFrame::StartGame(const std::string& filename)
|
||||
m_RenderFrame->Connect(wxID_ANY, wxEVT_MOVE,
|
||||
wxMoveEventHandler(CFrame::OnRenderParentMove),
|
||||
(wxObject*)0, this);
|
||||
m_RenderFrame->Connect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard
|
||||
wxKeyEventHandler(CFrame::OnKeyDown),
|
||||
(wxObject*)0, this);
|
||||
m_RenderParent = new CPanel(m_RenderFrame, wxID_ANY);
|
||||
m_RenderFrame->Show();
|
||||
}
|
||||
m_RenderFrame->Connect(wxID_ANY, wxEVT_SIZE,
|
||||
wxSizeEventHandler(CFrame::OnRenderParentResize),
|
||||
(wxObject*)0, this);
|
||||
#ifdef _WIN32
|
||||
::SetFocus((HWND)m_RenderParent->GetHandle());
|
||||
#else
|
||||
m_RenderParent->SetFocus();
|
||||
#endif
|
||||
|
||||
BootGame(filename);
|
||||
if (!BootManager::BootCore(filename))
|
||||
{
|
||||
// Destroy the renderer frame when not rendering to main
|
||||
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
||||
m_RenderFrame->Destroy();
|
||||
m_RenderParent = NULL;
|
||||
m_bGameLoading = false;
|
||||
UpdateGUI();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard
|
||||
wxKeyEventHandler(CFrame::OnKeyDown),
|
||||
(wxObject*)0, this);
|
||||
wxTheApp->Connect(wxID_ANY, wxEVT_KEY_UP,
|
||||
wxKeyEventHandler(CFrame::OnKeyUp),
|
||||
(wxObject*)0, this);
|
||||
m_RenderFrame->Connect(wxID_ANY, wxEVT_SIZE,
|
||||
wxSizeEventHandler(CFrame::OnRenderParentResize),
|
||||
(wxObject*)0, this);
|
||||
}
|
||||
}
|
||||
|
||||
void CFrame::OnBootDrive(wxCommandEvent& event)
|
||||
{
|
||||
StartGame(drives[event.GetId()-IDM_DRIVE1]);
|
||||
BootGame(drives[event.GetId()-IDM_DRIVE1]);
|
||||
}
|
||||
|
||||
|
||||
@ -843,6 +836,15 @@ void CFrame::DoStop()
|
||||
UpdateGUI();
|
||||
|
||||
// Destroy the renderer frame when not rendering to main
|
||||
m_RenderFrame->Disconnect(wxID_ANY, wxEVT_SIZE,
|
||||
wxSizeEventHandler(CFrame::OnRenderParentResize),
|
||||
(wxObject*)0, this);
|
||||
wxTheApp->Disconnect(wxID_ANY, wxEVT_KEY_DOWN, // Keyboard
|
||||
wxKeyEventHandler(CFrame::OnKeyDown),
|
||||
(wxObject*)0, this);
|
||||
wxTheApp->Disconnect(wxID_ANY, wxEVT_KEY_UP,
|
||||
wxKeyEventHandler(CFrame::OnKeyUp),
|
||||
(wxObject*)0, this);
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
|
||||
m_RenderParent->SetCursor(wxCURSOR_ARROW);
|
||||
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
||||
@ -863,7 +865,7 @@ void CFrame::DoStop()
|
||||
|
||||
void CFrame::OnStop(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
game_loading = false;
|
||||
m_bGameLoading = false;
|
||||
DoStop();
|
||||
}
|
||||
|
||||
@ -1000,7 +1002,7 @@ void CFrame::OnShow_CheatsWindow(wxCommandEvent& WXUNUSED (event))
|
||||
|
||||
void CFrame::OnLoadWiiMenu(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
StartGame(std::string (File::GetUserPath(D_WIIMENU_IDX)));
|
||||
BootGame(std::string (File::GetUserPath(D_WIIMENU_IDX)));
|
||||
}
|
||||
|
||||
void CFrame::OnConnectWiimote(wxCommandEvent& event)
|
||||
@ -1222,7 +1224,7 @@ void CFrame::UpdateGUI()
|
||||
}
|
||||
}
|
||||
|
||||
if (m_GameListCtrl && !game_loading)
|
||||
if (m_GameListCtrl && !m_bGameLoading)
|
||||
{
|
||||
// Game has not started, show game list
|
||||
if (!m_GameListCtrl->IsShown())
|
||||
@ -1233,7 +1235,7 @@ void CFrame::UpdateGUI()
|
||||
sizerPanel->FitInside(m_Panel);
|
||||
}
|
||||
// Game has been selected but not started, enable play button
|
||||
if (m_GameListCtrl->GetSelectedISO() != NULL && m_GameListCtrl->IsEnabled() && !game_loading)
|
||||
if (m_GameListCtrl->GetSelectedISO() != NULL && m_GameListCtrl->IsEnabled() && !m_bGameLoading)
|
||||
{
|
||||
if (m_ToolBar)
|
||||
m_ToolBar->EnableTool(IDM_PLAY, true);
|
||||
@ -1249,7 +1251,7 @@ void CFrame::UpdateGUI()
|
||||
GetMenuBar()->FindItem(IDM_PLAY)->Enable(true);
|
||||
|
||||
// Reset game loading flag
|
||||
game_loading = false;
|
||||
m_bGameLoading = false;
|
||||
}
|
||||
|
||||
if (m_ToolBar) m_ToolBar->Refresh();
|
||||
|
Reference in New Issue
Block a user