rename network scripts
This commit is contained in:
@@ -57,7 +57,7 @@
|
||||
|
||||
#if defined _WINDOWS64 || defined DISABLE_PSN || defined _DISABLE_XBLIVE
|
||||
#include "Xbox\Network\NetworkPlayerXbox.h"
|
||||
#include "Common\Network\PlatformNetworkManagerStub.h"
|
||||
#include "Common\Network\PlatformNetworkManager.h"
|
||||
#endif
|
||||
|
||||
#ifdef _DURANGO
|
||||
|
||||
@@ -13,7 +13,7 @@ using namespace std;
|
||||
#elif defined _DURANGO
|
||||
#include "..\..\Durango\Network\PlatformNetworkManagerDurango.h"
|
||||
#else
|
||||
#include "PlatformNetworkManagerStub.h"
|
||||
#include "PlatformNetworkManager.h"
|
||||
#endif
|
||||
#include "SessionInfo.h"
|
||||
|
||||
|
||||
+81
-81
@@ -1,19 +1,19 @@
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "WinsockNetLayer.h"
|
||||
#include "..\..\Common\Network\PlatformNetworkManagerStub.h"
|
||||
#include "NetworkSocketLayer.h"
|
||||
#include "..\..\Common\Network\PlatformNetworkManager.h"
|
||||
#include "..\..\..\Minecraft.World\Socket.h"
|
||||
|
||||
#if defined _WINDOWS64 || defined _XBOX
|
||||
SOCKET WinsockNetLayer::s_listenSocket = INVALID_SOCKET;
|
||||
SOCKET WinsockNetLayer::s_hostConnectionSocket = INVALID_SOCKET;
|
||||
SOCKET WinsockNetLayer::s_advertiseSock = INVALID_SOCKET;
|
||||
SOCKET WinsockNetLayer::s_discoverySock = INVALID_SOCKET;
|
||||
SOCKET NetworkSocketLayer::s_listenSocket = INVALID_SOCKET;
|
||||
SOCKET NetworkSocketLayer::s_hostConnectionSocket = INVALID_SOCKET;
|
||||
SOCKET NetworkSocketLayer::s_advertiseSock = INVALID_SOCKET;
|
||||
SOCKET NetworkSocketLayer::s_discoverySock = INVALID_SOCKET;
|
||||
#elif defined __PS3__ || defined __ORBIS__
|
||||
SOCKET WinsockNetLayer::s_listenSocket = -1;
|
||||
SOCKET WinsockNetLayer::s_hostConnectionSocket = -1;
|
||||
SOCKET WinsockNetLayer::s_advertiseSock = -1;
|
||||
SOCKET WinsockNetLayer::s_discoverySock = -1;
|
||||
SOCKET NetworkSocketLayer::s_listenSocket = -1;
|
||||
SOCKET NetworkSocketLayer::s_hostConnectionSocket = -1;
|
||||
SOCKET NetworkSocketLayer::s_advertiseSock = -1;
|
||||
SOCKET NetworkSocketLayer::s_discoverySock = -1;
|
||||
|
||||
#if defined __PS3__
|
||||
int closesocket(int s) { return socketclose(s); };
|
||||
@@ -22,50 +22,50 @@ void terminate_networking() { cellNetCtlTerm(); sys_net_finalize_network(); };
|
||||
int closesocket(int s) { return sceNetSocketClose(s); };
|
||||
int socketclose(int s) { return sceNetSocketClose(s); };
|
||||
void terminate_networking() {};
|
||||
#endif
|
||||
void WSACleanup() {};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
C4JThread* WinsockNetLayer::s_acceptThread = NULL;
|
||||
C4JThread* WinsockNetLayer::s_clientRecvThread = NULL;
|
||||
C4JThread* NetworkSocketLayer::s_acceptThread = NULL;
|
||||
C4JThread* NetworkSocketLayer::s_clientRecvThread = NULL;
|
||||
|
||||
bool WinsockNetLayer::s_isHost = false;
|
||||
bool WinsockNetLayer::s_connected = false;
|
||||
bool WinsockNetLayer::s_active = false;
|
||||
bool WinsockNetLayer::s_initialized = false;
|
||||
bool NetworkSocketLayer::s_isHost = false;
|
||||
bool NetworkSocketLayer::s_connected = false;
|
||||
bool NetworkSocketLayer::s_active = false;
|
||||
bool NetworkSocketLayer::s_initialized = false;
|
||||
|
||||
BYTE WinsockNetLayer::s_localSmallId = 0;
|
||||
BYTE WinsockNetLayer::s_hostSmallId = 0;
|
||||
BYTE WinsockNetLayer::s_nextSmallId = 1;
|
||||
BYTE NetworkSocketLayer::s_localSmallId = 0;
|
||||
BYTE NetworkSocketLayer::s_hostSmallId = 0;
|
||||
BYTE NetworkSocketLayer::s_nextSmallId = 1;
|
||||
|
||||
CRITICAL_SECTION WinsockNetLayer::s_sendLock;
|
||||
CRITICAL_SECTION WinsockNetLayer::s_connectionsLock;
|
||||
CRITICAL_SECTION NetworkSocketLayer::s_sendLock;
|
||||
CRITICAL_SECTION NetworkSocketLayer::s_connectionsLock;
|
||||
|
||||
std::vector<Win64RemoteConnection> WinsockNetLayer::s_connections;
|
||||
std::vector<RemoteConnection> NetworkSocketLayer::s_connections;
|
||||
|
||||
C4JThread* WinsockNetLayer::s_advertiseThread = NULL;
|
||||
volatile bool WinsockNetLayer::s_advertising = false;
|
||||
Win64LANBroadcast WinsockNetLayer::s_advertiseData = {};
|
||||
CRITICAL_SECTION WinsockNetLayer::s_advertiseLock;
|
||||
int WinsockNetLayer::s_hostGamePort = WIN64_NET_DEFAULT_PORT;
|
||||
C4JThread* NetworkSocketLayer::s_advertiseThread = NULL;
|
||||
volatile bool NetworkSocketLayer::s_advertising = false;
|
||||
LANBroadcast NetworkSocketLayer::s_advertiseData = {};
|
||||
CRITICAL_SECTION NetworkSocketLayer::s_advertiseLock;
|
||||
int NetworkSocketLayer::s_hostGamePort = NETWORK_LAN_DEFAULT_PORT;
|
||||
|
||||
C4JThread* WinsockNetLayer::s_discoveryThread = NULL;
|
||||
volatile bool WinsockNetLayer::s_discovering = false;
|
||||
CRITICAL_SECTION WinsockNetLayer::s_discoveryLock;
|
||||
std::vector<Win64LANSession> WinsockNetLayer::s_discoveredSessions;
|
||||
C4JThread* NetworkSocketLayer::s_discoveryThread = NULL;
|
||||
volatile bool NetworkSocketLayer::s_discovering = false;
|
||||
CRITICAL_SECTION NetworkSocketLayer::s_discoveryLock;
|
||||
std::vector<LANSession> NetworkSocketLayer::s_discoveredSessions;
|
||||
|
||||
CRITICAL_SECTION WinsockNetLayer::s_disconnectLock;
|
||||
std::vector<BYTE> WinsockNetLayer::s_disconnectedSmallIds;
|
||||
CRITICAL_SECTION NetworkSocketLayer::s_disconnectLock;
|
||||
std::vector<BYTE> NetworkSocketLayer::s_disconnectedSmallIds;
|
||||
|
||||
CRITICAL_SECTION WinsockNetLayer::s_freeSmallIdLock;
|
||||
std::vector<BYTE> WinsockNetLayer::s_freeSmallIds;
|
||||
CRITICAL_SECTION NetworkSocketLayer::s_freeSmallIdLock;
|
||||
std::vector<BYTE> NetworkSocketLayer::s_freeSmallIds;
|
||||
|
||||
bool g_Win64MultiplayerHost = false;
|
||||
bool g_Win64MultiplayerJoin = true;
|
||||
int g_Win64MultiplayerPort = WIN64_NET_DEFAULT_PORT;
|
||||
char g_Win64MultiplayerIP[256] = "127.0.0.1";
|
||||
bool g_MultiplayerHost = false;
|
||||
bool g_MultiplayerJoin = true;
|
||||
int g_MultiplayerPort = NETWORK_LAN_DEFAULT_PORT;
|
||||
char g_MultiplayerIP[256] = "127.0.0.1";
|
||||
|
||||
bool WinsockNetLayer::Initialize()
|
||||
bool NetworkSocketLayer::Initialize()
|
||||
{
|
||||
if (s_initialized) return true;
|
||||
#if defined _WINDOWS64 || defined _XBOX
|
||||
@@ -105,7 +105,7 @@ bool WinsockNetLayer::Initialize()
|
||||
return true;
|
||||
}
|
||||
|
||||
void WinsockNetLayer::Shutdown()
|
||||
void NetworkSocketLayer::Shutdown()
|
||||
{
|
||||
StopAdvertising();
|
||||
StopDiscovery();
|
||||
@@ -185,7 +185,7 @@ void WinsockNetLayer::Shutdown()
|
||||
}
|
||||
}
|
||||
|
||||
bool WinsockNetLayer::HostGame(int port)
|
||||
bool NetworkSocketLayer::HostGame(int port)
|
||||
{
|
||||
if (!s_initialized && !Initialize()) return false;
|
||||
|
||||
@@ -322,7 +322,7 @@ bool WinsockNetLayer::HostGame(int port)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WinsockNetLayer::JoinGame(const char *ip, int port)
|
||||
bool NetworkSocketLayer::JoinGame(const char *ip, int port)
|
||||
{
|
||||
if (!s_initialized && !Initialize()) return false;
|
||||
|
||||
@@ -704,7 +704,7 @@ bool WinsockNetLayer::JoinGame(const char *ip, int port)
|
||||
}
|
||||
|
||||
|
||||
bool WinsockNetLayer::SendOnSocket(SOCKET sock, const void *data, int dataSize)
|
||||
bool NetworkSocketLayer::SendOnSocket(SOCKET sock, const void *data, int dataSize)
|
||||
{
|
||||
#if defined _WINDOWS64 || defined _XBOX
|
||||
if (sock == INVALID_SOCKET || dataSize <= 0) return false;
|
||||
@@ -758,7 +758,7 @@ bool WinsockNetLayer::SendOnSocket(SOCKET sock, const void *data, int dataSize)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WinsockNetLayer::SendToSmallId(BYTE targetSmallId, const void *data, int dataSize)
|
||||
bool NetworkSocketLayer::SendToSmallId(BYTE targetSmallId, const void *data, int dataSize)
|
||||
{
|
||||
if (!s_active) return false;
|
||||
|
||||
@@ -778,7 +778,7 @@ bool WinsockNetLayer::SendToSmallId(BYTE targetSmallId, const void *data, int da
|
||||
}
|
||||
}
|
||||
|
||||
SOCKET WinsockNetLayer::GetSocketForSmallId(BYTE smallId)
|
||||
SOCKET NetworkSocketLayer::GetSocketForSmallId(BYTE smallId)
|
||||
{
|
||||
EnterCriticalSection(&s_connectionsLock);
|
||||
for (size_t i = 0; i < s_connections.size(); i++)
|
||||
@@ -810,7 +810,7 @@ static bool RecvExact(SOCKET sock, BYTE *buf, int len)
|
||||
return true;
|
||||
}
|
||||
|
||||
void WinsockNetLayer::HandleDataReceived(BYTE fromSmallId, BYTE toSmallId, unsigned char *data, unsigned int dataSize)
|
||||
void NetworkSocketLayer::HandleDataReceived(BYTE fromSmallId, BYTE toSmallId, unsigned char *data, unsigned int dataSize)
|
||||
{
|
||||
INetworkPlayer *pPlayerFrom = g_NetworkManager.GetPlayerBySmallId(fromSmallId);
|
||||
INetworkPlayer *pPlayerTo = g_NetworkManager.GetPlayerBySmallId(toSmallId);
|
||||
@@ -831,7 +831,7 @@ void WinsockNetLayer::HandleDataReceived(BYTE fromSmallId, BYTE toSmallId, unsig
|
||||
}
|
||||
}
|
||||
|
||||
int WinsockNetLayer::AcceptThreadProc(LPVOID param)
|
||||
int NetworkSocketLayer::AcceptThreadProc(LPVOID param)
|
||||
{
|
||||
while (s_active)
|
||||
{
|
||||
@@ -892,7 +892,7 @@ int WinsockNetLayer::AcceptThreadProc(LPVOID param)
|
||||
continue;
|
||||
}
|
||||
|
||||
Win64RemoteConnection conn;
|
||||
RemoteConnection conn;
|
||||
conn.tcpSocket = clientSocket;
|
||||
conn.smallId = assignedSmallId;
|
||||
conn.active = true;
|
||||
@@ -926,7 +926,7 @@ int WinsockNetLayer::AcceptThreadProc(LPVOID param)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int WinsockNetLayer::RecvThreadProc(LPVOID param)
|
||||
int NetworkSocketLayer::RecvThreadProc(LPVOID param)
|
||||
{
|
||||
DWORD connIdx = *(DWORD *)param;
|
||||
delete (DWORD *)param;
|
||||
@@ -942,7 +942,7 @@ int WinsockNetLayer::RecvThreadProc(LPVOID param)
|
||||
LeaveCriticalSection(&s_connectionsLock);
|
||||
|
||||
std::vector<BYTE> recvBuf;
|
||||
recvBuf.resize(WIN64_NET_RECV_BUFFER_SIZE);
|
||||
recvBuf.resize(NETWORK_LAN_RECV_BUFFER_SIZE);
|
||||
|
||||
while (s_active)
|
||||
{
|
||||
@@ -959,12 +959,12 @@ int WinsockNetLayer::RecvThreadProc(LPVOID param)
|
||||
((uint32_t)header[2] << 8) |
|
||||
((uint32_t)header[3]);
|
||||
|
||||
if (packetSize <= 0 || packetSize > WIN64_NET_MAX_PACKET_SIZE)
|
||||
if (packetSize <= 0 || packetSize > NETWORK_LAN_MAX_PACKET_SIZE)
|
||||
{
|
||||
app.DebugPrintf("LAN: Invalid packet size %d from client smallId=%d (max=%d)\n",
|
||||
packetSize,
|
||||
clientSmallId,
|
||||
(int)WIN64_NET_MAX_PACKET_SIZE);
|
||||
(int)NETWORK_LAN_MAX_PACKET_SIZE);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1006,7 +1006,7 @@ int WinsockNetLayer::RecvThreadProc(LPVOID param)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool WinsockNetLayer::PopDisconnectedSmallId(BYTE *outSmallId)
|
||||
bool NetworkSocketLayer::PopDisconnectedSmallId(BYTE *outSmallId)
|
||||
{
|
||||
bool found = false;
|
||||
EnterCriticalSection(&s_disconnectLock);
|
||||
@@ -1020,14 +1020,14 @@ bool WinsockNetLayer::PopDisconnectedSmallId(BYTE *outSmallId)
|
||||
return found;
|
||||
}
|
||||
|
||||
void WinsockNetLayer::PushFreeSmallId(BYTE smallId)
|
||||
void NetworkSocketLayer::PushFreeSmallId(BYTE smallId)
|
||||
{
|
||||
EnterCriticalSection(&s_freeSmallIdLock);
|
||||
s_freeSmallIds.push_back(smallId);
|
||||
LeaveCriticalSection(&s_freeSmallIdLock);
|
||||
}
|
||||
|
||||
void WinsockNetLayer::CloseConnectionBySmallId(BYTE smallId)
|
||||
void NetworkSocketLayer::CloseConnectionBySmallId(BYTE smallId)
|
||||
{
|
||||
EnterCriticalSection(&s_connectionsLock);
|
||||
for (size_t i = 0; i < s_connections.size(); i++)
|
||||
@@ -1043,10 +1043,10 @@ void WinsockNetLayer::CloseConnectionBySmallId(BYTE smallId)
|
||||
LeaveCriticalSection(&s_connectionsLock);
|
||||
}
|
||||
|
||||
int WinsockNetLayer::ClientRecvThreadProc(LPVOID param)
|
||||
int NetworkSocketLayer::ClientRecvThreadProc(LPVOID param)
|
||||
{
|
||||
std::vector<BYTE> recvBuf;
|
||||
recvBuf.resize(WIN64_NET_RECV_BUFFER_SIZE);
|
||||
recvBuf.resize(NETWORK_LAN_RECV_BUFFER_SIZE);
|
||||
|
||||
#if defined _WINDOWS64 || defined _XBOX
|
||||
while (s_active && s_hostConnectionSocket != INVALID_SOCKET)
|
||||
@@ -1063,7 +1063,7 @@ int WinsockNetLayer::ClientRecvThreadProc(LPVOID param)
|
||||
|
||||
int packetSize = (header[0] << 24) | (header[1] << 16) | (header[2] << 8) | header[3];
|
||||
|
||||
if (packetSize <= 0 || packetSize > WIN64_NET_MAX_PACKET_SIZE)
|
||||
if (packetSize <= 0 || packetSize > NETWORK_LAN_MAX_PACKET_SIZE)
|
||||
{
|
||||
app.DebugPrintf("LAN: Invalid packet size %d from host\n", packetSize);
|
||||
break;
|
||||
@@ -1088,14 +1088,14 @@ int WinsockNetLayer::ClientRecvThreadProc(LPVOID param)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool WinsockNetLayer::StartAdvertising(int gamePort, const wchar_t *hostName, unsigned int gameSettings, unsigned int texPackId, unsigned char subTexId, unsigned short netVer)
|
||||
bool NetworkSocketLayer::StartAdvertising(int gamePort, const wchar_t *hostName, unsigned int gameSettings, unsigned int texPackId, unsigned char subTexId, unsigned short netVer)
|
||||
{
|
||||
if (s_advertising) return true;
|
||||
if (!s_initialized) return false;
|
||||
|
||||
EnterCriticalSection(&s_advertiseLock);
|
||||
memset(&s_advertiseData, 0, sizeof(s_advertiseData));
|
||||
s_advertiseData.magic = WIN64_LAN_BROADCAST_MAGIC;
|
||||
s_advertiseData.magic = NETWORK_LAN_BROADCAST_MAGIC;
|
||||
s_advertiseData.netVersion = netVer;
|
||||
s_advertiseData.gamePort = (WORD)gamePort;
|
||||
size_t converted = wcstombs(s_advertiseData.hostName, hostName, 32);
|
||||
@@ -1129,11 +1129,11 @@ bool WinsockNetLayer::StartAdvertising(int gamePort, const wchar_t *hostName, un
|
||||
s_advertising = true;
|
||||
s_advertiseThread = new C4JThread(AdvertiseThreadProc, NULL, "AdvertiseThreadProc");
|
||||
s_advertiseThread->Run();
|
||||
app.DebugPrintf("Win64 LAN: Started advertising on UDP port %d\n", WIN64_LAN_DISCOVERY_PORT);
|
||||
app.DebugPrintf("Win64 LAN: Started advertising on UDP port %d\n", NETWORK_LAN_DISCOVERY_PORT);
|
||||
return true;
|
||||
}
|
||||
|
||||
void WinsockNetLayer::StopAdvertising()
|
||||
void NetworkSocketLayer::StopAdvertising()
|
||||
{
|
||||
s_advertising = false;
|
||||
|
||||
@@ -1159,14 +1159,14 @@ void WinsockNetLayer::StopAdvertising()
|
||||
}
|
||||
}
|
||||
|
||||
void WinsockNetLayer::UpdateAdvertisePlayerCount(BYTE count)
|
||||
void NetworkSocketLayer::UpdateAdvertisePlayerCount(BYTE count)
|
||||
{
|
||||
EnterCriticalSection(&s_advertiseLock);
|
||||
s_advertiseData.playerCount = count;
|
||||
LeaveCriticalSection(&s_advertiseLock);
|
||||
}
|
||||
|
||||
void WinsockNetLayer::UpdateAdvertisePlayerNames(BYTE count, const char playerNames[][XUSER_NAME_SIZE])
|
||||
void NetworkSocketLayer::UpdateAdvertisePlayerNames(BYTE count, const char playerNames[][XUSER_NAME_SIZE])
|
||||
{
|
||||
EnterCriticalSection(&s_advertiseLock);
|
||||
memset(s_advertiseData.playerNames, 0, sizeof(s_advertiseData.playerNames));
|
||||
@@ -1178,25 +1178,25 @@ void WinsockNetLayer::UpdateAdvertisePlayerNames(BYTE count, const char playerNa
|
||||
LeaveCriticalSection(&s_advertiseLock);
|
||||
}
|
||||
|
||||
void WinsockNetLayer::UpdateAdvertiseJoinable(bool joinable)
|
||||
void NetworkSocketLayer::UpdateAdvertiseJoinable(bool joinable)
|
||||
{
|
||||
EnterCriticalSection(&s_advertiseLock);
|
||||
s_advertiseData.isJoinable = joinable ? 1 : 0;
|
||||
LeaveCriticalSection(&s_advertiseLock);
|
||||
}
|
||||
|
||||
int WinsockNetLayer::AdvertiseThreadProc(LPVOID param)
|
||||
int NetworkSocketLayer::AdvertiseThreadProc(LPVOID param)
|
||||
{
|
||||
struct sockaddr_in broadcastAddr;
|
||||
memset(&broadcastAddr, 0, sizeof(broadcastAddr));
|
||||
broadcastAddr.sin_family = AF_INET;
|
||||
broadcastAddr.sin_port = htons(WIN64_LAN_DISCOVERY_PORT);
|
||||
broadcastAddr.sin_port = htons(NETWORK_LAN_DISCOVERY_PORT);
|
||||
broadcastAddr.sin_addr.s_addr = INADDR_BROADCAST;
|
||||
|
||||
while (s_advertising)
|
||||
{
|
||||
EnterCriticalSection(&s_advertiseLock);
|
||||
Win64LANBroadcast data = s_advertiseData;
|
||||
LANBroadcast data = s_advertiseData;
|
||||
LeaveCriticalSection(&s_advertiseLock);
|
||||
|
||||
data.magic = htonl(data.magic);
|
||||
@@ -1226,7 +1226,7 @@ int WinsockNetLayer::AdvertiseThreadProc(LPVOID param)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool WinsockNetLayer::StartDiscovery()
|
||||
bool NetworkSocketLayer::StartDiscovery()
|
||||
{
|
||||
if (s_discovering) return true;
|
||||
if (!s_initialized) return false;
|
||||
@@ -1254,7 +1254,7 @@ bool WinsockNetLayer::StartDiscovery()
|
||||
struct sockaddr_in bindAddr;
|
||||
memset(&bindAddr, 0, sizeof(bindAddr));
|
||||
bindAddr.sin_family = AF_INET;
|
||||
bindAddr.sin_port = htons(WIN64_LAN_DISCOVERY_PORT);
|
||||
bindAddr.sin_port = htons(NETWORK_LAN_DISCOVERY_PORT);
|
||||
bindAddr.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
#if defined _WINDOWS64 || defined _XBOX
|
||||
@@ -1285,11 +1285,11 @@ bool WinsockNetLayer::StartDiscovery()
|
||||
s_discoveryThread = new C4JThread(DiscoveryThreadProc, NULL, "DiscoveryThreadProc");
|
||||
s_discoveryThread->Run();
|
||||
|
||||
app.DebugPrintf("LAN: Listening for LAN games on UDP port %d\n", WIN64_LAN_DISCOVERY_PORT);
|
||||
app.DebugPrintf("LAN: Listening for LAN games on UDP port %d\n", NETWORK_LAN_DISCOVERY_PORT);
|
||||
return true;
|
||||
}
|
||||
|
||||
void WinsockNetLayer::StopDiscovery()
|
||||
void NetworkSocketLayer::StopDiscovery()
|
||||
{
|
||||
s_discovering = false;
|
||||
|
||||
@@ -1319,9 +1319,9 @@ void WinsockNetLayer::StopDiscovery()
|
||||
LeaveCriticalSection(&s_discoveryLock);
|
||||
}
|
||||
|
||||
std::vector<Win64LANSession> WinsockNetLayer::GetDiscoveredSessions()
|
||||
std::vector<LANSession> NetworkSocketLayer::GetDiscoveredSessions()
|
||||
{
|
||||
std::vector<Win64LANSession> result;
|
||||
std::vector<LANSession> result;
|
||||
if (TryEnterCriticalSection(&s_discoveryLock))
|
||||
{
|
||||
result = s_discoveredSessions;
|
||||
@@ -1330,7 +1330,7 @@ std::vector<Win64LANSession> WinsockNetLayer::GetDiscoveredSessions()
|
||||
return result;
|
||||
}
|
||||
|
||||
int WinsockNetLayer::DiscoveryThreadProc(LPVOID param)
|
||||
int NetworkSocketLayer::DiscoveryThreadProc(LPVOID param)
|
||||
{
|
||||
app.DebugPrintf("Discovery thread started\n");
|
||||
char recvBuf[1024];
|
||||
@@ -1359,10 +1359,10 @@ int WinsockNetLayer::DiscoveryThreadProc(LPVOID param)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (recvLen < (int)sizeof(Win64LANBroadcast))
|
||||
if (recvLen < (int)sizeof(LANBroadcast))
|
||||
continue;
|
||||
|
||||
Win64LANBroadcast *broadcast = (Win64LANBroadcast *)recvBuf;
|
||||
LANBroadcast *broadcast = (LANBroadcast *)recvBuf;
|
||||
|
||||
broadcast->magic = ntohl(broadcast->magic);
|
||||
broadcast->netVersion = ntohs(broadcast->netVersion);
|
||||
@@ -1370,7 +1370,7 @@ int WinsockNetLayer::DiscoveryThreadProc(LPVOID param)
|
||||
broadcast->gameHostSettings = ntohl(broadcast->gameHostSettings);
|
||||
broadcast->texturePackParentId = ntohl(broadcast->texturePackParentId);
|
||||
|
||||
if (broadcast->magic != WIN64_LAN_BROADCAST_MAGIC)
|
||||
if (broadcast->magic != NETWORK_LAN_BROADCAST_MAGIC)
|
||||
continue;
|
||||
|
||||
char senderIP[64];
|
||||
@@ -1415,7 +1415,7 @@ int WinsockNetLayer::DiscoveryThreadProc(LPVOID param)
|
||||
|
||||
if (!found)
|
||||
{
|
||||
Win64LANSession session;
|
||||
LANSession session;
|
||||
memset(&session, 0, sizeof(session));
|
||||
strncpy(session.hostIP, senderIP, sizeof(session.hostIP) - 1);
|
||||
session.hostIP[sizeof(session.hostIP) - 1] = '\0';
|
||||
+18
-18
@@ -30,12 +30,12 @@
|
||||
#pragma comment(lib, "Ws2_32.lib")
|
||||
#endif
|
||||
|
||||
#define WIN64_NET_DEFAULT_PORT 25565
|
||||
#define WIN64_NET_MAX_CLIENTS 7
|
||||
#define WIN64_NET_RECV_BUFFER_SIZE 65536
|
||||
#define WIN64_NET_MAX_PACKET_SIZE (4 * 1024 * 1024)
|
||||
#define WIN64_LAN_DISCOVERY_PORT 25566
|
||||
#define WIN64_LAN_BROADCAST_MAGIC 0x4D434C4E
|
||||
#define NETWORK_LAN_DEFAULT_PORT 25565
|
||||
#define NETWORK_LAN_MAX_CLIENTS 7
|
||||
#define NETWORK_LAN_RECV_BUFFER_SIZE 65536
|
||||
#define NETWORK_LAN_MAX_PACKET_SIZE (4 * 1024 * 1024)
|
||||
#define NETWORK_LAN_DISCOVERY_PORT 25566
|
||||
#define NETWORK_LAN_BROADCAST_MAGIC 0x4D434C4E
|
||||
|
||||
#if defined __PS3__ || defined __ORBIS__
|
||||
typedef int SOCKET;
|
||||
@@ -45,7 +45,7 @@ typedef int SOCKET;
|
||||
class Socket;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct Win64LANBroadcast
|
||||
struct LANBroadcast
|
||||
{
|
||||
DWORD magic;
|
||||
WORD netVersion;
|
||||
@@ -61,7 +61,7 @@ struct Win64LANBroadcast
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
struct Win64LANSession
|
||||
struct LANSession
|
||||
{
|
||||
char hostIP[64];
|
||||
int hostPort;
|
||||
@@ -77,7 +77,7 @@ struct Win64LANSession
|
||||
char playerNames[8][XUSER_NAME_SIZE];
|
||||
};
|
||||
|
||||
struct Win64RemoteConnection
|
||||
struct RemoteConnection
|
||||
{
|
||||
SOCKET tcpSocket;
|
||||
BYTE smallId;
|
||||
@@ -85,7 +85,7 @@ struct Win64RemoteConnection
|
||||
volatile bool active;
|
||||
};
|
||||
|
||||
class WinsockNetLayer
|
||||
class NetworkSocketLayer
|
||||
{
|
||||
public:
|
||||
static bool Initialize();
|
||||
@@ -120,7 +120,7 @@ public:
|
||||
|
||||
static bool StartDiscovery();
|
||||
static void StopDiscovery();
|
||||
static vector<Win64LANSession> GetDiscoveredSessions();
|
||||
static vector<LANSession> GetDiscoveredSessions();
|
||||
|
||||
static int GetHostPort() { return s_hostGamePort; }
|
||||
|
||||
@@ -148,12 +148,12 @@ private:
|
||||
static CRITICAL_SECTION s_sendLock;
|
||||
static CRITICAL_SECTION s_connectionsLock;
|
||||
|
||||
static std::vector<Win64RemoteConnection> s_connections;
|
||||
static std::vector<RemoteConnection> s_connections;
|
||||
|
||||
static SOCKET s_advertiseSock;
|
||||
static C4JThread* s_advertiseThread;
|
||||
static volatile bool s_advertising;
|
||||
static Win64LANBroadcast s_advertiseData;
|
||||
static LANBroadcast s_advertiseData;
|
||||
static CRITICAL_SECTION s_advertiseLock;
|
||||
static int s_hostGamePort;
|
||||
|
||||
@@ -161,7 +161,7 @@ private:
|
||||
static C4JThread* s_discoveryThread;
|
||||
static volatile bool s_discovering;
|
||||
static CRITICAL_SECTION s_discoveryLock;
|
||||
static std::vector<Win64LANSession> s_discoveredSessions;
|
||||
static std::vector<LANSession> s_discoveredSessions;
|
||||
|
||||
static CRITICAL_SECTION s_disconnectLock;
|
||||
static std::vector<BYTE> s_disconnectedSmallIds;
|
||||
@@ -170,7 +170,7 @@ private:
|
||||
static std::vector<BYTE> s_freeSmallIds;
|
||||
};
|
||||
|
||||
extern bool g_Win64MultiplayerHost;
|
||||
extern bool g_Win64MultiplayerJoin;
|
||||
extern int g_Win64MultiplayerPort;
|
||||
extern char g_Win64MultiplayerIP[256];
|
||||
extern bool g_MultiplayerHost;
|
||||
extern bool g_MultiplayerJoin;
|
||||
extern int g_MultiplayerPort;
|
||||
extern char g_MultiplayerIP[256];
|
||||
+943
-943
File diff suppressed because it is too large
Load Diff
+171
-171
@@ -1,171 +1,171 @@
|
||||
#pragma once
|
||||
using namespace std;
|
||||
#include <vector>
|
||||
#include "..\..\..\Minecraft.World\C4JThread.h"
|
||||
#include "NetworkPlayerInterface.h"
|
||||
#include "PlatformNetworkManagerInterface.h"
|
||||
#include "SessionInfo.h"
|
||||
|
||||
class CPlatformNetworkManagerStub : public CPlatformNetworkManager
|
||||
{
|
||||
friend class CGameNetworkManager;
|
||||
public:
|
||||
virtual bool Initialise(CGameNetworkManager *pGameNetworkManager, int flagIndexSize);
|
||||
virtual void Terminate();
|
||||
virtual int GetJoiningReadyPercentage();
|
||||
virtual int CorrectErrorIDS(int IDS);
|
||||
|
||||
virtual void DoWork();
|
||||
virtual int GetPlayerCount();
|
||||
virtual int GetOnlinePlayerCount();
|
||||
virtual int GetLocalPlayerMask(int playerIndex);
|
||||
virtual bool AddLocalPlayerByUserIndex( int userIndex );
|
||||
virtual bool RemoveLocalPlayerByUserIndex( int userIndex );
|
||||
virtual INetworkPlayer *GetLocalPlayerByUserIndex( int userIndex );
|
||||
virtual INetworkPlayer *GetPlayerByIndex(int playerIndex);
|
||||
virtual INetworkPlayer * GetPlayerByXuid(PlayerUID xuid);
|
||||
virtual INetworkPlayer * GetPlayerBySmallId(unsigned char smallId);
|
||||
virtual bool ShouldMessageForFullSession();
|
||||
|
||||
virtual INetworkPlayer *GetHostPlayer();
|
||||
virtual bool IsHost();
|
||||
virtual bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo);
|
||||
virtual bool LeaveGame(bool bMigrateHost);
|
||||
|
||||
virtual bool IsInSession();
|
||||
virtual bool IsInGameplay();
|
||||
virtual bool IsReadyToPlayOrIdle();
|
||||
virtual bool IsInStatsEnabledSession();
|
||||
virtual bool SessionHasSpace(unsigned int spaceRequired = 1);
|
||||
virtual void SendInviteGUI(int quadrant);
|
||||
virtual bool IsAddingPlayer();
|
||||
|
||||
virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0);
|
||||
virtual int JoinGame(FriendSessionInfo *searchResult, int localUsersMask, int primaryUserIndex );
|
||||
virtual bool SetLocalGame(bool isLocal);
|
||||
virtual bool IsLocalGame() { return m_bIsOfflineGame; }
|
||||
virtual void SetPrivateGame(bool isPrivate);
|
||||
virtual bool IsPrivateGame() { return m_bIsPrivateGame; }
|
||||
virtual bool IsLeavingGame() { return m_bLeavingGame; }
|
||||
virtual void ResetLeavingGame() { m_bLeavingGame = false; }
|
||||
|
||||
virtual void RegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam);
|
||||
virtual void UnRegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam);
|
||||
|
||||
virtual void HandleSignInChange();
|
||||
|
||||
virtual bool _RunNetworkGame();
|
||||
|
||||
private:
|
||||
bool isSystemPrimaryPlayer(IQNetPlayer *pQNetPlayer);
|
||||
virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom);
|
||||
virtual void _HostGame(int dwUsersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0);
|
||||
virtual bool _StartGame();
|
||||
|
||||
IQNet * m_pIQNet; // pointer to QNet interface
|
||||
|
||||
HANDLE m_notificationListener;
|
||||
|
||||
vector<IQNetPlayer *> m_machineQNetPrimaryPlayers; // collection of players that we deem to be the main one for that system
|
||||
|
||||
bool m_bLeavingGame;
|
||||
bool m_bLeaveGameOnTick;
|
||||
bool m_migrateHostOnLeave;
|
||||
bool m_bHostChanged;
|
||||
|
||||
bool m_bIsOfflineGame;
|
||||
bool m_bIsPrivateGame;
|
||||
int m_flagIndexSize;
|
||||
|
||||
// This is only maintained by the host, and is not valid on client machines
|
||||
GameSessionData m_hostGameSessionData;
|
||||
CGameNetworkManager *m_pGameNetworkManager;
|
||||
public:
|
||||
virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL);
|
||||
|
||||
private:
|
||||
// TODO 4J Stu - Do we need to be able to have more than one of these?
|
||||
void (*playerChangedCallback[XUSER_MAX_COUNT])(void *callbackParam, INetworkPlayer *pPlayer, bool leaving);
|
||||
void *playerChangedCallbackParam[XUSER_MAX_COUNT];
|
||||
|
||||
static int RemovePlayerOnSocketClosedThreadProc( void* lpParam );
|
||||
virtual bool RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer );
|
||||
|
||||
// Things for handling per-system flags
|
||||
class PlayerFlags
|
||||
{
|
||||
public:
|
||||
INetworkPlayer *m_pNetworkPlayer;
|
||||
unsigned char *flags;
|
||||
unsigned int count;
|
||||
PlayerFlags(INetworkPlayer *pNetworkPlayer, unsigned int count);
|
||||
~PlayerFlags();
|
||||
};
|
||||
vector<PlayerFlags *> m_playerFlags;
|
||||
void SystemFlagAddPlayer(INetworkPlayer *pNetworkPlayer);
|
||||
void SystemFlagRemovePlayer(INetworkPlayer *pNetworkPlayer);
|
||||
void SystemFlagReset();
|
||||
public:
|
||||
virtual void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index);
|
||||
virtual bool SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index);
|
||||
|
||||
// For telemetry
|
||||
private:
|
||||
float m_lastPlayerEventTimeStart;
|
||||
|
||||
public:
|
||||
wstring GatherStats();
|
||||
wstring GatherRTTStats();
|
||||
|
||||
private:
|
||||
vector<FriendSessionInfo *> friendsSessions[XUSER_MAX_COUNT];
|
||||
int m_searchResultsCount[XUSER_MAX_COUNT];
|
||||
int m_lastSearchStartTime[XUSER_MAX_COUNT];
|
||||
|
||||
// The results that will be filled in with the current search
|
||||
XSESSION_SEARCHRESULT_HEADER *m_pSearchResults[XUSER_MAX_COUNT];
|
||||
XNQOS *m_pQoSResult[XUSER_MAX_COUNT];
|
||||
|
||||
// The results from the previous search, which are currently displayed in the game
|
||||
XSESSION_SEARCHRESULT_HEADER *m_pCurrentSearchResults[XUSER_MAX_COUNT];
|
||||
XNQOS *m_pCurrentQoSResult[XUSER_MAX_COUNT];
|
||||
int m_currentSearchResultsCount[XUSER_MAX_COUNT];
|
||||
|
||||
int m_lastSearchPad;
|
||||
bool m_bSearchResultsReady;
|
||||
bool m_bSearchPending;
|
||||
LPVOID m_pSearchParam;
|
||||
void (*m_SessionsUpdatedCallback)(LPVOID pParam);
|
||||
|
||||
C4JThread* m_SearchingThread;
|
||||
|
||||
void TickSearch();
|
||||
void SearchForGames();
|
||||
static int SearchForGamesThreadProc( void* lpParameter );
|
||||
|
||||
void SetSearchResultsReady(int resultCount = 0);
|
||||
|
||||
vector<INetworkPlayer *>currentNetworkPlayers;
|
||||
INetworkPlayer *addNetworkPlayer(IQNetPlayer *pQNetPlayer);
|
||||
void removeNetworkPlayer(IQNetPlayer *pQNetPlayer);
|
||||
static INetworkPlayer *getNetworkPlayer(IQNetPlayer *pQNetPlayer);
|
||||
|
||||
virtual void SetSessionTexturePackParentId( int id );
|
||||
virtual void SetSessionSubTexturePackId( int id );
|
||||
virtual void Notify(int ID, ULONG_PTR Param);
|
||||
|
||||
public:
|
||||
virtual vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly);
|
||||
virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession);
|
||||
virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam );
|
||||
virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam );
|
||||
virtual void ForceFriendsSessionRefresh();
|
||||
|
||||
public:
|
||||
void NotifyPlayerJoined( IQNetPlayer *pQNetPlayer );
|
||||
void NotifyPlayerLeaving( IQNetPlayer *pQNetPlayer );
|
||||
|
||||
#ifndef _XBOX
|
||||
void FakeLocalPlayerJoined() { NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(0)); }
|
||||
#endif
|
||||
};
|
||||
#pragma once
|
||||
using namespace std;
|
||||
#include <vector>
|
||||
#include "..\..\..\Minecraft.World\C4JThread.h"
|
||||
#include "NetworkPlayerInterface.h"
|
||||
#include "PlatformNetworkManagerInterface.h"
|
||||
#include "SessionInfo.h"
|
||||
|
||||
class CPlatformNetworkManagerStub : public CPlatformNetworkManager
|
||||
{
|
||||
friend class CGameNetworkManager;
|
||||
public:
|
||||
virtual bool Initialise(CGameNetworkManager *pGameNetworkManager, int flagIndexSize);
|
||||
virtual void Terminate();
|
||||
virtual int GetJoiningReadyPercentage();
|
||||
virtual int CorrectErrorIDS(int IDS);
|
||||
|
||||
virtual void DoWork();
|
||||
virtual int GetPlayerCount();
|
||||
virtual int GetOnlinePlayerCount();
|
||||
virtual int GetLocalPlayerMask(int playerIndex);
|
||||
virtual bool AddLocalPlayerByUserIndex( int userIndex );
|
||||
virtual bool RemoveLocalPlayerByUserIndex( int userIndex );
|
||||
virtual INetworkPlayer *GetLocalPlayerByUserIndex( int userIndex );
|
||||
virtual INetworkPlayer *GetPlayerByIndex(int playerIndex);
|
||||
virtual INetworkPlayer * GetPlayerByXuid(PlayerUID xuid);
|
||||
virtual INetworkPlayer * GetPlayerBySmallId(unsigned char smallId);
|
||||
virtual bool ShouldMessageForFullSession();
|
||||
|
||||
virtual INetworkPlayer *GetHostPlayer();
|
||||
virtual bool IsHost();
|
||||
virtual bool JoinGameFromInviteInfo( int userIndex, int userMask, const INVITE_INFO *pInviteInfo);
|
||||
virtual bool LeaveGame(bool bMigrateHost);
|
||||
|
||||
virtual bool IsInSession();
|
||||
virtual bool IsInGameplay();
|
||||
virtual bool IsReadyToPlayOrIdle();
|
||||
virtual bool IsInStatsEnabledSession();
|
||||
virtual bool SessionHasSpace(unsigned int spaceRequired = 1);
|
||||
virtual void SendInviteGUI(int quadrant);
|
||||
virtual bool IsAddingPlayer();
|
||||
|
||||
virtual void HostGame(int localUsersMask, bool bOnlineGame, bool bIsPrivate, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0);
|
||||
virtual int JoinGame(FriendSessionInfo *searchResult, int localUsersMask, int primaryUserIndex );
|
||||
virtual bool SetLocalGame(bool isLocal);
|
||||
virtual bool IsLocalGame() { return m_bIsOfflineGame; }
|
||||
virtual void SetPrivateGame(bool isPrivate);
|
||||
virtual bool IsPrivateGame() { return m_bIsPrivateGame; }
|
||||
virtual bool IsLeavingGame() { return m_bLeavingGame; }
|
||||
virtual void ResetLeavingGame() { m_bLeavingGame = false; }
|
||||
|
||||
virtual void RegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam);
|
||||
virtual void UnRegisterPlayerChangedCallback(int iPad, void (*callback)(void *callbackParam, INetworkPlayer *pPlayer, bool leaving), void *callbackParam);
|
||||
|
||||
virtual void HandleSignInChange();
|
||||
|
||||
virtual bool _RunNetworkGame();
|
||||
|
||||
private:
|
||||
bool isSystemPrimaryPlayer(IQNetPlayer *pQNetPlayer);
|
||||
virtual bool _LeaveGame(bool bMigrateHost, bool bLeaveRoom);
|
||||
virtual void _HostGame(int dwUsersMask, unsigned char publicSlots = MINECRAFT_NET_MAX_PLAYERS, unsigned char privateSlots = 0);
|
||||
virtual bool _StartGame();
|
||||
|
||||
IQNet * m_pIQNet; // pointer to QNet interface
|
||||
|
||||
HANDLE m_notificationListener;
|
||||
|
||||
vector<IQNetPlayer *> m_machineQNetPrimaryPlayers; // collection of players that we deem to be the main one for that system
|
||||
|
||||
bool m_bLeavingGame;
|
||||
bool m_bLeaveGameOnTick;
|
||||
bool m_migrateHostOnLeave;
|
||||
bool m_bHostChanged;
|
||||
|
||||
bool m_bIsOfflineGame;
|
||||
bool m_bIsPrivateGame;
|
||||
int m_flagIndexSize;
|
||||
|
||||
// This is only maintained by the host, and is not valid on client machines
|
||||
GameSessionData m_hostGameSessionData;
|
||||
CGameNetworkManager *m_pGameNetworkManager;
|
||||
public:
|
||||
virtual void UpdateAndSetGameSessionData(INetworkPlayer *pNetworkPlayerLeaving = NULL);
|
||||
|
||||
private:
|
||||
// TODO 4J Stu - Do we need to be able to have more than one of these?
|
||||
void (*playerChangedCallback[XUSER_MAX_COUNT])(void *callbackParam, INetworkPlayer *pPlayer, bool leaving);
|
||||
void *playerChangedCallbackParam[XUSER_MAX_COUNT];
|
||||
|
||||
static int RemovePlayerOnSocketClosedThreadProc( void* lpParam );
|
||||
virtual bool RemoveLocalPlayer( INetworkPlayer *pNetworkPlayer );
|
||||
|
||||
// Things for handling per-system flags
|
||||
class PlayerFlags
|
||||
{
|
||||
public:
|
||||
INetworkPlayer *m_pNetworkPlayer;
|
||||
unsigned char *flags;
|
||||
unsigned int count;
|
||||
PlayerFlags(INetworkPlayer *pNetworkPlayer, unsigned int count);
|
||||
~PlayerFlags();
|
||||
};
|
||||
vector<PlayerFlags *> m_playerFlags;
|
||||
void SystemFlagAddPlayer(INetworkPlayer *pNetworkPlayer);
|
||||
void SystemFlagRemovePlayer(INetworkPlayer *pNetworkPlayer);
|
||||
void SystemFlagReset();
|
||||
public:
|
||||
virtual void SystemFlagSet(INetworkPlayer *pNetworkPlayer, int index);
|
||||
virtual bool SystemFlagGet(INetworkPlayer *pNetworkPlayer, int index);
|
||||
|
||||
// For telemetry
|
||||
private:
|
||||
float m_lastPlayerEventTimeStart;
|
||||
|
||||
public:
|
||||
wstring GatherStats();
|
||||
wstring GatherRTTStats();
|
||||
|
||||
private:
|
||||
vector<FriendSessionInfo *> friendsSessions[XUSER_MAX_COUNT];
|
||||
int m_searchResultsCount[XUSER_MAX_COUNT];
|
||||
int m_lastSearchStartTime[XUSER_MAX_COUNT];
|
||||
|
||||
// The results that will be filled in with the current search
|
||||
XSESSION_SEARCHRESULT_HEADER *m_pSearchResults[XUSER_MAX_COUNT];
|
||||
XNQOS *m_pQoSResult[XUSER_MAX_COUNT];
|
||||
|
||||
// The results from the previous search, which are currently displayed in the game
|
||||
XSESSION_SEARCHRESULT_HEADER *m_pCurrentSearchResults[XUSER_MAX_COUNT];
|
||||
XNQOS *m_pCurrentQoSResult[XUSER_MAX_COUNT];
|
||||
int m_currentSearchResultsCount[XUSER_MAX_COUNT];
|
||||
|
||||
int m_lastSearchPad;
|
||||
bool m_bSearchResultsReady;
|
||||
bool m_bSearchPending;
|
||||
LPVOID m_pSearchParam;
|
||||
void (*m_SessionsUpdatedCallback)(LPVOID pParam);
|
||||
|
||||
C4JThread* m_SearchingThread;
|
||||
|
||||
void TickSearch();
|
||||
void SearchForGames();
|
||||
static int SearchForGamesThreadProc( void* lpParameter );
|
||||
|
||||
void SetSearchResultsReady(int resultCount = 0);
|
||||
|
||||
vector<INetworkPlayer *>currentNetworkPlayers;
|
||||
INetworkPlayer *addNetworkPlayer(IQNetPlayer *pQNetPlayer);
|
||||
void removeNetworkPlayer(IQNetPlayer *pQNetPlayer);
|
||||
static INetworkPlayer *getNetworkPlayer(IQNetPlayer *pQNetPlayer);
|
||||
|
||||
virtual void SetSessionTexturePackParentId( int id );
|
||||
virtual void SetSessionSubTexturePackId( int id );
|
||||
virtual void Notify(int ID, ULONG_PTR Param);
|
||||
|
||||
public:
|
||||
virtual vector<FriendSessionInfo *> *GetSessionList(int iPad, int localPlayers, bool partyOnly);
|
||||
virtual bool GetGameSessionInfo(int iPad, SessionID sessionId,FriendSessionInfo *foundSession);
|
||||
virtual void SetSessionsUpdatedCallback( void (*SessionsUpdatedCallback)(LPVOID pParam), LPVOID pSearchParam );
|
||||
virtual void GetFullFriendSessionInfo( FriendSessionInfo *foundSession, void (* FriendSessionUpdatedFn)(bool success, void *pParam), void *pParam );
|
||||
virtual void ForceFriendsSessionRefresh();
|
||||
|
||||
public:
|
||||
void NotifyPlayerJoined( IQNetPlayer *pQNetPlayer );
|
||||
void NotifyPlayerLeaving( IQNetPlayer *pQNetPlayer );
|
||||
|
||||
#ifndef _XBOX
|
||||
void FakeLocalPlayerJoined() { NotifyPlayerJoined(m_pIQNet->GetLocalPlayerByUserIndex(0)); }
|
||||
#endif
|
||||
};
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#ifdef __PS3__
|
||||
#include "PS3\Sentient\SentientManager.h"
|
||||
#include "Common\Network\WinsockNetLayer.h"
|
||||
#include "Common\Network\NetworkSocketLayer.h"
|
||||
#include "StatsCounter.h"
|
||||
#include "PS3\Social\SocialManager.h"
|
||||
#include <libsn.h>
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "Durango\DurangoExtras\xcompress.h"
|
||||
#elif defined _WINDOWS64
|
||||
#include "Windows64\Sentient\SentientManager.h"
|
||||
#include "Common\Network\WinsockNetLayer.h"
|
||||
#include "Common\Network\NetworkSocketLayer.h"
|
||||
#include "StatsCounter.h"
|
||||
#include "Windows64\Social\SocialManager.h"
|
||||
#include "Windows64\Sentient\DynamicConfigurations.h"
|
||||
@@ -43,7 +43,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(DISABLE_PSN) || defined(_DISABLE_XBLIVE)
|
||||
#include "Common\Network\WinsockNetLayer.h"
|
||||
#include "Common\Network\NetworkSocketLayer.h"
|
||||
#endif
|
||||
|
||||
#ifndef _DISABLE_XBLIVE
|
||||
@@ -425,9 +425,9 @@ void C_4JProfile::Initialise( DWORD dwTitleID,
|
||||
BYTE IQNetPlayer::GetSmallId() { return m_smallId; }
|
||||
void IQNetPlayer::SendData(IQNetPlayer *player, const void *pvData, DWORD dwDataSize, DWORD dwFlags)
|
||||
{
|
||||
if (WinsockNetLayer::IsActive())
|
||||
if (NetworkSocketLayer::IsActive())
|
||||
{
|
||||
WinsockNetLayer::SendToSmallId(player->m_smallId, pvData, dwDataSize);
|
||||
NetworkSocketLayer::SendToSmallId(player->m_smallId, pvData, dwDataSize);
|
||||
}
|
||||
}
|
||||
bool IQNetPlayer::IsSameSystem(IQNetPlayer *player) { return (this == player) || (!m_isRemote && !player->m_isRemote); }
|
||||
@@ -593,7 +593,7 @@ void C_4JProfile::GetXUID(int iPad, PlayerUID *pXuid,bool bOnlineXuid)
|
||||
if (IQNet::s_isHosting)
|
||||
*pXuid = 0xe000d45248242f2e;
|
||||
else
|
||||
*pXuid = 0xe000d45248242f2e + WinsockNetLayer::GetLocalSmallId();
|
||||
*pXuid = 0xe000d45248242f2e + NetworkSocketLayer::GetLocalSmallId();
|
||||
}
|
||||
BOOL C_4JProfile::AreXUIDSEqual(PlayerUID xuid1,PlayerUID xuid2) { return xuid1 == xuid2; }
|
||||
BOOL C_4JProfile::XUIDIsGuest(PlayerUID xuid) { return false; }
|
||||
|
||||
@@ -3840,7 +3840,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
||||
<ClInclude Include="Common\Network\IQNet.h" />
|
||||
<ClInclude Include="Common\Network\NetworkPlayerInterface.h" />
|
||||
<ClInclude Include="Common\Network\PlatformNetworkManagerInterface.h" />
|
||||
<ClInclude Include="Common\Network\PlatformNetworkManagerStub.h">
|
||||
<ClInclude Include="Common\Network\PlatformNetworkManager.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_NO_TU|Xbox 360'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage|Xbox 360'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='CONTENTPACKAGE_SYMBOLS|Xbox 360'">true</ExcludedFromBuild>
|
||||
@@ -4041,7 +4041,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ORBIS'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ORBIS'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Common\Network\WinsockNetLayer.h" />
|
||||
<ClInclude Include="Common\Network\NetworkSocketLayer.h" />
|
||||
<ClInclude Include="Common\Potion_Macros.h" />
|
||||
<ClInclude Include="Common\Telemetry\TelemetryManager.h" />
|
||||
<ClInclude Include="Common\Trial\TrialMode.h" />
|
||||
@@ -20929,7 +20929,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|PS3'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Common\Network\GameNetworkManager.cpp" />
|
||||
<ClCompile Include="Common\Network\PlatformNetworkManagerStub.cpp">
|
||||
<ClCompile Include="Common\Network\PlatformNetworkManager.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage_NO_TU|Xbox 360'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ContentPackage|Xbox 360'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='CONTENTPACKAGE_SYMBOLS|Xbox 360'">true</ExcludedFromBuild>
|
||||
@@ -21131,7 +21131,7 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ORBIS'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ORBIS'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Common\Network\WinsockNetLayer.cpp" />
|
||||
<ClCompile Include="Common\Network\NetworkSocketLayer.cpp" />
|
||||
<ClCompile Include="Common\Telemetry\TelemetryManager.cpp" />
|
||||
<ClCompile Include="Common\Trial\TrialMode.cpp" />
|
||||
<ClCompile Include="Common\Tutorial\AreaConstraint.cpp" />
|
||||
|
||||
@@ -3110,9 +3110,6 @@
|
||||
<ClInclude Include="Xbox\Network\PlatformNetworkManagerXbox.h">
|
||||
<Filter>Xbox\Source Files\Network</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Common\Network\PlatformNetworkManagerStub.h">
|
||||
<Filter>Common\Source Files\Network</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Xbox\Network\NetworkPlayerXbox.h">
|
||||
<Filter>Xbox\Source Files\Network</Filter>
|
||||
</ClInclude>
|
||||
@@ -3779,10 +3776,13 @@
|
||||
<ClInclude Include="PSVita\OldSdk.h">
|
||||
<Filter>PSVita</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Common\Network\WinsockNetLayer.h">
|
||||
<ClInclude Include="Common\Network\IQNet.h">
|
||||
<Filter>Common\Source Files\Network</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Common\Network\IQNet.h">
|
||||
<ClInclude Include="Common\Network\NetworkSocketLayer.h">
|
||||
<Filter>Common\Source Files\Network</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Common\Network\PlatformNetworkManager.h">
|
||||
<Filter>Common\Source Files\Network</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
@@ -5335,9 +5335,6 @@
|
||||
<ClCompile Include="Xbox\Network\PlatformNetworkManagerXbox.cpp">
|
||||
<Filter>Xbox\Source Files\Network</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Common\Network\PlatformNetworkManagerStub.cpp">
|
||||
<Filter>Common\Source Files\Network</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Xbox\Network\NetworkPlayerXbox.cpp">
|
||||
<Filter>Xbox\Source Files\Network</Filter>
|
||||
</ClCompile>
|
||||
@@ -5929,7 +5926,10 @@
|
||||
<ClCompile Include="PSVita\OldSdk.cpp">
|
||||
<Filter>PSVita</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Common\Network\WinsockNetLayer.cpp">
|
||||
<ClCompile Include="Common\Network\NetworkSocketLayer.cpp">
|
||||
<Filter>Common\Source Files\Network</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Common\Network\PlatformNetworkManager.cpp">
|
||||
<Filter>Common\Source Files\Network</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "Network/Orbis_NPToolkit.h"
|
||||
#include "Orbis\Network\SonyVoiceChat_Orbis.h"
|
||||
#else
|
||||
#include "..\..\Minecraft.Client\Common\Network\WinsockNetLayer.h"
|
||||
#include "..\..\Minecraft.Client\Common\Network\NetworkSocketLayer.h"
|
||||
#endif
|
||||
|
||||
#define THEME_NAME "584111F70AAAAAAA"
|
||||
|
||||
@@ -24,7 +24,7 @@ SYS_PROCESS_PARAM(1001, 0x10000); // thread priority, and stack size
|
||||
#include <sysutil/sysutil_msgdialog.h>
|
||||
|
||||
#include "PS3/Network/SonyRemoteStorage_PS3.h"
|
||||
#include "..\..\Minecraft.Client\Common\Network\WinsockNetLayer.h"
|
||||
#include "..\..\Minecraft.Client\Common\Network\NetworkSocketLayer.h"
|
||||
|
||||
// define to use spurs (otherwise SPU threads or raw will be used)
|
||||
#define USE_SPURS
|
||||
@@ -1129,7 +1129,7 @@ int main()
|
||||
if(ShutdownManager::ShouldRun(ShutdownManager::eMainThread))
|
||||
{
|
||||
g_NetworkManager.Initialise();
|
||||
WinsockNetLayer::Initialize();
|
||||
NetworkSocketLayer::Initialize();
|
||||
g_NetworkManager.SetLocalGame(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "Resource.h"
|
||||
#include "..\..\Minecraft.World\compression.h"
|
||||
#include "..\..\Minecraft.World\OldChunkStorage.h"
|
||||
#include "..\..\Minecraft.Client\Common\Network\WinsockNetLayer.h"
|
||||
#include "..\..\Minecraft.Client\Common\Network\NetworkSocketLayer.h"
|
||||
|
||||
#include "Xbox/resource.h"
|
||||
|
||||
@@ -661,8 +661,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
int n = 0;
|
||||
while (ipArg[n] && ipArg[n] != ' ' && n < 255) { ipBuf[n] = ipArg[n]; n++; }
|
||||
ipBuf[n] = 0;
|
||||
strncpy_s(g_Win64MultiplayerIP, 256, ipBuf, _TRUNCATE);
|
||||
g_Win64MultiplayerJoin = true;
|
||||
strncpy_s(g_MultiplayerIP, 256, ipBuf, _TRUNCATE);
|
||||
g_MultiplayerJoin = true;
|
||||
}
|
||||
|
||||
char *portArg = strstr(cmdLineA, "-port ");
|
||||
@@ -674,8 +674,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
int n = 0;
|
||||
while (portArg[n] && portArg[n] != ' ' && n < 15) { portBuf[n] = portArg[n]; n++; }
|
||||
portBuf[n] = 0;
|
||||
g_Win64MultiplayerPort = atoi(portBuf);
|
||||
if (g_Win64MultiplayerPort <= 0) g_Win64MultiplayerPort = WIN64_NET_DEFAULT_PORT;
|
||||
g_MultiplayerPort = atoi(portBuf);
|
||||
if (g_MultiplayerPort <= 0) g_MultiplayerPort = NETWORK_LAN_DEFAULT_PORT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -860,7 +860,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
extern wchar_t g_Win64UsernameW[17];
|
||||
wcscpy_s(IQNet::m_player[0].m_gamertag, 32, g_Win64UsernameW);
|
||||
|
||||
WinsockNetLayer::Initialize();
|
||||
NetworkSocketLayer::Initialize();
|
||||
|
||||
// 4J-PB moved further down
|
||||
//app.InitGameSettings();
|
||||
|
||||
Reference in New Issue
Block a user