diff --git a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCommandsCore.cpp b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCommandsCore.cpp index 0e94e9fa..a10a2770 100644 --- a/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCommandsCore.cpp +++ b/Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCommandsCore.cpp @@ -112,6 +112,16 @@ PF_CONSOLE_CMD( SetServerDisplayName(params[0]); } +//============================================================================ +PF_CONSOLE_CMD( + Server, + Port, + "int port", + "Set server's port" +) { + SetClientPort((int)params[0]); +} + //============================================================================ // Server.File group diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbConst.h b/Sources/Plasma/NucleusLib/pnNetBase/pnNbConst.h index ca26c243..0c0afe3e 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbConst.h +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbConst.h @@ -52,10 +52,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com //============================================================================ // Network constants //============================================================================ -const unsigned kNetLegacyClientPort = 80; -const unsigned kNetDefaultClientPort = 14617; -const unsigned kNetDefaultServerPort = 14618; -const unsigned kNetDefaultSimpleNetPort = 14620; const unsigned kMaxTcpPacketSize = 1460; //============================================================================ diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.cpp b/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.cpp index 0daab489..4dc77dd4 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.cpp +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.cpp @@ -70,6 +70,8 @@ static const char* s_gateKeeperAddrs[] = { s_gateKeeperAddrConsole }; +static unsigned s_clientPort = 14617; + /***************************************************************************** * @@ -121,6 +123,18 @@ void SetGateKeeperSrvHostname (const char addr[]) { strncpy(s_gateKeeperAddrConsole, addr, arrsize(s_gateKeeperAddrConsole)); } +//============================================================================ +// Client Port +//============================================================================ +unsigned GetClientPort() { + return s_clientPort; +} + +//============================================================================ +void SetClientPort(unsigned port) { + s_clientPort = port; +} + //============================================================================ // User-visible Server diff --git a/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.h b/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.h index 88850b0f..991e9262 100644 --- a/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.h +++ b/Sources/Plasma/NucleusLib/pnNetBase/pnNbSrvs.h @@ -93,6 +93,9 @@ void SetFileSrvHostname (const char addr[]); unsigned GetGateKeeperSrvHostnames (const char*** addrs); // returns addrCount void SetGateKeeperSrvHostname (const char addr[]); +unsigned GetClientPort(); +void SetClientPort(unsigned port); + const char *GetServerStatusUrl (); void SetServerStatusUrl (const char url[]); diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp index eb4d37a0..bb17cefc 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglAuth.cpp @@ -5143,14 +5143,14 @@ void NetCliAuthStartConnect ( &cancelId, AsyncLookupCallback, authAddrList[i], - kNetDefaultClientPort, + GetClientPort(), nil ); break; } } if (!name[0]) { - plNetAddress addr(authAddrList[i], kNetDefaultClientPort); + plNetAddress addr(authAddrList[i], GetClientPort()); Connect(authAddrList[i], addr); } } diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp index 276c98a7..682ceadb 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.cpp @@ -1365,51 +1365,14 @@ void NetCliFileStartConnect ( &cancelId, AsyncLookupCallback, fileAddrList[i], - kNetDefaultClientPort, + GetClientPort(), nil ); break; } } if (!name[0]) { - plNetAddress addr(fileAddrList[i], kNetDefaultClientPort); - Connect(fileAddrList[i], addr); - } - } -} - -//============================================================================ -void NetCliFileStartConnectAsServer ( - const char* fileAddrList[], - uint32_t fileAddrCount, - unsigned serverType, - unsigned serverBuildId -) { - // TEMP: Only connect to one file server until we fill out this module - // to choose the "best" file connection. - fileAddrCount = std::min(fileAddrCount, 1u); - s_connectBuildId = serverBuildId; - s_serverType = serverType; - - for (unsigned i = 0; i < fileAddrCount; ++i) { - // Do we need to lookup the address? - const char* name = fileAddrList[i]; - while (unsigned ch = *name) { - ++name; - if (!(isdigit(ch) || ch == L'.' || ch == L':')) { - AsyncCancelId cancelId; - AsyncAddressLookupName( - &cancelId, - AsyncLookupCallback, - fileAddrList[i], - kNetDefaultClientPort, - nil - ); - break; - } - } - if (!name[0]) { - plNetAddress addr(fileAddrList[i], kNetDefaultServerPort); + plNetAddress addr(fileAddrList[i], GetClientPort()); Connect(fileAddrList[i], addr); } } diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.h b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.h index f15b9149..cca989c3 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.h +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglFile.h @@ -66,12 +66,6 @@ void NetCliFileStartConnect ( unsigned fileAddrCount, bool isPatcher = false ); -void NetCliFileStartConnectAsServer ( - const char* fileAddrList[], - unsigned fileAddrCount, - unsigned serverType, - unsigned serverBuildId -); //============================================================================ // Disconnect diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp index d24a1f80..75046c4f 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGame.cpp @@ -801,7 +801,7 @@ void GamePingEnable (bool enable) { void NetCliGameStartConnect ( const uint32_t node ) { - plNetAddress addr(node, kNetDefaultClientPort); + plNetAddress addr(node, GetClientPort()); Connect(addr); } diff --git a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp index 4264c46e..744d4bad 100644 --- a/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp +++ b/Sources/Plasma/PubUtilLib/plNetGameLib/Private/plNglGateKeeper.cpp @@ -1075,14 +1075,14 @@ void NetCliGateKeeperStartConnect ( &cancelId, AsyncLookupCallback, gateKeeperAddrList[i], - kNetDefaultClientPort, + GetClientPort(), nil ); break; } } if (!name[0]) { - plNetAddress addr(gateKeeperAddrList[i], kNetDefaultClientPort); + plNetAddress addr(gateKeeperAddrList[i], GetClientPort()); Connect(gateKeeperAddrList[i], addr); } }