Added Gui elements in Netplay Setup Diag so a person can choose a traversal server
Fixed bug with UPnP so that it will grab the proper address and protocal Fixed bug that caused dolphin to freeze when host codes were to large
This commit is contained in:
parent
1dea3780a7
commit
a629555e6b
|
@ -12,13 +12,14 @@ static void GetRandomishBytes(u8* buf, size_t size)
|
||||||
buf[i] = rand() & 0xff;
|
buf[i] = rand() & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
TraversalClient::TraversalClient(ENetHost* netHost, const std::string& server)
|
TraversalClient::TraversalClient(ENetHost* netHost, const std::string& server, const u16 port)
|
||||||
: m_NetHost(netHost)
|
: m_NetHost(netHost)
|
||||||
, m_Client(nullptr)
|
, m_Client(nullptr)
|
||||||
, m_FailureReason(0)
|
, m_FailureReason(0)
|
||||||
, m_ConnectRequestId(0)
|
, m_ConnectRequestId(0)
|
||||||
, m_PendingConnect(false)
|
, m_PendingConnect(false)
|
||||||
, m_Server(server)
|
, m_Server(server)
|
||||||
|
, m_port(port)
|
||||||
, m_PingTime(0)
|
, m_PingTime(0)
|
||||||
{
|
{
|
||||||
netHost->intercept = TraversalClient::InterceptCallback;
|
netHost->intercept = TraversalClient::InterceptCallback;
|
||||||
|
@ -34,13 +35,12 @@ TraversalClient::~TraversalClient()
|
||||||
|
|
||||||
void TraversalClient::ReconnectToServer()
|
void TraversalClient::ReconnectToServer()
|
||||||
{
|
{
|
||||||
m_Server = "vps.qoid.us"; // XXX
|
|
||||||
if (enet_address_set_host(&m_ServerAddress, m_Server.c_str()))
|
if (enet_address_set_host(&m_ServerAddress, m_Server.c_str()))
|
||||||
{
|
{
|
||||||
OnFailure(BadHost);
|
OnFailure(BadHost);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_ServerAddress.port = 6262;
|
m_ServerAddress.port = m_port;
|
||||||
|
|
||||||
m_State = Connecting;
|
m_State = Connecting;
|
||||||
|
|
||||||
|
@ -326,12 +326,13 @@ static u16 g_OldPort;
|
||||||
|
|
||||||
bool EnsureTraversalClient(const std::string& server, u16 port)
|
bool EnsureTraversalClient(const std::string& server, u16 port)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!g_MainNetHost || !g_TraversalClient || server != g_OldServer || port != g_OldPort)
|
if (!g_MainNetHost || !g_TraversalClient || server != g_OldServer || port != g_OldPort)
|
||||||
{
|
{
|
||||||
g_OldServer = server;
|
g_OldServer = server;
|
||||||
g_OldPort = port ;
|
g_OldPort = port ;
|
||||||
|
|
||||||
ENetAddress addr = { ENET_HOST_ANY, port };
|
ENetAddress addr = { ENET_HOST_ANY, 0 };
|
||||||
ENetHost* host = enet_host_create(
|
ENetHost* host = enet_host_create(
|
||||||
&addr, // address
|
&addr, // address
|
||||||
50, // peerCount
|
50, // peerCount
|
||||||
|
@ -344,7 +345,7 @@ bool EnsureTraversalClient(const std::string& server, u16 port)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
g_MainNetHost.reset(host);
|
g_MainNetHost.reset(host);
|
||||||
g_TraversalClient.reset(new TraversalClient(g_MainNetHost.get(), server));
|
g_TraversalClient.reset(new TraversalClient(g_MainNetHost.get(), server, port));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
ResendTimeout,
|
ResendTimeout,
|
||||||
ConnectFailedError = 0x400,
|
ConnectFailedError = 0x400,
|
||||||
};
|
};
|
||||||
TraversalClient(ENetHost* netHost, const std::string& server);
|
TraversalClient(ENetHost* netHost, const std::string& server, const u16 port);
|
||||||
~TraversalClient();
|
~TraversalClient();
|
||||||
void Reset();
|
void Reset();
|
||||||
void ConnectToClient(const std::string& host);
|
void ConnectToClient(const std::string& host);
|
||||||
|
@ -70,6 +70,7 @@ private:
|
||||||
std::list<OutgoingTraversalPacketInfo> m_OutgoingTraversalPackets;
|
std::list<OutgoingTraversalPacketInfo> m_OutgoingTraversalPackets;
|
||||||
ENetAddress m_ServerAddress;
|
ENetAddress m_ServerAddress;
|
||||||
std::string m_Server;
|
std::string m_Server;
|
||||||
|
u16 m_port;
|
||||||
enet_uint32 m_PingTime;
|
enet_uint32 m_PingTime;
|
||||||
};
|
};
|
||||||
extern std::unique_ptr<TraversalClient> g_TraversalClient;
|
extern std::unique_ptr<TraversalClient> g_TraversalClient;
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
#define NETPLAY_CODE_SIZE 8
|
||||||
typedef std::array<char, 8> TraversalHostId;
|
typedef std::array<char, NETPLAY_CODE_SIZE> TraversalHostId;
|
||||||
typedef u64 TraversalRequestId;
|
typedef u64 TraversalRequestId;
|
||||||
|
|
||||||
enum TraversalPacketType
|
enum TraversalPacketType
|
||||||
|
|
|
@ -55,7 +55,7 @@ NetPlayClient::~NetPlayClient()
|
||||||
}
|
}
|
||||||
|
|
||||||
// called from ---GUI--- thread
|
// called from ---GUI--- thread
|
||||||
NetPlayClient::NetPlayClient(const std::string& address, const u16 port, NetPlayUI* dialog, const std::string& name, bool traversal)
|
NetPlayClient::NetPlayClient(const std::string& address, const u16 port, NetPlayUI* dialog, const std::string& name, bool traversal, std::string centralServer, u16 centralPort)
|
||||||
: m_state(Failure)
|
: m_state(Failure)
|
||||||
, m_dialog(dialog)
|
, m_dialog(dialog)
|
||||||
, m_client(nullptr)
|
, m_client(nullptr)
|
||||||
|
@ -113,8 +113,13 @@ NetPlayClient::NetPlayClient(const std::string& address, const u16 port, NetPlay
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Traversal Server
|
if (address.size() > NETPLAY_CODE_SIZE)
|
||||||
if (!EnsureTraversalClient("dolphin-emu.org", 0))
|
{
|
||||||
|
PanicAlertT("Host code size is to large.\nPlease recheck that you have the correct code");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!EnsureTraversalClient(centralServer, centralPort))
|
||||||
return;
|
return;
|
||||||
m_client = g_MainNetHost.get();
|
m_client = g_MainNetHost.get();
|
||||||
|
|
||||||
|
@ -446,8 +451,13 @@ void NetPlayClient::Send(sf::Packet& packet)
|
||||||
void NetPlayClient::Disconnect()
|
void NetPlayClient::Disconnect()
|
||||||
{
|
{
|
||||||
ENetEvent netEvent;
|
ENetEvent netEvent;
|
||||||
|
m_connecting = false;
|
||||||
m_state = Failure;
|
m_state = Failure;
|
||||||
|
if (m_server)
|
||||||
enet_peer_disconnect(m_server, 0);
|
enet_peer_disconnect(m_server, 0);
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
while (enet_host_service(m_client, &netEvent, 3000) > 0)
|
while (enet_host_service(m_client, &netEvent, 3000) > 0)
|
||||||
{
|
{
|
||||||
switch (netEvent.type)
|
switch (netEvent.type)
|
||||||
|
@ -539,7 +549,7 @@ void NetPlayClient::GetPlayerList(std::string& list, std::vector<int>& pid_list)
|
||||||
else
|
else
|
||||||
ss << '-';
|
ss << '-';
|
||||||
}
|
}
|
||||||
ss << " | " << player->ping << "ms\n";
|
ss << " |\nPing: " << player->ping << "ms\n\n";
|
||||||
pid_list.push_back(player->pid);
|
pid_list.push_back(player->pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ class NetPlayClient : public TraversalClientClient
|
||||||
public:
|
public:
|
||||||
void ThreadFunc();
|
void ThreadFunc();
|
||||||
|
|
||||||
NetPlayClient(const std::string& address, const u16 port, NetPlayUI* dialog, const std::string& name, bool traversal);
|
NetPlayClient(const std::string& address, const u16 port, NetPlayUI* dialog, const std::string& name, bool traversal, std::string centralServer, u16 centralPort);
|
||||||
~NetPlayClient();
|
~NetPlayClient();
|
||||||
|
|
||||||
void GetPlayerList(std::string& list, std::vector<int>& pid_list);
|
void GetPlayerList(std::string& list, std::vector<int>& pid_list);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "Common/IniFile.h"
|
||||||
#include "Common/StdMakeUnique.h"
|
#include "Common/StdMakeUnique.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
#include "Core/NetPlayClient.h" //for NetPlayUI
|
#include "Core/NetPlayClient.h" //for NetPlayUI
|
||||||
|
@ -50,7 +51,7 @@ NetPlayServer::~NetPlayServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
// called from ---GUI--- thread
|
// called from ---GUI--- thread
|
||||||
NetPlayServer::NetPlayServer(const u16 port, bool traversal)
|
NetPlayServer::NetPlayServer(const u16 port, bool traversal, std::string centralServer, u16 centralPort)
|
||||||
: is_connected(false)
|
: is_connected(false)
|
||||||
, m_is_running(false)
|
, m_is_running(false)
|
||||||
, m_do_loop(false)
|
, m_do_loop(false)
|
||||||
|
@ -73,7 +74,7 @@ NetPlayServer::NetPlayServer(const u16 port, bool traversal)
|
||||||
memset(m_wiimote_map, -1, sizeof(m_wiimote_map));
|
memset(m_wiimote_map, -1, sizeof(m_wiimote_map));
|
||||||
if (traversal)
|
if (traversal)
|
||||||
{
|
{
|
||||||
if (!EnsureTraversalClient("dolphin-emu.org", 0))
|
if (!EnsureTraversalClient(centralServer, centralPort))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_TraversalClient->m_Client = this;
|
g_TraversalClient->m_Client = this;
|
||||||
|
@ -797,10 +798,10 @@ void NetPlayServer::TryPortmapping(u16 port)
|
||||||
// UPnP thread: try to map a port
|
// UPnP thread: try to map a port
|
||||||
void NetPlayServer::mapPortThread(const u16 port)
|
void NetPlayServer::mapPortThread(const u16 port)
|
||||||
{
|
{
|
||||||
ENetAddress adr;
|
ENetAddress adr = { ENET_HOST_ANY, port };
|
||||||
char cIP[20];
|
char cIP[20];
|
||||||
|
|
||||||
enet_address_get_host_ip(&adr, cIP, 20);
|
enet_address_get_host(&adr, cIP, 20);
|
||||||
std::string ourIP(cIP);
|
std::string ourIP(cIP);
|
||||||
|
|
||||||
if (!m_upnp_inited)
|
if (!m_upnp_inited)
|
||||||
|
@ -895,8 +896,8 @@ bool NetPlayServer::UPnPMapPort(const std::string& addr, const u16 port)
|
||||||
std::string port_str = StringFromFormat("%d", port);
|
std::string port_str = StringFromFormat("%d", port);
|
||||||
int result = UPNP_AddPortMapping(m_upnp_urls.controlURL, m_upnp_data.first.servicetype,
|
int result = UPNP_AddPortMapping(m_upnp_urls.controlURL, m_upnp_data.first.servicetype,
|
||||||
port_str.c_str(), port_str.c_str(), addr.c_str(),
|
port_str.c_str(), port_str.c_str(), addr.c_str(),
|
||||||
(std::string("dolphin-emu TCP on ") + addr).c_str(),
|
(std::string("dolphin-emu UDP on ") + addr).c_str(),
|
||||||
"TCP", nullptr, nullptr);
|
"UDP", nullptr, nullptr);
|
||||||
|
|
||||||
if (result != 0)
|
if (result != 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -918,7 +919,7 @@ bool NetPlayServer::UPnPUnmapPort(const u16 port)
|
||||||
{
|
{
|
||||||
std::string port_str = StringFromFormat("%d", port);
|
std::string port_str = StringFromFormat("%d", port);
|
||||||
UPNP_DeletePortMapping(m_upnp_urls.controlURL, m_upnp_data.first.servicetype,
|
UPNP_DeletePortMapping(m_upnp_urls.controlURL, m_upnp_data.first.servicetype,
|
||||||
port_str.c_str(), "TCP", nullptr);
|
port_str.c_str(), "UDP", nullptr);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ class NetPlayServer : public TraversalClientClient
|
||||||
public:
|
public:
|
||||||
void ThreadFunc();
|
void ThreadFunc();
|
||||||
|
|
||||||
NetPlayServer(const u16 port, bool traversal);
|
NetPlayServer(const u16 port, bool traversal, std::string centralServer, u16 centralPort);
|
||||||
~NetPlayServer();
|
~NetPlayServer();
|
||||||
|
|
||||||
bool ChangeGame(const std::string& game);
|
bool ChangeGame(const std::string& game);
|
||||||
|
|
|
@ -105,16 +105,49 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl*
|
||||||
wxPanel* const panel = new wxPanel(this);
|
wxPanel* const panel = new wxPanel(this);
|
||||||
|
|
||||||
// top row
|
// top row
|
||||||
wxStaticText* const nick_lbl = new wxStaticText(panel, wxID_ANY, _("Nickname :"));
|
wxBoxSizer* const trav_szr = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
|
m_direct_traversal = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxSize(75, -1));
|
||||||
|
m_direct_traversal->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &NetPlaySetupDiag::OnChoice, this);
|
||||||
|
m_direct_traversal->Append(_("Direct"));
|
||||||
|
m_direct_traversal->Append(_("Traversal"));
|
||||||
|
|
||||||
|
std::string travChoice;
|
||||||
|
netplay_section.Get("TraversalChoice", &travChoice, "direct");
|
||||||
|
|
||||||
|
if (travChoice == "traversal")
|
||||||
|
{
|
||||||
|
m_direct_traversal->Select(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_direct_traversal->Select(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
trav_szr->Add(m_direct_traversal, 0, wxRIGHT);
|
||||||
|
|
||||||
|
wxBoxSizer* const nick_szr = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
wxStaticText* const nick_lbl = new wxStaticText(panel, wxID_ANY, _("Nickname :"));
|
||||||
std::string nickname;
|
std::string nickname;
|
||||||
netplay_section.Get("Nickname", &nickname, "Player");
|
netplay_section.Get("Nickname", &nickname, "Player");
|
||||||
m_nickname_text = new wxTextCtrl(panel, wxID_ANY, StrToWxStr(nickname));
|
m_nickname_text = new wxTextCtrl(panel, wxID_ANY, StrToWxStr(nickname));
|
||||||
|
|
||||||
wxBoxSizer* const nick_szr = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
nick_szr->Add(nick_lbl, 0, wxCENTER);
|
nick_szr->Add(nick_lbl, 0, wxCENTER);
|
||||||
nick_szr->Add(m_nickname_text, 0, wxALL, 5);
|
nick_szr->Add(m_nickname_text, 0, wxALL, 5);
|
||||||
|
|
||||||
|
std::string centralServer;
|
||||||
|
netplay_section.Get("TraversalServer", ¢ralServer, "vps.qoid.us");
|
||||||
|
m_traversal_server_lbl = new wxStaticText(panel, wxID_ANY, _("Traversal:"));
|
||||||
|
m_traversal_server = new wxTextCtrl(panel, wxID_ANY, StrToWxStr(centralServer));
|
||||||
|
nick_szr->Add(m_traversal_server_lbl, 0, wxCENTER);
|
||||||
|
nick_szr->Add(m_traversal_server, 0, wxALL, 5);
|
||||||
|
|
||||||
|
std::string centralPort;
|
||||||
|
netplay_section.Get("TraversalPort", ¢ralPort, "6262");
|
||||||
|
m_traversal_port_lbl = new wxStaticText(panel, wxID_ANY, _("Port:"));
|
||||||
|
m_traversal_port = new wxTextCtrl(panel, wxID_ANY, StrToWxStr(centralPort));
|
||||||
|
nick_szr->Add(m_traversal_port_lbl, 0, wxCENTER);
|
||||||
|
nick_szr->Add(m_traversal_port, 0, wxALL, 5);
|
||||||
|
|
||||||
// tabs
|
// tabs
|
||||||
wxNotebook* const notebook = new wxNotebook(panel, wxID_ANY);
|
wxNotebook* const notebook = new wxNotebook(panel, wxID_ANY);
|
||||||
wxPanel* const connect_tab = new wxPanel(notebook, wxID_ANY);
|
wxPanel* const connect_tab = new wxPanel(notebook, wxID_ANY);
|
||||||
|
@ -122,12 +155,6 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl*
|
||||||
wxPanel* const host_tab = new wxPanel(notebook, wxID_ANY);
|
wxPanel* const host_tab = new wxPanel(notebook, wxID_ANY);
|
||||||
notebook->AddPage(host_tab, _("Host"));
|
notebook->AddPage(host_tab, _("Host"));
|
||||||
|
|
||||||
m_direct_traversal = new wxChoice(panel, wxID_ANY, wxDefaultPosition, wxSize(75, -1));
|
|
||||||
m_direct_traversal->Bind(wxEVT_COMMAND_CHOICE_SELECTED, &NetPlaySetupDiag::OnChoice, this);
|
|
||||||
m_direct_traversal->Append(_("Traversal"));
|
|
||||||
m_direct_traversal->Append(_("Direct"));
|
|
||||||
m_direct_traversal->Select(0);
|
|
||||||
|
|
||||||
// connect tab
|
// connect tab
|
||||||
{
|
{
|
||||||
m_ip_lbl = new wxStaticText(connect_tab, wxID_ANY, _("Host Code :"));
|
m_ip_lbl = new wxStaticText(connect_tab, wxID_ANY, _("Host Code :"));
|
||||||
|
@ -215,7 +242,8 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl*
|
||||||
|
|
||||||
// main sizer
|
// main sizer
|
||||||
wxBoxSizer* const main_szr = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* const main_szr = new wxBoxSizer(wxVERTICAL);
|
||||||
main_szr->Add(nick_szr, 0, wxALL | wxALIGN_RIGHT, 5);
|
main_szr->Add(trav_szr, 0, wxALL | wxALIGN_LEFT);
|
||||||
|
main_szr->Add(nick_szr, 0, wxALL | wxALIGN_LEFT, 5);
|
||||||
main_szr->Add(notebook, 1, wxLEFT | wxRIGHT | wxEXPAND, 5);
|
main_szr->Add(notebook, 1, wxLEFT | wxRIGHT | wxEXPAND, 5);
|
||||||
main_szr->Add(quit_btn, 0, wxALL | wxALIGN_RIGHT, 5);
|
main_szr->Add(quit_btn, 0, wxALL | wxALIGN_RIGHT, 5);
|
||||||
|
|
||||||
|
@ -231,18 +259,8 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl*
|
||||||
Show();
|
Show();
|
||||||
|
|
||||||
// Needs to be done last or it set up the spacing on the page correctly
|
// Needs to be done last or it set up the spacing on the page correctly
|
||||||
//client tab
|
wxCommandEvent ev;
|
||||||
{
|
OnChoice(ev);
|
||||||
m_client_port_lbl->Show(false);
|
|
||||||
m_connect_port_text->Show(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//server tab
|
|
||||||
{
|
|
||||||
m_host_port_lbl->Show(false);
|
|
||||||
m_host_port_text->Show(false);
|
|
||||||
m_upnp_chk->Show(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,8 +271,22 @@ NetPlaySetupDiag::~NetPlaySetupDiag()
|
||||||
inifile.Load(dolphin_ini);
|
inifile.Load(dolphin_ini);
|
||||||
IniFile::Section& netplay_section = *inifile.GetOrCreateSection("NetPlay");
|
IniFile::Section& netplay_section = *inifile.GetOrCreateSection("NetPlay");
|
||||||
|
|
||||||
|
std::string travChoice = "traversal";
|
||||||
|
if (m_direct_traversal->GetSelection() == 1)
|
||||||
|
{
|
||||||
|
netplay_section.Set("TraversalChoice", travChoice);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
travChoice = "direct";
|
||||||
|
netplay_section.Set("TraversalChoice", travChoice);
|
||||||
|
}
|
||||||
|
|
||||||
netplay_section.Set("Nickname", WxStrToStr(m_nickname_text->GetValue()));
|
netplay_section.Set("Nickname", WxStrToStr(m_nickname_text->GetValue()));
|
||||||
if (m_direct_traversal->GetCurrentSelection() == 1)
|
netplay_section.Set("TraversalServer", WxStrToStr(m_traversal_server->GetValue()));
|
||||||
|
netplay_section.Set("TraversalPort", WxStrToStr(m_traversal_port->GetValue()));
|
||||||
|
|
||||||
|
if (m_direct_traversal->GetCurrentSelection() == 0)
|
||||||
{
|
{
|
||||||
netplay_section.Set("Address", WxStrToStr(m_connect_ip_text->GetValue()));
|
netplay_section.Set("Address", WxStrToStr(m_connect_ip_text->GetValue()));
|
||||||
}
|
}
|
||||||
|
@ -280,12 +312,14 @@ void NetPlaySetupDiag::MakeNetPlayDiag(int port, const std::string &game, bool i
|
||||||
ip = WxStrToStr(m_connect_ip_text->GetValue());
|
ip = WxStrToStr(m_connect_ip_text->GetValue());
|
||||||
|
|
||||||
bool trav;
|
bool trav;
|
||||||
if (!is_hosting && m_direct_traversal->GetCurrentSelection() == 0)
|
if (!is_hosting && m_direct_traversal->GetCurrentSelection() == 1)
|
||||||
trav = true;
|
trav = true;
|
||||||
else
|
else
|
||||||
trav = false;
|
trav = false;
|
||||||
|
|
||||||
netplay_client = new NetPlayClient(ip, (u16)port, npd, WxStrToStr(m_nickname_text->GetValue()), trav);
|
unsigned long centralPort = 0;
|
||||||
|
m_traversal_port->GetValue().ToULong(¢ralPort);
|
||||||
|
netplay_client = new NetPlayClient(ip, (u16)port, npd, WxStrToStr(m_nickname_text->GetValue()), trav, WxStrToStr(m_traversal_server->GetValue()), (u16)centralPort);
|
||||||
if (netplay_client->is_connected)
|
if (netplay_client->is_connected)
|
||||||
{
|
{
|
||||||
npd->Show();
|
npd->Show();
|
||||||
|
@ -315,14 +349,17 @@ void NetPlaySetupDiag::OnHost(wxCommandEvent&)
|
||||||
std::string game(WxStrToStr(m_game_lbox->GetStringSelection()));
|
std::string game(WxStrToStr(m_game_lbox->GetStringSelection()));
|
||||||
|
|
||||||
bool trav;
|
bool trav;
|
||||||
if (m_direct_traversal->GetCurrentSelection() == 0)
|
if (m_direct_traversal->GetCurrentSelection() == 1)
|
||||||
trav = true;
|
trav = true;
|
||||||
else
|
else
|
||||||
trav = false;
|
trav = false;
|
||||||
|
|
||||||
unsigned long port = 0;
|
unsigned long port = 0;
|
||||||
m_host_port_text->GetValue().ToULong(&port);
|
m_host_port_text->GetValue().ToULong(&port);
|
||||||
netplay_server = new NetPlayServer(u16(port), trav);
|
|
||||||
|
unsigned long centralPort = 0;
|
||||||
|
m_traversal_port->GetValue().ToULong(¢ralPort);
|
||||||
|
netplay_server = new NetPlayServer(u16(port), trav, WxStrToStr(m_traversal_server->GetValue()), u16(centralPort));
|
||||||
netplay_server->ChangeGame(game);
|
netplay_server->ChangeGame(game);
|
||||||
netplay_server->AdjustPadBufferSize(INITIAL_PAD_BUFFER_SIZE);
|
netplay_server->AdjustPadBufferSize(INITIAL_PAD_BUFFER_SIZE);
|
||||||
if (netplay_server->is_connected)
|
if (netplay_server->is_connected)
|
||||||
|
@ -361,8 +398,14 @@ void NetPlaySetupDiag::OnChoice(wxCommandEvent& event)
|
||||||
inifile.Load(File::GetUserPath(D_CONFIG_IDX) + "Dolphin.ini");
|
inifile.Load(File::GetUserPath(D_CONFIG_IDX) + "Dolphin.ini");
|
||||||
IniFile::Section& netplay_section = *inifile.GetOrCreateSection("NetPlay");
|
IniFile::Section& netplay_section = *inifile.GetOrCreateSection("NetPlay");
|
||||||
|
|
||||||
if (sel == 0)
|
if (sel == 1)
|
||||||
{
|
{
|
||||||
|
m_traversal_server_lbl->Show(true);
|
||||||
|
m_traversal_server->Show(true);
|
||||||
|
|
||||||
|
m_traversal_port_lbl->Show(true);
|
||||||
|
m_traversal_port->Show(true);
|
||||||
|
|
||||||
//Traversal
|
//Traversal
|
||||||
//client tab
|
//client tab
|
||||||
{
|
{
|
||||||
|
@ -385,6 +428,11 @@ void NetPlaySetupDiag::OnChoice(wxCommandEvent& event)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
m_traversal_server_lbl->Show(false);
|
||||||
|
m_traversal_server->Show(false);
|
||||||
|
|
||||||
|
m_traversal_port_lbl->Show(false);
|
||||||
|
m_traversal_port->Show(false);
|
||||||
//Direct
|
//Direct
|
||||||
//client tab
|
//client tab
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,6 +52,10 @@ private:
|
||||||
wxTextCtrl* m_connect_port_text;
|
wxTextCtrl* m_connect_port_text;
|
||||||
wxTextCtrl* m_connect_ip_text;
|
wxTextCtrl* m_connect_ip_text;
|
||||||
wxChoice* m_direct_traversal;
|
wxChoice* m_direct_traversal;
|
||||||
|
wxStaticText* m_traversal_server_lbl;
|
||||||
|
wxTextCtrl* m_traversal_server;
|
||||||
|
wxStaticText* m_traversal_port_lbl;
|
||||||
|
wxTextCtrl* m_traversal_port;
|
||||||
|
|
||||||
wxListBox* m_game_lbox;
|
wxListBox* m_game_lbox;
|
||||||
#ifdef USE_UPNP
|
#ifdef USE_UPNP
|
||||||
|
|
Loading…
Reference in New Issue