diff --git a/Source/Core/DolphinWX/Frame.cpp b/Source/Core/DolphinWX/Frame.cpp index 1648163752..f35e964706 100644 --- a/Source/Core/DolphinWX/Frame.cpp +++ b/Source/Core/DolphinWX/Frame.cpp @@ -229,6 +229,8 @@ wxDEFINE_EVENT(wxEVT_HOST_COMMAND, wxCommandEvent); wxDEFINE_EVENT(DOLPHIN_EVT_LOCAL_INI_CHANGED, wxCommandEvent); wxDEFINE_EVENT(DOLPHIN_EVT_RELOAD_THEME_BITMAPS, wxCommandEvent); wxDEFINE_EVENT(DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM, wxCommandEvent); +wxDEFINE_EVENT(DOLPHIN_EVT_BOOT_SOFTWARE, wxCommandEvent); +wxDEFINE_EVENT(DOLPHIN_EVT_STOP_SOFTWARE, wxCommandEvent); // Event tables BEGIN_EVENT_TABLE(CFrame, CRenderFrame) @@ -495,6 +497,8 @@ void CFrame::BindEvents() Bind(DOLPHIN_EVT_RELOAD_THEME_BITMAPS, &CFrame::OnReloadThemeBitmaps, this); Bind(DOLPHIN_EVT_RELOAD_GAMELIST, &CFrame::OnReloadGameList, this); Bind(DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM, &CFrame::OnUpdateLoadWiiMenuItem, this); + Bind(DOLPHIN_EVT_BOOT_SOFTWARE, &CFrame::OnPlay, this); + Bind(DOLPHIN_EVT_STOP_SOFTWARE, &CFrame::OnStop, this); } bool CFrame::RendererIsFullscreen() diff --git a/Source/Core/DolphinWX/Frame.h b/Source/Core/DolphinWX/Frame.h index 98f60c200a..1ee82ed621 100644 --- a/Source/Core/DolphinWX/Frame.h +++ b/Source/Core/DolphinWX/Frame.h @@ -62,6 +62,8 @@ private: wxDECLARE_EVENT(DOLPHIN_EVT_RELOAD_THEME_BITMAPS, wxCommandEvent); wxDECLARE_EVENT(DOLPHIN_EVT_UPDATE_LOAD_WII_MENU_ITEM, wxCommandEvent); +wxDECLARE_EVENT(DOLPHIN_EVT_BOOT_SOFTWARE, wxCommandEvent); +wxDECLARE_EVENT(DOLPHIN_EVT_STOP_SOFTWARE, wxCommandEvent); class CFrame : public CRenderFrame { diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index fb69f6ac0c..c40e6d0916 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -501,7 +501,7 @@ void CFrame::OnRecordExport(wxCommandEvent& WXUNUSED(event)) DoRecordingSave(); } -void CFrame::OnPlay(wxCommandEvent& WXUNUSED(event)) +void CFrame::OnPlay(wxCommandEvent& event) { if (Core::IsRunning()) { @@ -526,7 +526,7 @@ void CFrame::OnPlay(wxCommandEvent& WXUNUSED(event)) else { // Core is uninitialized, start the game - BootGame(""); + BootGame(WxStrToStr(event.GetString())); } } diff --git a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp index 75cf03885e..bd78185e7e 100644 --- a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp +++ b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. +#include "DolphinWX/NetPlay/NetWindow.h" + #include #include #include @@ -43,9 +45,7 @@ #include "DolphinWX/Frame.h" #include "DolphinWX/GameListCtrl.h" #include "DolphinWX/ISOFile.h" -#include "DolphinWX/Main.h" #include "DolphinWX/NetPlay/ChangeGameDialog.h" -#include "DolphinWX/NetPlay/NetWindow.h" #include "DolphinWX/NetPlay/PadMapDialog.h" #include "DolphinWX/WxUtils.h" #include "MD5Dialog.h" @@ -369,12 +369,19 @@ void NetPlayDialog::OnStart(wxCommandEvent&) void NetPlayDialog::BootGame(const std::string& filename) { - main_frame->BootGame(filename); + wxCommandEvent play_event{DOLPHIN_EVT_BOOT_SOFTWARE, GetId()}; + play_event.SetString(StrToWxStr(filename)); + play_event.SetEventObject(this); + + AddPendingEvent(play_event); } void NetPlayDialog::StopGame() { - main_frame->DoStop(); + wxCommandEvent stop_event{DOLPHIN_EVT_STOP_SOFTWARE, GetId()}; + stop_event.SetEventObject(this); + + AddPendingEvent(stop_event); } // NetPlayUI methods called from ---NETPLAY--- thread diff --git a/Source/Core/DolphinWX/NetPlay/NetWindow.h b/Source/Core/DolphinWX/NetPlay/NetWindow.h index bc199c2581..a579de2f40 100644 --- a/Source/Core/DolphinWX/NetPlay/NetWindow.h +++ b/Source/Core/DolphinWX/NetPlay/NetWindow.h @@ -8,6 +8,7 @@ #include #include +#include "Common/CommonTypes.h" #include "Common/FifoQueue.h" #include "Core/NetPlayClient.h" #include "Core/NetPlayProto.h"