summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/NetPlay/NetWindow.cpp
diff options
context:
space:
mode:
authorAestek <thib.gilles@gmail.com>2016-07-10 10:13:34 +0200
committerAestek <thib.gilles@gmail.com>2016-07-10 10:13:34 +0200
commitcd9a58b70470e3800d818c429c3b5453834ec0c6 (patch)
tree27b61e7caa609fd600bc6bbb171801ee512e7d81 /Source/Core/DolphinWX/NetPlay/NetWindow.cpp
parent7ee6d082131cf40b8a8471ff3ac967e30326f59e (diff)
Check if all players have the game before starting netplay
https://bugs.dolphin-emu.org/issues/8885
Diffstat (limited to 'Source/Core/DolphinWX/NetPlay/NetWindow.cpp')
-rw-r--r--Source/Core/DolphinWX/NetPlay/NetWindow.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp
index 632472b1d0..4f41921cca 100644
--- a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp
+++ b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp
@@ -288,19 +288,33 @@ void NetPlayDialog::GetNetSettings(NetSettings& settings)
settings.m_EXIDevice[1] = instance.m_EXIDevice[1];
}
-std::string NetPlayDialog::FindGame()
+std::string NetPlayDialog::FindGame(const std::string& target_game)
{
// find path for selected game, sloppy..
for (u32 i = 0; auto game = m_game_list->GetISO(i); ++i)
- if (m_selected_game == BuildGameName(*game))
+ if (target_game == BuildGameName(*game))
return game->GetFileName();
- WxUtils::ShowErrorDialog(_("Game not found!"));
return "";
}
+std::string NetPlayDialog::FindCurrentGame()
+{
+ return FindGame(m_selected_game);
+}
+
void NetPlayDialog::OnStart(wxCommandEvent&)
{
+ bool should_start = true;
+ if (!netplay_client->DoAllPlayersHaveGame())
+ {
+ should_start = wxMessageBox(_("Not all players have the game. Do you really want to start?"),
+ _("Warning"), wxYES_NO) == wxYES;
+ }
+
+ if (!should_start)
+ return;
+
NetSettings settings;
GetNetSettings(settings);
netplay_server->SetNetSettings(settings);
@@ -442,7 +456,11 @@ void NetPlayDialog::OnThread(wxThreadEvent& event)
case NP_GUI_EVT_START_GAME:
// client start game :/
{
- netplay_client->StartGame(FindGame());
+ std::string game = FindCurrentGame();
+ if (game.empty())
+ WxUtils::ShowErrorDialog(_("Game not found!"));
+ else
+ netplay_client->StartGame(game);
}
break;
case NP_GUI_EVT_STOP_GAME: