feat: add PS4 networking support

This commit is contained in:
NaN
2026-08-03 16:57:07 -04:00
parent ce3e83039d
commit 930a104e50
7 changed files with 174 additions and 46 deletions
+43 -15
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\WinsockNetLayer.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;
@@ -368,6 +368,12 @@ void UIScene_JoinMenu::checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege,
void UIScene_JoinMenu::StartSharedLaunchFlow()
{
const bool bManualJoin = (g_Win64MultiplayerJoin == true);
if (bManualJoin)
{
JoinGame(this);
return;
}
#if defined DISABLE_PSN
JoinGame(this);
#else
@@ -421,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_Win64MultiplayerJoin == true);
DWORD dwSignedInUsers = 0;
bool noPrivileges = false;
DWORD dwLocalUsersMask = 0;
@@ -428,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))
@@ -442,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);
}
@@ -452,7 +468,7 @@ 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
@@ -467,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
@@ -497,14 +513,22 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass)
BOOL pccFriendsAllowed = TRUE;
#if !defined(DISABLE_PSN) && (defined(__PS3__) || defined(__PSVITA__))
if(isSignedInLive)
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__
@@ -534,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 );
@@ -550,6 +577,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass)
if( result != CGameNetworkManager::JOINGAME_SUCCESS )
{
pClass->m_bIgnoreInput = false;
int exitReasonStringId = -1;
switch(result)
{
@@ -643,4 +671,4 @@ void UIScene_JoinMenu::handleTimerComplete(int id)
}
break;
};
}
}