diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 1d3897b74f..4d6e393104 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -702,7 +702,7 @@ void CFrame::OnGameListCtrl_ItemActivated(wxListEvent& WXUNUSED (event)) } else // Game started by double click - StartGame(); + StartGame(std::string("")); } void CFrame::OnKeyDown(wxKeyEvent& event) diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index 9d7bf90aa5..5d455d16aa 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -86,6 +86,7 @@ class CFrame : public wxFrame void StatusBarMessage(const char * Text, ...); void ClearStatusBar(); void OnCustomHostMessage(int Id); + void StartGame(const std::string& filename); // --------------------------------------- // Wiimote leds @@ -252,7 +253,6 @@ class CFrame : public wxFrame WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); #endif // Event functions - void StartGame(); void OnQuit(wxCommandEvent& event); void OnHelp(wxCommandEvent& event); void OnToolBar(wxCommandEvent& event); @@ -333,7 +333,7 @@ class CFrame : public wxFrame wxMenuItem* m_pSubMenuSave; wxMenuItem* m_pSubMenuFrameSkipping; - void BootGame(); + void BootGame(const std::string& filename); // Double click and mouse move options double m_fLastClickTime, m_iLastMotionTime; diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 3ea044e823..0880d9da9e 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -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) { diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.cpp b/Source/Core/DolphinWX/Src/GameListCtrl.cpp index ec262f0119..adaade6aef 100644 --- a/Source/Core/DolphinWX/Src/GameListCtrl.cpp +++ b/Source/Core/DolphinWX/Src/GameListCtrl.cpp @@ -100,7 +100,7 @@ END_EVENT_TABLE() BEGIN_EVENT_TABLE(CGameListCtrl, wxListCtrl) EVT_SIZE(CGameListCtrl::OnSize) EVT_RIGHT_DOWN(CGameListCtrl::OnRightClick) -// EVT_LEFT_DOWN(CGameListCtrl::OnLeftClick) // Disabled as stops multi-selection in the game list + EVT_LEFT_DOWN(CGameListCtrl::OnLeftClick) EVT_LIST_KEY_DOWN(LIST_CTRL, CGameListCtrl::OnKeyPress) EVT_MOTION(CGameListCtrl::OnMouseMotion) EVT_LIST_COL_BEGIN_DRAG(LIST_CTRL, CGameListCtrl::OnColBeginDrag) @@ -786,17 +786,14 @@ void CGameListCtrl::OnLeftClick(wxMouseEvent& event) // Focus the clicked item. int flags; long item = HitTest(event.GetPosition(), flags); - if (item != wxNOT_FOUND) + if ((item != wxNOT_FOUND) && (GetSelectedItemCount() == 0) && (!event.ControlDown()) && (!event.ShiftDown())) { - if (GetItemState(item, wxLIST_STATE_SELECTED) != wxLIST_STATE_SELECTED) - { - UnselectAll(); - SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); - } + SetItemState(item, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); SetItemState(item, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); + wxGetApp().GetCFrame()->UpdateGUI(); } - wxGetApp().GetCFrame()->UpdateGUI(); + event.Skip(); } void CGameListCtrl::OnRightClick(wxMouseEvent& event) diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 9954f460d6..c83468ccd5 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -44,7 +44,7 @@ #include "JitWindow.h" #include "ExtendedTrace.h" #include "BootManager.h" - +#include "Frame.h" // ------------ // Main window @@ -408,7 +408,7 @@ bool DolphinApp::OnInit() // First check if we have a elf command line. Todo: Should we place this under #if wxUSE_CMDLINE_PARSER? if (LoadElf && ElfFile != wxEmptyString) { - BootManager::BootCore(std::string(ElfFile.mb_str())); + main_frame->StartGame(std::string(ElfFile.mb_str())); } /* If we have selected Automatic Start, start the default ISO, or if no default ISO exists, start the last loaded ISO */ @@ -420,13 +420,13 @@ bool DolphinApp::OnInit() && File::Exists(SConfig::GetInstance().m_LocalCoreStartupParameter. m_strDefaultGCM.c_str())) { - BootManager::BootCore(SConfig::GetInstance().m_LocalCoreStartupParameter. + main_frame->StartGame(SConfig::GetInstance().m_LocalCoreStartupParameter. m_strDefaultGCM); } else if(!SConfig::GetInstance().m_LastFilename.empty() && File::Exists(SConfig::GetInstance().m_LastFilename.c_str())) { - BootManager::BootCore(SConfig::GetInstance().m_LastFilename); + main_frame->StartGame(SConfig::GetInstance().m_LastFilename); } } }