diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp index 7833017cef..57cfe503b7 100644 --- a/Source/Core/Common/Src/StringUtil.cpp +++ b/Source/Core/Common/Src/StringUtil.cpp @@ -370,10 +370,15 @@ bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _ return true; } - - #endif +std::string PathToFilename(std::string Path) +{ + std::string Name, Ending; + SplitPath(Path, 0, &Name, &Ending); + return Name + Ending; +} + void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path, const std::string& _Filename) { _CompleteFilename = _Path; diff --git a/Source/Core/Common/Src/StringUtil.h b/Source/Core/Common/Src/StringUtil.h index 4a2137b090..811b49bdde 100644 --- a/Source/Core/Common/Src/StringUtil.h +++ b/Source/Core/Common/Src/StringUtil.h @@ -72,8 +72,10 @@ void SplitString(const std::string& str, const std::string& delim, std::vectorAppend(IDM_VIDEOWINDOW, _T("&Video"), wxEmptyString, wxITEM_CHECK); pVideo->Check(bVideoWindow); pDebugDialogs->AppendSeparator(); - // wxMenuItem* pFontPicker = pDebugDialogs->Append(IDM_FONTPICKER, _T("&Font..."), wxEmptyString, wxITEM_NORMAL); + wxMenuItem* pFontPicker = pDebugDialogs->Append(IDM_FONTPICKER, _T("&Font..."), wxEmptyString, wxITEM_NORMAL); pMenuBar->Append(pDebugDialogs, _T("&Views")); CreateSymbolsMenu(); - - //SetMenuBar(pMenuBar); } diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index bc3cbc7b21..3ac0d5f3d5 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -248,6 +248,7 @@ EVT_MENU(IDM_BROWSE, CFrame::OnBrowse) EVT_MENU(IDM_MEMCARD, CFrame::OnMemcard) EVT_MENU(IDM_CHEATS, CFrame::OnShow_CheatsWindow) EVT_MENU(IDM_INFO, CFrame::OnShow_InfoWindow) +EVT_MENU(IDM_RESTART, CFrame::OnRestart) EVT_MENU(IDM_CHANGEDISC, CFrame::OnChangeDisc) EVT_MENU(IDM_LOAD_WII_MENU, CFrame::OnLoadWiiMenu) EVT_MENU(IDM_TOGGLE_FULLSCREEN, CFrame::OnToggleFullscreen) @@ -496,7 +497,25 @@ void CFrame::OnQuit(wxCommandEvent& WXUNUSED (event)) Close(true); } +void CFrame::OnRestart(wxCommandEvent& WXUNUSED (event)) +{ + if (Core::GetState() != Core::CORE_UNINITIALIZED) + { + wxMessageBox(wxT("Please stop the current game before restarting."), wxT("Notice"), wxOK, this); + return; + } + // Get exe name and restart + #ifdef _WIN32 + char Str[MAX_PATH + 1]; + DWORD Size = sizeof(Str)/sizeof(char); + DWORD n = GetModuleFileNameA(NULL, Str, Size); + ShellExecuteA(NULL, "open", PathToFilename(*new std::string(Str)).c_str(), UseDebugger ? "" : "-d", NULL, SW_SHOW); + #endif + Close(true); +} + +///////////////////////////////////////////////////////////////////////////////////////////////////////// // Events // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ @@ -794,10 +813,10 @@ void CFrame::Update() } } #endif +///////////////////////////////////////////////////////////////////////////////////////////////////////// - - +///////////////////////////////////////////////////////////////////////////////////////////////////////// // Functions // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ wxPanel* CFrame::CreateEmptyPanel() @@ -827,4 +846,4 @@ void CFrame::DoFullscreen(bool _F) m_Mgr->LoadPerspective(AuiCurrent, true); } } - +///////////////////////////////////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/Source/Core/DolphinWX/Src/Frame.h b/Source/Core/DolphinWX/Src/Frame.h index f494683f93..032a0891fe 100644 --- a/Source/Core/DolphinWX/Src/Frame.h +++ b/Source/Core/DolphinWX/Src/Frame.h @@ -283,6 +283,7 @@ class CFrame : public wxFrame void OnShow_CheatsWindow(wxCommandEvent& event); void OnShow_InfoWindow(wxCommandEvent& event); + void OnRestart(wxCommandEvent& event); void OnLoadWiiMenu(wxCommandEvent& event); void GameListChanged(wxCommandEvent& event); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index c8dd02c767..d95a649274 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -119,7 +119,8 @@ void CFrame::CreateMenu() fileMenu->Append(wxID_REFRESH, _T("&Refresh List")); fileMenu->AppendSeparator(); fileMenu->Append(IDM_BROWSE, _T("&Browse for ISOs...")); - + fileMenu->AppendSeparator(); + fileMenu->Append(IDM_RESTART, UseDebugger ? _T("Restart in regular mode") : _T("Restart in debugging mode")); fileMenu->AppendSeparator(); fileMenu->Append(wxID_EXIT, _T("E&xit\tAlt+F4")); menuBar->Append(fileMenu, _T("&File")); diff --git a/Source/Core/DolphinWX/Src/Globals.h b/Source/Core/DolphinWX/Src/Globals.h index 8c64134a54..41269ce0a1 100644 --- a/Source/Core/DolphinWX/Src/Globals.h +++ b/Source/Core/DolphinWX/Src/Globals.h @@ -90,6 +90,7 @@ enum IDM_CHEATS, IDM_NETPLAY, IDM_INFO, + IDM_RESTART, IDM_CHANGEDISC, IDM_PROPERTIES, IDM_LOAD_WII_MENU,