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
+84 -8
View File
@@ -50,11 +50,16 @@
#else
#include "Common\UI\UI.h"
#endif
#ifdef __PS3__
#if defined __PS3__ && !defined DISABLE_PSN
#include "PS3/Network/SonyVoiceChat.h"
#endif
#include "DLCTexturePack.h"
#if defined _WINDOWS64 || defined DISABLE_PSN || defined _DISABLE_XBLIVE
#include "Xbox\Network\NetworkPlayerXbox.h"
#include "Common\Network\PlatformNetworkManager.h"
#endif
#ifdef _DURANGO
#include "..\Minecraft.World\DurangoStats.h"
#include "..\Minecraft.World\GenericStats.h"
@@ -781,6 +786,32 @@ void ClientConnection::handleAddPlayer(shared_ptr<AddPlayerPacket> packet)
player->m_displayName = player->name;
#endif
#if defined _WINDOWS64 || defined DISABLE_PSN || defined _DISABLE_XBLIVE
{
PlayerUID pktXuid = player->getXuid();
const PlayerUID WIN64_XUID_BASE = (PlayerUID)0xe000d45248242f2e;
if (pktXuid >= WIN64_XUID_BASE && pktXuid < WIN64_XUID_BASE + MINECRAFT_NET_MAX_PLAYERS)
{
BYTE smallId = (BYTE)(pktXuid - WIN64_XUID_BASE);
INetworkPlayer *np = g_NetworkManager.GetPlayerBySmallId(smallId);
if (np != NULL)
{
NetworkPlayerXbox *npx = (NetworkPlayerXbox *)np;
IQNetPlayer *qp = npx->GetQNetPlayer();
if (qp != NULL)
{
wcsncpy(qp->m_gamertag, packet->name.c_str(), 31);
qp->m_gamertag[31] = L'\0';
if (g_NetworkManager.IsHost())
{
g_NetworkManager.UpdateAndSetGameSessionData();
}
}
}
}
}
#endif
// printf("\t\t\t\t%d: Add player\n",packet->id,packet->yRot);
int item = packet->carriedItem;
@@ -923,6 +954,39 @@ void ClientConnection::handleMoveEntitySmall(shared_ptr<MoveEntityPacketSmall> p
void ClientConnection::handleRemoveEntity(shared_ptr<RemoveEntitiesPacket> packet)
{
#if defined _WINDOWS64 || defined DISABLE_PSN || defined _DISABLE_XBLIVE
if (!g_NetworkManager.IsHost())
{
for (int i = 0; i < packet->ids.length; i++)
{
shared_ptr<Entity> entity = getEntity(packet->ids[i]);
if (entity != NULL && entity->GetType() == eTYPE_PLAYER)
{
shared_ptr<Player> player = dynamic_pointer_cast<Player>(entity);
if (player != NULL)
{
PlayerUID xuid = player->getXuid();
INetworkPlayer *np = g_NetworkManager.GetPlayerByXuid(xuid);
if (np != NULL)
{
NetworkPlayerXbox *npx = (NetworkPlayerXbox *)np;
IQNetPlayer *qp = npx->GetQNetPlayer();
if (qp != NULL)
{
extern CPlatformNetworkManagerStub *g_pPlatformNetworkManager;
g_pPlatformNetworkManager->NotifyPlayerLeaving(qp);
qp->m_smallId = 0;
qp->m_isRemote = false;
qp->m_isHostPlayer = false;
qp->m_gamertag[0] = 0;
qp->SetCustomDataValue(0);
}
}
}
}
}
}
#endif
for (int i = 0; i < packet->ids.length; i++)
{
level->removeEntity(packet->ids[i]);
@@ -1769,6 +1833,7 @@ void ClientConnection::handleEntityActionAtPosition(shared_ptr<EntityActionAtPos
void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
{
app.DebugPrintf("ClientConnection::handlePreLogin ENTER (user %d)\n", m_userIndex);
// printf("Client: handlePreLogin\n");
#if 1
// 4J - Check that we can play with all the players already in the game who have Friends-Only UGC set
@@ -1975,6 +2040,7 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
#elif defined __PSVITA__
sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::FriendsList> friendList;
int ret = -1;
/*
if(!CGameNetworkManager::usingAdhocMode()) // we don't need to be friends in PSN for adhoc mode
{
int ret = sce::Toolkit::NP::Friends::Interface::getFriendslist(&friendList, false);
@@ -1985,10 +2051,11 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
friendCount = friendList.get()->size();
}
}
}
}*/
#else // __ORBIS__
sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::FriendsList> friendList;
/*
//sce::Toolkit::NP::Utilities::Future<sce::Toolkit::NP::FriendsList> friendList;
std::vector<sce::Toolkit::NP::FriendsList> friendList;
sce::Toolkit::NP::FriendInfoRequest requestParam;
memset(&requestParam,0,sizeof(requestParam));
@@ -1997,14 +2064,16 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
requestParam.offset = 0;
requestParam.userInfo.userId = ProfileManager.getUserID(ProfileManager.GetPrimaryPad());
int ret = sce::Toolkit::NP::Friends::Interface::getFriendslist(&friendList, &requestParam, false);
//int ret = sce::Toolkit::NP::Friends::Interface::getFriendslist(&friendList, &requestParam, false);
int ret = 42069;
if( ret == 0 )
{
if( friendList.hasResult() )
if( friendList.hasResult())
{
friendCount = friendList.get()->size();
}
}
}*/
int ret = 42069;
#endif
if( ret == 0 )
{
@@ -2014,12 +2083,18 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
{
#ifdef __PS3__
ret = sceNpBasicGetFriendListEntry( i, &npid );
#elif defined __ORBIS__
//dont touch npid
#else
npid = friendList.get()->at(i).npid;
#endif
if( ret == 0 )
{
#ifndef __ORBIS__
if(strcmp(npid.handle.data, packet->m_playerXuids[packet->m_hostIndex].getOnlineID()) == 0)
#else
if(1==2)
#endif
{
isFriend = true;
break;
@@ -2224,7 +2299,8 @@ void ClientConnection::handlePreLogin(shared_ptr<PreLoginPacket> packet)
}
BOOL allAllowed, friendsAllowed;
ProfileManager.AllowedPlayerCreatedContent(m_userIndex,true,&allAllowed,&friendsAllowed);
send( shared_ptr<LoginPacket>( new LoginPacket(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (allAllowed!=TRUE && friendsAllowed==TRUE),
app.DebugPrintf("ClientConnection::handlePreLogin SENDING LoginPacket (user %d)\n", m_userIndex);
send( shared_ptr<LoginPacket>( new LoginPacket(minecraft->user->name, SharedConstants::NETWORK_PROTOCOL_VERSION, offlineXUID, onlineXUID, (allAllowed!=TRUE && friendsAllowed==TRUE),
packet->m_ugcPlayersVersion, app.GetPlayerSkinId(m_userIndex), app.GetPlayerCapeId(m_userIndex), ProfileManager.IsGuest( m_userIndex ))));
if(!g_NetworkManager.IsHost() )