From e3ffb2dd16c58c5ca2aa49cea25449c0d81ea456 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 16 Aug 2015 00:00:59 -0400 Subject: [PATCH 1/8] NetPlayProto: Minor cleanup --- Source/Core/Core/NetPlayProto.h | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Source/Core/Core/NetPlayProto.h b/Source/Core/Core/NetPlayProto.h index e3572dd212..9434204621 100644 --- a/Source/Core/Core/NetPlayProto.h +++ b/Source/Core/Core/NetPlayProto.h @@ -8,6 +8,8 @@ #include "Common/CommonTypes.h" #include "Core/HW/EXI_Device.h" +#define NETPLAY_VERSION "Dolphin NetPlay 2015-06-24" + struct NetSettings { bool m_CPUthread; @@ -25,18 +27,13 @@ struct NetSettings }; extern NetSettings g_NetPlaySettings; +extern u64 g_netplay_initial_gctime; struct Rpt : public std::vector { u16 channel; }; -typedef std::vector NetWiimote; - -#define NETPLAY_VERSION "Dolphin NetPlay 2015-06-24" - -extern u64 g_netplay_initial_gctime; - // messages enum { @@ -70,11 +67,6 @@ enum NP_MSG_SYNC_GC_SRAM = 0xF0, }; -typedef u8 MessageId; -typedef u8 PlayerId; -typedef s8 PadMapping; -typedef u32 FrameNum; - enum { CON_ERR_SERVER_FULL = 1, @@ -82,6 +74,12 @@ enum CON_ERR_VERSION_MISMATCH = 3 }; +using NetWiimote = std::vector; +using MessageId = u8; +using PlayerId = u8; +using PadMapping = s8; +using FrameNum = u32; + namespace NetPlay { bool IsNetPlayRunning(); From b1af2a6bbcbf3922bec65c387c906f3bcb6b0c09 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 16 Aug 2015 00:08:09 -0400 Subject: [PATCH 2/8] NetPlay: Use std::array for the pad mappings --- Source/Core/Core/NetPlayClient.h | 4 ++-- Source/Core/Core/NetPlayProto.h | 4 +++- Source/Core/Core/NetPlayServer.cpp | 5 +++-- Source/Core/Core/NetPlayServer.h | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/NetPlayClient.h b/Source/Core/Core/NetPlayClient.h index c80afda9f7..f62e337eb7 100644 --- a/Source/Core/Core/NetPlayClient.h +++ b/Source/Core/Core/NetPlayClient.h @@ -121,8 +121,8 @@ protected: u32 m_current_game; - PadMapping m_pad_map[4]; - PadMapping m_wiimote_map[4]; + PadMappingArray m_pad_map; + PadMappingArray m_wiimote_map; bool m_is_recording; diff --git a/Source/Core/Core/NetPlayProto.h b/Source/Core/Core/NetPlayProto.h index 9434204621..7f81d18622 100644 --- a/Source/Core/Core/NetPlayProto.h +++ b/Source/Core/Core/NetPlayProto.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include "Common/CommonTypes.h" #include "Core/HW/EXI_Device.h" @@ -77,8 +78,9 @@ enum using NetWiimote = std::vector; using MessageId = u8; using PlayerId = u8; -using PadMapping = s8; using FrameNum = u32; +using PadMapping = s8; +using PadMappingArray = std::array; namespace NetPlay { diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp index ada7b3d8f9..d15c8ac338 100644 --- a/Source/Core/Core/NetPlayServer.cpp +++ b/Source/Core/Core/NetPlayServer.cpp @@ -74,8 +74,9 @@ NetPlayServer::NetPlayServer(const u16 port, bool traversal, const std::string& PanicAlertT("Enet Didn't Initialize"); } - memset(m_pad_map, -1, sizeof(m_pad_map)); - memset(m_wiimote_map, -1, sizeof(m_wiimote_map)); + m_pad_map.fill(-1); + m_wiimote_map.fill(-1); + if (traversal) { if (!EnsureTraversalClient(centralServer, centralPort)) diff --git a/Source/Core/Core/NetPlayServer.h b/Source/Core/Core/NetPlayServer.h index 842c795c38..360c4491ad 100644 --- a/Source/Core/Core/NetPlayServer.h +++ b/Source/Core/Core/NetPlayServer.h @@ -95,8 +95,8 @@ private: bool m_update_pings; u32 m_current_game; unsigned int m_target_buffer_size; - PadMapping m_pad_map[4]; - PadMapping m_wiimote_map[4]; + PadMappingArray m_pad_map; + PadMappingArray m_wiimote_map; std::map m_players; From 11f3ded2966726680908deb4505cad41da2938c1 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 16 Aug 2015 00:58:15 -0400 Subject: [PATCH 3/8] NetPlay: Return mapping arrays and player list vectors directly Simplifies pad map dialog initialization --- Source/Core/Core/NetPlayClient.cpp | 16 ++++----- Source/Core/Core/NetPlayClient.h | 2 +- Source/Core/Core/NetPlayServer.cpp | 20 +++++------ Source/Core/Core/NetPlayServer.h | 8 ++--- Source/Core/DolphinWX/NetPlay/NetWindow.cpp | 14 ++------ .../Core/DolphinWX/NetPlay/PadMapDialog.cpp | 35 ++++++++++++------- Source/Core/DolphinWX/NetPlay/PadMapDialog.h | 13 ++++--- 7 files changed, 55 insertions(+), 53 deletions(-) diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index d499e6b90e..a129507bae 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -617,17 +617,15 @@ void NetPlayClient::GetPlayerList(std::string& list, std::vector& pid_list) } // called from ---GUI--- thread -void NetPlayClient::GetPlayers(std::vector &player_list) +std::vector NetPlayClient::GetPlayers() { std::lock_guard lkp(m_crit.players); - std::map::const_iterator - i = m_players.begin(), - e = m_players.end(); - for (; i != e; ++i) - { - const Player *player = &(i->second); - player_list.push_back(player); - } + std::vector players; + + for (const auto& pair : m_players) + players.push_back(&pair.second); + + return players; } diff --git a/Source/Core/Core/NetPlayClient.h b/Source/Core/Core/NetPlayClient.h index f62e337eb7..56e38ef7b2 100644 --- a/Source/Core/Core/NetPlayClient.h +++ b/Source/Core/Core/NetPlayClient.h @@ -54,7 +54,7 @@ public: ~NetPlayClient(); void GetPlayerList(std::string& list, std::vector& pid_list); - void GetPlayers(std::vector& player_list); + std::vector GetPlayers(); bool is_connected; diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp index d15c8ac338..2a48d37f7e 100644 --- a/Source/Core/Core/NetPlayServer.cpp +++ b/Source/Core/Core/NetPlayServer.cpp @@ -403,31 +403,27 @@ unsigned int NetPlayServer::OnDisconnect(Client& player) } // called from ---GUI--- thread -void NetPlayServer::GetPadMapping(PadMapping map[4]) +PadMappingArray NetPlayServer::GetPadMapping() const { - for (int i = 0; i < 4; i++) - map[i] = m_pad_map[i]; + return m_pad_map; } -void NetPlayServer::GetWiimoteMapping(PadMapping map[4]) +PadMappingArray NetPlayServer::GetWiimoteMapping() const { - for (int i = 0; i < 4; i++) - map[i] = m_wiimote_map[i]; + return m_wiimote_map; } // called from ---GUI--- thread -void NetPlayServer::SetPadMapping(const PadMapping map[4]) +void NetPlayServer::SetPadMapping(const PadMappingArray& mappings) { - for (int i = 0; i < 4; i++) - m_pad_map[i] = map[i]; + m_pad_map = mappings; UpdatePadMapping(); } // called from ---GUI--- thread -void NetPlayServer::SetWiimoteMapping(const PadMapping map[4]) +void NetPlayServer::SetWiimoteMapping(const PadMappingArray& mappings) { - for (int i = 0; i < 4; i++) - m_wiimote_map[i] = map[i]; + m_wiimote_map = mappings; UpdateWiimoteMapping(); } diff --git a/Source/Core/Core/NetPlayServer.h b/Source/Core/Core/NetPlayServer.h index 360c4491ad..b2888c8708 100644 --- a/Source/Core/Core/NetPlayServer.h +++ b/Source/Core/Core/NetPlayServer.h @@ -34,11 +34,11 @@ public: bool StartGame(); - void GetPadMapping(PadMapping map[]); - void SetPadMapping(const PadMapping map[]); + PadMappingArray GetPadMapping() const; + void SetPadMapping(const PadMappingArray& mappings); - void GetWiimoteMapping(PadMapping map[]); - void SetWiimoteMapping(const PadMapping map[]); + PadMappingArray GetWiimoteMapping() const; + void SetWiimoteMapping(const PadMappingArray& mappings); void AdjustPadBufferSize(unsigned int size); diff --git a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp index 5db7c7e56f..594918b5ab 100644 --- a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp +++ b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp @@ -460,19 +460,11 @@ void NetPlayDialog::OnChangeGame(wxCommandEvent&) void NetPlayDialog::OnConfigPads(wxCommandEvent&) { - PadMapping mapping[4]; - PadMapping wiimotemapping[4]; - std::vector player_list; - - netplay_server->GetPadMapping(mapping); - netplay_server->GetWiimoteMapping(wiimotemapping); - netplay_client->GetPlayers(player_list); - - PadMapDialog pmd(this, mapping, wiimotemapping, player_list); + PadMapDialog pmd(this, netplay_server, netplay_client); pmd.ShowModal(); - netplay_server->SetPadMapping(mapping); - netplay_server->SetWiimoteMapping(wiimotemapping); + netplay_server->SetPadMapping(pmd.GetModifiedPadMappings()); + netplay_server->SetWiimoteMapping(pmd.GetModifiedWiimoteMappings()); } void NetPlayDialog::OnKick(wxCommandEvent&) diff --git a/Source/Core/DolphinWX/NetPlay/PadMapDialog.cpp b/Source/Core/DolphinWX/NetPlay/PadMapDialog.cpp index 5e6d3798cb..8fdd66903e 100644 --- a/Source/Core/DolphinWX/NetPlay/PadMapDialog.cpp +++ b/Source/Core/DolphinWX/NetPlay/PadMapDialog.cpp @@ -8,13 +8,14 @@ #include "Core/NetPlayClient.h" #include "Core/NetPlayProto.h" +#include "Core/NetPlayServer.h" #include "DolphinWX/NetPlay/PadMapDialog.h" -PadMapDialog::PadMapDialog(wxWindow* parent, PadMapping map[], PadMapping wiimotemap[], std::vector& player_list) +PadMapDialog::PadMapDialog(wxWindow* parent, NetPlayServer* server, NetPlayClient* client) : wxDialog(parent, wxID_ANY, _("Configure Pads")) - , m_mapping(map) - , m_wiimapping(wiimotemap) - , m_player_list(player_list) + , m_pad_mapping(server->GetPadMapping()) + , m_wii_mapping(server->GetWiimoteMapping()) + , m_player_list(client->GetPlayers()) { wxBoxSizer* const h_szr = new wxBoxSizer(wxHORIZONTAL); h_szr->AddSpacer(10); @@ -32,7 +33,7 @@ PadMapDialog::PadMapDialog(wxWindow* parent, PadMapping map[], PadMapping wiimot m_map_cbox[i] = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, player_names); m_map_cbox[i]->Bind(wxEVT_CHOICE, &PadMapDialog::OnAdjust, this); - if (m_mapping[i] == -1) + if (m_pad_mapping[i] == -1) { m_map_cbox[i]->Select(0); } @@ -40,7 +41,7 @@ PadMapDialog::PadMapDialog(wxWindow* parent, PadMapping map[], PadMapping wiimot { for (unsigned int j = 0; j < m_player_list.size(); j++) { - if (m_mapping[i] == m_player_list[j]->pid) + if (m_pad_mapping[i] == m_player_list[j]->pid) m_map_cbox[i]->Select(j + 1); } } @@ -59,7 +60,7 @@ PadMapDialog::PadMapDialog(wxWindow* parent, PadMapping map[], PadMapping wiimot m_map_cbox[i + 4] = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, player_names); m_map_cbox[i + 4]->Bind(wxEVT_CHOICE, &PadMapDialog::OnAdjust, this); - if (m_wiimapping[i] == -1) + if (m_wii_mapping[i] == -1) { m_map_cbox[i + 4]->Select(0); } @@ -67,7 +68,7 @@ PadMapDialog::PadMapDialog(wxWindow* parent, PadMapping map[], PadMapping wiimot { for (unsigned int j = 0; j < m_player_list.size(); j++) { - if (m_wiimapping[i] == m_player_list[j]->pid) + if (m_wii_mapping[i] == m_player_list[j]->pid) m_map_cbox[i + 4]->Select(j + 1); } } @@ -87,20 +88,30 @@ PadMapDialog::PadMapDialog(wxWindow* parent, PadMapping map[], PadMapping wiimot SetFocus(); } +PadMappingArray PadMapDialog::GetModifiedPadMappings() const +{ + return m_pad_mapping; +} + +PadMappingArray PadMapDialog::GetModifiedWiimoteMappings() const +{ + return m_wii_mapping; +} + void PadMapDialog::OnAdjust(wxCommandEvent& WXUNUSED(event)) { for (unsigned int i = 0; i < 4; i++) { int player_idx = m_map_cbox[i]->GetSelection(); if (player_idx > 0) - m_mapping[i] = m_player_list[player_idx - 1]->pid; + m_pad_mapping[i] = m_player_list[player_idx - 1]->pid; else - m_mapping[i] = -1; + m_pad_mapping[i] = -1; player_idx = m_map_cbox[i + 4]->GetSelection(); if (player_idx > 0) - m_wiimapping[i] = m_player_list[player_idx - 1]->pid; + m_wii_mapping[i] = m_player_list[player_idx - 1]->pid; else - m_wiimapping[i] = -1; + m_wii_mapping[i] = -1; } } diff --git a/Source/Core/DolphinWX/NetPlay/PadMapDialog.h b/Source/Core/DolphinWX/NetPlay/PadMapDialog.h index b00cbd40c0..9d2a7768b3 100644 --- a/Source/Core/DolphinWX/NetPlay/PadMapDialog.h +++ b/Source/Core/DolphinWX/NetPlay/PadMapDialog.h @@ -9,19 +9,24 @@ #include "Core/NetPlayProto.h" +class NetPlayClient; +class NetPlayServer; class Player; class wxChoice; class PadMapDialog final : public wxDialog { public: - PadMapDialog(wxWindow* parent, PadMapping map[], PadMapping wiimotemap[], std::vector& player_list); + PadMapDialog(wxWindow* parent, NetPlayServer* server, NetPlayClient* client); + + PadMappingArray GetModifiedPadMappings() const; + PadMappingArray GetModifiedWiimoteMappings() const; private: void OnAdjust(wxCommandEvent& event); wxChoice* m_map_cbox[8]; - PadMapping* const m_mapping; - PadMapping* const m_wiimapping; - std::vector& m_player_list; + PadMappingArray m_pad_mapping; + PadMappingArray m_wii_mapping; + std::vector m_player_list; }; From af35f38491e39e5b030a55784f3a247d3453d7ba Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 16 Aug 2015 01:04:06 -0400 Subject: [PATCH 4/8] NetWindow: Minor simplifications --- Source/Core/DolphinWX/NetPlay/NetWindow.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp index 594918b5ab..c604e38956 100644 --- a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp +++ b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp @@ -383,13 +383,13 @@ void NetPlayDialog::OnThread(wxThreadEvent& event) m_player_lbox->Append(StrToWxStr(tmps)); // remove ping from selection string, in case it has changed - selection.erase(selection.find_last_of("|") + 1); + selection.erase(selection.rfind('|') + 1); if (!selection.empty()) { for (unsigned int i = 0; i < m_player_lbox->GetCount(); ++i) { - if (selection == m_player_lbox->GetString(i).Mid(0, selection.length())) + if (selection == m_player_lbox->GetString(i).substr(0, selection.length())) { m_player_lbox->SetSelection(i); break; @@ -413,7 +413,7 @@ void NetPlayDialog::OnThread(wxThreadEvent& event) case NP_GUI_EVT_CHANGE_GAME: // update selected game :/ { - m_selected_game.assign(WxStrToStr(event.GetString())); + m_selected_game = WxStrToStr(event.GetString()); wxString button_label = event.GetString(); m_game_btn->SetLabel(button_label.Prepend(_(" Game : "))); @@ -471,7 +471,7 @@ void NetPlayDialog::OnKick(wxCommandEvent&) { wxString selection = m_player_lbox->GetStringSelection(); unsigned long player = 0; - selection.Mid(selection.find_last_of("[") + 1, selection.find_last_of("]")).ToULong(&player); + selection.substr(selection.rfind('[') + 1, selection.rfind(']')).ToULong(&player); netplay_server->KickPlayer((u8)player); @@ -482,10 +482,7 @@ void NetPlayDialog::OnKick(wxCommandEvent&) void NetPlayDialog::OnPlayerSelect(wxCommandEvent&) { - if (m_player_lbox->GetSelection() > 0) - m_kick_btn->Enable(); - else - m_kick_btn->Disable(); + m_kick_btn->Enable(m_player_lbox->GetSelection() > 0); } bool NetPlayDialog::IsRecording() @@ -493,7 +490,6 @@ bool NetPlayDialog::IsRecording() return m_record_chkbox->GetValue(); } - void NetPlayDialog::OnCopyIP(wxCommandEvent&) { if (m_host_copy_btn_is_retry) From ca0b9481ea2be14032d4599bae3bc243f87b2179 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 16 Aug 2015 01:08:51 -0400 Subject: [PATCH 5/8] ChangeGameDialog: Internally set the chosen game name Passing in a reference to an empty string is unnecessary and overcomplicates design. --- .../Core/DolphinWX/NetPlay/ChangeGameDialog.cpp | 9 ++++++--- .../Core/DolphinWX/NetPlay/ChangeGameDialog.h | 6 ++++-- Source/Core/DolphinWX/NetPlay/NetWindow.cpp | 17 ++++++++--------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Source/Core/DolphinWX/NetPlay/ChangeGameDialog.cpp b/Source/Core/DolphinWX/NetPlay/ChangeGameDialog.cpp index 57da50a65d..98f6dec441 100644 --- a/Source/Core/DolphinWX/NetPlay/ChangeGameDialog.cpp +++ b/Source/Core/DolphinWX/NetPlay/ChangeGameDialog.cpp @@ -9,9 +9,8 @@ #include "DolphinWX/NetPlay/ChangeGameDialog.h" #include "DolphinWX/NetPlay/NetWindow.h" -ChangeGameDialog::ChangeGameDialog(wxWindow* parent, const CGameListCtrl* const game_list, wxString& game_name) +ChangeGameDialog::ChangeGameDialog(wxWindow* parent, const CGameListCtrl* const game_list) : wxDialog(parent, wxID_ANY, _("Change Game")) - , m_game_name(game_name) { m_game_lbox = new wxListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, nullptr, wxLB_SORT); m_game_lbox->Bind(wxEVT_LISTBOX_DCLICK, &ChangeGameDialog::OnPick, this); @@ -29,9 +28,13 @@ ChangeGameDialog::ChangeGameDialog(wxWindow* parent, const CGameListCtrl* const SetFocus(); } +wxString ChangeGameDialog::GetChosenGameName() const +{ + return m_game_name; +} + void ChangeGameDialog::OnPick(wxCommandEvent& event) { - // return the selected game name m_game_name = m_game_lbox->GetStringSelection(); EndModal(wxID_OK); } diff --git a/Source/Core/DolphinWX/NetPlay/ChangeGameDialog.h b/Source/Core/DolphinWX/NetPlay/ChangeGameDialog.h index 6e4c24323c..cf530b556d 100644 --- a/Source/Core/DolphinWX/NetPlay/ChangeGameDialog.h +++ b/Source/Core/DolphinWX/NetPlay/ChangeGameDialog.h @@ -12,11 +12,13 @@ class wxListBox; class ChangeGameDialog final : public wxDialog { public: - ChangeGameDialog(wxWindow* parent, const CGameListCtrl* const game_list, wxString& game_name); + ChangeGameDialog(wxWindow* parent, const CGameListCtrl* const game_list); + + wxString GetChosenGameName() const; private: void OnPick(wxCommandEvent& event); wxListBox* m_game_lbox; - wxString& m_game_name; + wxString m_game_name; }; diff --git a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp index c604e38956..346b8b0932 100644 --- a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp +++ b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp @@ -445,17 +445,16 @@ void NetPlayDialog::OnThread(wxThreadEvent& event) void NetPlayDialog::OnChangeGame(wxCommandEvent&) { - wxString game_name; - - ChangeGameDialog cgd(this, m_game_list, game_name); + ChangeGameDialog cgd(this, m_game_list); cgd.ShowModal(); - if (game_name.length()) - { - m_selected_game = WxStrToStr(game_name); - netplay_server->ChangeGame(m_selected_game); - m_game_btn->SetLabel(game_name.Prepend(_(" Game : "))); - } + wxString game_name = cgd.GetChosenGameName(); + if (game_name.empty()) + return; + + m_selected_game = WxStrToStr(game_name); + netplay_server->ChangeGame(m_selected_game); + m_game_btn->SetLabel(game_name.Prepend(_(" Game : "))); } void NetPlayDialog::OnConfigPads(wxCommandEvent&) From 2b4a249deabf3d1285ce3e0b151db3013c9c97ed Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 16 Aug 2015 01:13:05 -0400 Subject: [PATCH 6/8] NetWindow: Replace old wx event binding types --- Source/Core/DolphinWX/NetPlay/NetWindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp index 346b8b0932..e39a06698b 100644 --- a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp +++ b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp @@ -141,7 +141,7 @@ NetPlayDialog::NetPlayDialog(wxWindow* const parent, const CGameListCtrl* const { wxBoxSizer* const host_szr = new wxBoxSizer(wxHORIZONTAL); m_host_type_choice = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxSize(60, -1)); - m_host_type_choice->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &NetPlayDialog::OnChoice, this); + m_host_type_choice->Bind(wxEVT_CHOICE, &NetPlayDialog::OnChoice, this); m_host_type_choice->Append(_("ID:")); host_szr->Add(m_host_type_choice); @@ -151,7 +151,7 @@ NetPlayDialog::NetPlayDialog(wxWindow* const parent, const CGameListCtrl* const host_szr->Add(m_host_label, 1, wxLEFT | wxCENTER, 5); m_host_copy_btn = new wxButton(panel, wxID_ANY, _("Copy")); - m_host_copy_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &NetPlayDialog::OnCopyIP, this); + m_host_copy_btn->Bind(wxEVT_BUTTON, &NetPlayDialog::OnCopyIP, this); m_host_copy_btn->Disable(); host_szr->Add(m_host_copy_btn, 0, wxLEFT | wxCENTER, 5); player_szr->Add(host_szr, 0, wxEXPAND | wxBOTTOM, 5); From 65adf7669845b624c6a8e34da7cce444a81040e8 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 16 Aug 2015 01:13:48 -0400 Subject: [PATCH 7/8] NetWindow: non-ugly way to check for window focus --- Source/Core/DolphinWX/NetPlay/NetWindow.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp index e39a06698b..c82f3003b0 100644 --- a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp +++ b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp @@ -399,10 +399,7 @@ void NetPlayDialog::OnThread(wxThreadEvent& event) // flash window in taskbar when someone joins if window isn't active static u8 numPlayers = 1; - bool focus = (wxWindow::FindFocus() == this || (wxWindow::FindFocus() != nullptr && wxWindow::FindFocus()->GetParent() == this) || - (wxWindow::FindFocus() != nullptr && wxWindow::FindFocus()->GetParent() != nullptr - && wxWindow::FindFocus()->GetParent()->GetParent() == this)); - if (netplay_server != nullptr && numPlayers < m_playerids.size() && !focus) + if (netplay_server != nullptr && numPlayers < m_playerids.size() && !HasFocus()) { RequestUserAttention(); } From 761e087e520df247f7254db728b5d73a9230cd3b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 16 Aug 2015 01:19:10 -0400 Subject: [PATCH 8/8] NetWindow: Remove translation marker from empty string --- Source/Core/DolphinWX/NetPlay/NetWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp index c82f3003b0..0de691a281 100644 --- a/Source/Core/DolphinWX/NetPlay/NetWindow.cpp +++ b/Source/Core/DolphinWX/NetPlay/NetWindow.cpp @@ -147,7 +147,7 @@ NetPlayDialog::NetPlayDialog(wxWindow* const parent, const CGameListCtrl* const m_host_label = new wxStaticText(panel, wxID_ANY, "555.555.555.555:55555", wxDefaultPosition, wxDefaultSize, wxST_NO_AUTORESIZE | wxALIGN_LEFT); // Update() should fix this immediately. - m_host_label->SetLabel(_("")); + m_host_label->SetLabel(""); host_szr->Add(m_host_label, 1, wxLEFT | wxCENTER, 5); m_host_copy_btn = new wxButton(panel, wxID_ANY, _("Copy"));