Merge branch 'networking' from pieeebot/cafeberry

Merge the upstream pieeebot/cafeberry networking branch into the local
networking branch, incorporating the rebased mainline work (PS3/PSVita
networking, large-worlds defines, media rebuilds, workflow CI, renamed
WinsockNetLayer->NetworkSocketLayer / PlatformNetworkManagerStub->
PlatformNetworkManager refactors).

Conflict resolutions:
- NetworkSocketLayer.cpp / PlatformNetworkManager.{h,cpp}: took the
  remote's evolved implementations (connect retries, non-blocking
  connect, smallId assignment, GAME_PLAY state handling in DoWork).
- PS3-postbuild.ps1: kept the remote's approach of disabling the
  broken PSVita tutorial pack copy (softlocks game).
- Minecraft.Client.vcxproj: took the remote's restructured project.

The X360 offline-LAN pre-login grant (ClientConnection.cpp) is retained.
This commit is contained in:
2026-08-07 07:34:08 -07:00
359 changed files with 6342 additions and 13190 deletions
+42 -20
View File
@@ -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"
@@ -30,7 +30,6 @@
#include <libperf.h>
#elif defined _XBOX
#include "Xbox\Sentient\SentientManager.h"
#include "Common\Network\WinsockNetLayer.h"
#include "StatsCounter.h"
#include "Xbox\Social\SocialManager.h"
#include "Xbox\Sentient\DynamicConfigurations.h"x
@@ -43,6 +42,10 @@
#include <perf.h>
#endif
#if defined(DISABLE_PSN) || defined(_DISABLE_XBLIVE)
#include "Common\Network\NetworkSocketLayer.h"
#endif
#ifndef _DISABLE_XBLIVE
#if !defined(__PS3__) && !defined(__ORBIS__) && !defined(__PSVITA__)
#ifdef _WINDOWS64
@@ -179,9 +182,9 @@ void PIXSetMarkerDeprecated(int a, char *b, ...) {}
bool IsEqualXUID(PlayerUID a, PlayerUID b)
{
#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) || defined(_DURANGO)
#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) || defined(_DURANGO) || defined(_WINDOWS64) || defined(_XBOX))
return (a == b);
#elif defined(DISABLE_PSN) && defined(__PS3__)
#elif defined(DISABLE_PSN)
return (a.XUID == b.XUID);
#else
return false;
@@ -423,9 +426,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); }
@@ -465,13 +468,17 @@ void Win64_SetupRemoteQNetPlayer(IQNetPlayer *player, BYTE smallId, bool isHost,
IQNet::s_playerCount = smallId + 1;
}
static bool Win64_IsActivePlayer(IQNetPlayer *p, DWORD index);
HRESULT IQNet::AddLocalPlayerByUserIndex(DWORD dwUserIndex){ return S_OK; }
IQNetPlayer *IQNet::GetHostPlayer() { return &m_player[0]; }
IQNetPlayer *IQNet::GetLocalPlayerByUserIndex(DWORD dwUserIndex)
{
if (s_isHosting)
{
if (dwUserIndex < MINECRAFT_NET_MAX_PLAYERS && !m_player[dwUserIndex].m_isRemote)
if (dwUserIndex < MINECRAFT_NET_MAX_PLAYERS &&
!m_player[dwUserIndex].m_isRemote &&
Win64_IsActivePlayer(&m_player[dwUserIndex], dwUserIndex))
return &m_player[dwUserIndex];
return NULL;
}
@@ -479,7 +486,7 @@ IQNetPlayer *IQNet::GetLocalPlayerByUserIndex(DWORD dwUserIndex)
return NULL;
for (DWORD i = 0; i < s_playerCount; i++)
{
if (!m_player[i].m_isRemote)
if (!m_player[i].m_isRemote && Win64_IsActivePlayer(&m_player[i], i))
return &m_player[i];
}
return NULL;
@@ -505,19 +512,21 @@ IQNetPlayer *IQNet::GetPlayerByIndex(DWORD dwPlayerIndex)
}
IQNetPlayer *IQNet::GetPlayerBySmallId(BYTE SmallId)
{
for (DWORD i = 0; i < s_playerCount; i++)
{
if (m_player[i].m_smallId == SmallId && Win64_IsActivePlayer(&m_player[i], i)) return &m_player[i];
}
return NULL;
if (SmallId >= MINECRAFT_NET_MAX_PLAYERS)
return NULL;
m_player[SmallId].m_smallId = SmallId;
if (SmallId >= s_playerCount)
s_playerCount = SmallId + 1;
return &m_player[SmallId];
}
IQNetPlayer *IQNet::GetPlayerByXuid(PlayerUID xuid)
{
for (DWORD i = 0; i < s_playerCount; i++)
for (DWORD i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++)
{
if (Win64_IsActivePlayer(&m_player[i], i) && m_player[i].GetXuid() == xuid) return &m_player[i];
}
return &m_player[0];
return NULL;
}
DWORD IQNet::GetPlayerCount()
{
@@ -532,15 +541,28 @@ QNET_STATE IQNet::GetState() { return _iQNetStubState; }
bool IQNet::IsHost() { return s_isHosting; }
HRESULT IQNet::JoinGameFromInviteInfo(DWORD dwUserIndex, DWORD dwUserMask, const INVITE_INFO *pInviteInfo) { return S_OK; }
void IQNet::HostGame() { _iQNetStubState = QNET_STATE_SESSION_STARTING; s_isHosting = true; }
void IQNet::ClientJoinGame() { _iQNetStubState = QNET_STATE_SESSION_STARTING; s_isHosting = false; }
void IQNet::ClientJoinGame()
{
_iQNetStubState = QNET_STATE_SESSION_STARTING;
s_isHosting = false;
for (int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++)
{
m_player[i].m_smallId = (BYTE)i;
m_player[i].m_isRemote = true;
m_player[i].m_isHostPlayer = false;
m_player[i].m_gamertag[0] = 0;
m_player[i].SetCustomDataValue(0);
}
}
void IQNet::EndGame()
{
_iQNetStubState = QNET_STATE_IDLE;
s_isHosting = false;
s_playerCount = 1;
for (int i = 1; i < MINECRAFT_NET_MAX_PLAYERS; i++)
for (int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++)
{
m_player[i].m_smallId = 0;
m_player[i].m_smallId = (BYTE)i;
m_player[i].m_isRemote = false;
m_player[i].m_isHostPlayer = false;
m_player[i].m_gamertag[0] = 0;
@@ -572,7 +594,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; }