rename network scripts

This commit is contained in:
pieeebot committed 2026-08-03 04:18:33 +03:00
1 parent 42f09f93e5
commit ce3e83039d
12 files changed
+1243 -1243

No files matched your search

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