summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/GameListCtrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/DolphinWX/GameListCtrl.cpp')
-rw-r--r--Source/Core/DolphinWX/GameListCtrl.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/Source/Core/DolphinWX/GameListCtrl.cpp b/Source/Core/DolphinWX/GameListCtrl.cpp
index e382588b75..2bb88f10ab 100644
--- a/Source/Core/DolphinWX/GameListCtrl.cpp
+++ b/Source/Core/DolphinWX/GameListCtrl.cpp
@@ -59,6 +59,7 @@
#include "DolphinWX/ISOFile.h"
#include "DolphinWX/ISOProperties.h"
#include "DolphinWX/Main.h"
+#include "DolphinWX/NetPlay/NetPlayLauncher.h"
#include "DolphinWX/WxUtils.h"
struct CompressionProgress final
@@ -176,6 +177,7 @@ CGameListCtrl::CGameListCtrl(wxWindow* parent, const wxWindowID id, const wxPoin
Bind(wxEVT_MENU, &CGameListCtrl::OnMultiDecompressISO, this, IDM_MULTI_DECOMPRESS_ISO);
Bind(wxEVT_MENU, &CGameListCtrl::OnDeleteISO, this, IDM_DELETE_ISO);
Bind(wxEVT_MENU, &CGameListCtrl::OnChangeDisc, this, IDM_LIST_CHANGE_DISC);
+ Bind(wxEVT_MENU, &CGameListCtrl::OnNetPlayHost, this, IDM_START_NETPLAY);
wxTheApp->Bind(DOLPHIN_EVT_LOCAL_INI_CHANGED, &CGameListCtrl::OnLocalIniModified, this);
}
@@ -972,6 +974,8 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
if (platform == DiscIO::Platform::WII_WAD)
popupMenu.Append(IDM_LIST_INSTALL_WAD, _("Install to Wii Menu"));
+ popupMenu.Append(IDM_START_NETPLAY, _("Host with Netplay"));
+
PopupMenu(&popupMenu);
}
}
@@ -1119,6 +1123,29 @@ void CGameListCtrl::OnWiki(wxCommandEvent& WXUNUSED(event))
WxUtils::Launch(wikiUrl);
}
+void CGameListCtrl::OnNetPlayHost(wxCommandEvent& WXUNUSED(event))
+{
+ const GameListItem* iso = GetSelectedISO();
+ if (!iso)
+ return;
+
+ IniFile ini_file;
+ const std::string dolphin_ini = File::GetUserPath(F_DOLPHINCONFIG_IDX);
+ ini_file.Load(dolphin_ini);
+ IniFile::Section& netplay_section = *ini_file.GetOrCreateSection("NetPlay");
+
+ NetPlayHostConfig config;
+ config.FromIniConfig(netplay_section);
+ config.game_name = iso->GetUniqueIdentifier();
+ config.game_list_ctrl = this;
+ config.parent_window = m_parent;
+
+ netplay_section.Set("SelectedHostGame", config.game_name);
+ ini_file.Save(dolphin_ini);
+
+ NetPlayLauncher::Host(config);
+}
+
bool CGameListCtrl::MultiCompressCB(const std::string& text, float percent, void* arg)
{
CompressionProgress* progress = static_cast<CompressionProgress*>(arg);