Add UPnP support.

Feedback is in logs as suggested by skid_au. The checkbox is still there, but
mostly for people who would like to opt out (unfortunately, I can not be sure
how this feature may behave for some routers - there's a hell of a lot of bad
UPnP implementations.)

The Visual Studio stuff is a little messy, so I apologize if anything is a bit
off. I tested most configurations and it worked.

I also tested CMake on Debian Wheezy, Ubuntu Saucy, and Mac OS X Mountain Lion.
All seemed to be OK.
This commit is contained in:
John Chadwick
2013-07-08 20:13:02 -04:00
parent 379a15ba3b
commit 16cd26d177
53 changed files with 9321 additions and 1336 deletions

View File

@ -149,6 +149,10 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl*
wxBoxSizer* const top_szr = new wxBoxSizer(wxHORIZONTAL);
top_szr->Add(port_lbl, 0, wxCENTER | wxRIGHT, 5);
top_szr->Add(m_host_port_text, 0);
#ifdef USE_UPNP
m_upnp_chk = new wxCheckBox(host_tab, wxID_ANY, _("Forward port (UPnP)"));
top_szr->Add(m_upnp_chk, 0, wxALL | wxALIGN_RIGHT, 5);
#endif
wxBoxSizer* const host_szr = new wxBoxSizer(wxVERTICAL);
host_szr->Add(top_szr, 0, wxALL | wxEXPAND, 5);
@ -220,6 +224,10 @@ void NetPlaySetupDiag::OnHost(wxCommandEvent&)
, WxStrToStr(m_nickname_text->GetValue()), npd, game);
if (netplay_ptr->is_connected)
{
#ifdef USE_UPNP
if(m_upnp_chk->GetValue())
((NetPlayServer*)netplay_ptr)->TryPortmapping(port);
#endif
npd->Show();
Destroy();
}