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
+87 -20
View File
@@ -7,6 +7,7 @@
#include "..\..\MinecraftServer.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.level.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.h"
#include "..\..\Common\Network\NetworkSocketLayer.h"
#define UPDATE_PLAYERS_TIMER_ID 0
#define UPDATE_PLAYERS_TIMER_TIME 30000
@@ -50,7 +51,6 @@ void UIScene_JoinMenu::tick()
g_NetworkManager.GetFullFriendSessionInfo(m_selectedSession, &friendSessionUpdated, this);
m_friendInfoRequestIssued = true;
}
if( m_friendInfoUpdatedOK )
{
m_friendInfoUpdatedOK = false;
@@ -59,7 +59,7 @@ void UIScene_JoinMenu::tick()
m_buttonListPlayers.init(eControl_GamePlayers);
#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__
#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__)
for( int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++ )
{
if( m_selectedSession->data.players[i] != NULL )
@@ -105,6 +105,21 @@ void UIScene_JoinMenu::tick()
break;
}
}
#elif defined(_WINDOWS64) || defined(DISABLE_PSN)
for( int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++ )
{
if( m_selectedSession->data.players[i] != 0 && m_selectedSession->data.szPlayers[i][0] != 0 )
{
string playerName(m_selectedSession->data.szPlayers[i], XUSER_NAME_SIZE);
size_t end = playerName.find('\0');
if (end != string::npos) playerName.resize(end);
m_buttonListPlayers.addItem(playerName);
}
else
{
break;
}
}
#endif
m_labelLabels[eLabel_Difficulty].init(app.GetString(IDS_LABEL_DIFFICULTY));
@@ -353,7 +368,13 @@ void UIScene_JoinMenu::checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege,
void UIScene_JoinMenu::StartSharedLaunchFlow()
{
#if defined DISABLE_PSN && defined __PS3__
const bool bManualJoin = (g_MultiplayerJoin == true);
if (bManualJoin)
{
JoinGame(this);
return;
}
#if defined DISABLE_PSN
JoinGame(this);
#else
if(!app.IsLocalMultiplayerAvailable())
@@ -376,7 +397,7 @@ int UIScene_JoinMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int
{
UIScene_JoinMenu* pClass = (UIScene_JoinMenu*)ui.GetSceneFromCallbackId((size_t)pParam);
#if defined DISABLE_PSN && defined __PS3__
#if defined DISABLE_PSN
JoinGame(pClass);
return 0;
#else
@@ -406,6 +427,12 @@ int UIScene_JoinMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int
// Shared function to join the game that is the same whether we used the sign-in UI or not
void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass)
{
if (pClass == NULL)
{
return;
}
const bool bManualJoin = (g_MultiplayerJoin == true);
DWORD dwSignedInUsers = 0;
bool noPrivileges = false;
DWORD dwLocalUsersMask = 0;
@@ -413,10 +440,14 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass)
int iPadNotSignedInLive = -1;
ProfileManager.SetLockedProfile(0); // TEMP!
if (bManualJoin)
{
isSignedInLive = true;
}
// If we're in SD mode, then only the primary player gets to play
if (app.IsLocalMultiplayerAvailable())
{
{
for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index)
{
if(ProfileManager.IsSignedIn(index))
@@ -427,7 +458,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass)
iPadNotSignedInLive = index;
}
if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
if( !bManualJoin && !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(index);
isSignedInLive = isSignedInLive && ProfileManager.IsSignedInLive(index);
}
@@ -437,13 +468,13 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass)
{
if(ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad()))
{
if( !ProfileManager.AllowedToPlayMultiplayer(ProfileManager.GetPrimaryPad()) ) noPrivileges = true;
if( !bManualJoin && !ProfileManager.AllowedToPlayMultiplayer(ProfileManager.GetPrimaryPad()) ) noPrivileges = true;
dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad());
#ifndef DISABLE_PSN
isSignedInLive = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad());
#endif
#ifdef __PSVITA__
#if !defined DISABLE_PSN && defined __PSVITA__
if(CGameNetworkManager::usingAdhocMode() && SQRNetworkManager_AdHoc_Vita::GetAdhocStatus())
isSignedInLive = true;
#endif
@@ -452,7 +483,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass)
}
// If this is an online game but not all players are signed in to Live, stop!
if (!isSignedInLive)
if (!bManualJoin && !isSignedInLive)
{
#ifdef __ORBIS__
// Check if PSN is unavailable because of age restriction
@@ -481,15 +512,23 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass)
BOOL pccAllowed = TRUE;
BOOL pccFriendsAllowed = TRUE;
#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__PSVITA__)
if(isSignedInLive)
#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__PSVITA__))
if(!bManualJoin && isSignedInLive)
{
ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&noUGC,NULL,NULL);
}
#else
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
if(!bManualJoin)
{
ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed);
if(!pccAllowed && !pccFriendsAllowed) noUGC = true;
}
#endif
if (bManualJoin)
{
noUGC = false;
noPrivileges = false;
}
#ifdef __PSVITA__
@@ -519,13 +558,16 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass)
ui.RequestErrorMessage( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad());
}
else
{
#if defined(__ORBIS__) || defined(__PSVITA__)
bool chatRestricted = false;
ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL);
if(chatRestricted)
{
ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() );
#if defined(__ORBIS__) || defined(__PSVITA__)
if(!bManualJoin)
{
bool chatRestricted = false;
ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL);
if(chatRestricted)
{
ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() );
}
}
#endif
CGameNetworkManager::eJoinGameResult result = g_NetworkManager.JoinGame( pClass->m_selectedSession, dwLocalUsersMask );
@@ -535,6 +577,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass)
if( result != CGameNetworkManager::JOINGAME_SUCCESS )
{
pClass->m_bIgnoreInput = false;
int exitReasonStringId = -1;
switch(result)
{
@@ -616,7 +659,31 @@ void UIScene_JoinMenu::handleTimerComplete(int id)
playersList.SetCurSel(selectedIndex);
}
#endif
#if defined(_WINDOWS64) || defined(DISABLE_PSN)
{
bool success = g_NetworkManager.GetGameSessionInfo(m_iPad, m_selectedSession->sessionId, m_selectedSession);
if (success)
{
m_buttonListPlayers.clearList();
for (unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i)
{
if (m_selectedSession->data.players[i] != 0 && m_selectedSession->data.szPlayers[i][0] != 0)
{
string playerName(m_selectedSession->data.szPlayers[i], XUSER_NAME_SIZE);
size_t end = playerName.find('\0');
if (end != string::npos) playerName.resize(end);
m_buttonListPlayers.addItem(playerName);
}
else
{
break;
}
}
}
}
#endif
addTimer(UPDATE_PLAYERS_TIMER_ID, UPDATE_PLAYERS_TIMER_TIME);
}
break;
};
}
}