add lcemp networking + ps3 support

YES I KNOW ITS GARBAGE, THATS WHY ITS NOT ON MAIN

ILL FIX IT UP IN FUTURE COMMITS THEN MERGE TO MAIN
This commit is contained in:
2026-07-31 22:08:30 +03:00
parent 51ee0d8e57
commit dbd90a75c9
50 changed files with 1958 additions and 96 deletions
@@ -68,7 +68,7 @@ void CGameNetworkManager::Initialise()
int flagIndexSize = LevelRenderer::getGlobalChunkCount() / (Level::maxBuildHeight / 16); // dividing here by number of renderer chunks in one column
#ifdef _XBOX
s_pPlatformNetworkManager = new CPlatformNetworkManagerXbox();
#elif defined __PS3__ || defined __ORBIS__ || defined __PSVITA__
#elif !defined(DISABLE_PSN) && defined __PS3__ || defined __ORBIS__ || defined __PSVITA__
s_pPlatformNetworkManager = new CPlatformNetworkManagerSony();
#elif defined _DURANGO
s_pPlatformNetworkManager = new CPlatformNetworkManagerDurango();
@@ -167,6 +167,11 @@ bool CGameNetworkManager::_RunNetworkGame(LPVOID lpParameter)
return true;
}
}
else
{
// Client needs QNET_STATE_GAME_PLAY so that IsInGameplay() returns true
s_pPlatformNetworkManager->SetGamePlayState();
}
if( g_NetworkManager.IsLeavingGame() ) return false;
@@ -336,10 +341,12 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
// 4J Stu - Wait a while to make sure that DLC is loaded. This is the last point before the network communication starts
// so the latest we can check this
#ifndef DISABLE_PSN
while( !app.DLCInstallProcessCompleted() && app.DLCInstallPending() && !g_NetworkManager.IsLeavingGame() )
{
Sleep( 10 );
}
#endif
if( g_NetworkManager.IsLeavingGame() )
{
MinecraftServer::HaltServer();
@@ -496,7 +503,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
// The connections should tick at 20 per second
Sleep(50);
app.DebugPrintf("<***> %d %d %d %d %d\n",IsInSession(), !connection->isStarted(),!connection->isClosed(),ProfileManager.IsSignedIn(idx),!g_NetworkManager.IsLeavingGame());
#if defined _XBOX || __PS3__
#if defined _XBOX || defined __PS3__ && !defined DISABLE_PSN
} while (IsInSession() && !connection->isStarted() && !connection->isClosed() && ProfileManager.IsSignedIn(idx) && !g_NetworkManager.IsLeavingGame() );
#else
// TODO - This SHOULD be something just like the code above but temporarily changing here so that we don't have to depend on the profilemanager behaviour
@@ -794,7 +801,7 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
// Check if user-created content is allowed, as we cannot play multiplayer if it's not
bool noUGC = false;
#if defined(__PS3__) || defined(__PSVITA__)
#if !defined(DISABLE_PSN) && defined(__PS3__) || defined(__PSVITA__)
ProfileManager.GetChatAndContentRestrictions(iPad,false,&noUGC,NULL,NULL);
#elif defined(__ORBIS__)
ProfileManager.GetChatAndContentRestrictions(iPad,false,NULL,&noUGC,NULL);
@@ -1007,6 +1014,9 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam )
// The pair of methods MustSignInReturned_0 & PSNSignInReturned_0 handle this
int CGameNetworkManager::MustSignInReturned_0(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
#ifdef DISABLE_PSN
return 0;
#else
if(result==C4JStorage::EMessage_ResultAccept)
{
#ifdef __PS3__
@@ -1025,10 +1035,14 @@ int CGameNetworkManager::MustSignInReturned_0(void *pParam,int iPad,C4JStorage::
}
return 0;
#endif
}
int CGameNetworkManager::PSNSignInReturned_0(void* pParam, bool bContinue, int iPad)
{
#ifdef DISABLE_PSN
return 0;
#else
JoinFromInviteData *inviteData = (JoinFromInviteData *)pParam;
// If the invite data isn't set up yet (indicated by it being all zeroes, easiest detected via the net version), then try and get it again... this can happen if we got
@@ -1061,12 +1075,16 @@ int CGameNetworkManager::PSNSignInReturned_0(void* pParam, bool bContinue, int i
}
return 0;
#endif
}
// This case happens when we were in the main menus when we got an invite, and weren't signed in... now can proceed with the normal flow of code for this situation
// The pair of methods MustSignInReturned_1 & PSNSignInReturned_1 handle this
int CGameNetworkManager::MustSignInReturned_1(void *pParam,int iPad,C4JStorage::EMessageResult result)
{
#ifdef DISABLE_PSN
return 0;
#else
if(result==C4JStorage::EMessage_ResultAccept)
{
#ifdef __PS3__
@@ -1078,10 +1096,14 @@ int CGameNetworkManager::MustSignInReturned_1(void *pParam,int iPad,C4JStorage::
#endif
}
return 0;
#endif
}
int CGameNetworkManager::PSNSignInReturned_1(void* pParam, bool bContinue, int iPad)
{
#ifdef DISABLE_PSN
return 0;
#else
INVITE_INFO *inviteInfo = (INVITE_INFO *)pParam;
// If the invite data isn't set up yet (indicated by it being all zeroes, easiest detected via the net version), then try and get it again... this can happen if we got
@@ -1109,6 +1131,7 @@ int CGameNetworkManager::PSNSignInReturned_1(void* pParam, bool bContinue, int i
}
return 0;
#endif
}
#endif
@@ -1446,7 +1469,7 @@ void CGameNetworkManager::StateChange_AnyToEnding(bool bStateWasPlaying)
if(pNetworkPlayer != NULL && ProfileManager.IsSignedIn( i ) )
{
app.DebugPrintf("Stats save for an offline game for the player at index %d\n", i );
Minecraft::GetInstance()->forceStatsSave(pNetworkPlayer->GetUserIndex());
//Minecraft::GetInstance()->forceStatsSave(pNetworkPlayer->GetUserIndex());
}
}
}
@@ -1789,7 +1812,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
#endif
if( !g_NetworkManager.IsInSession() )
{
#if defined (__PS3__) || defined (__PSVITA__)
#if !defined(DISABLE_PSN) && defined (__PS3__) || defined (__PSVITA__)
// PS3 is more complicated here - we need to make sure that the player is online. If they are then we can do the same as the xbox, if not we need to try and get them online and then, if they do sign in, go down the same path
// Determine why they're not "signed in live"
@@ -1939,7 +1962,7 @@ void CGameNetworkManager::HandleDisconnect(bool bLostRoomOnly)
if((g_NetworkManager.GetLockedProfile()!=-1) && iPrimaryPlayer!=-1 && g_NetworkManager.IsInSession() )
{
m_bLastDisconnectWasLostRoomOnly = bLostRoomOnly;
#if defined __PS3__ || defined __PSVITA__ || defined __ORBIS__
#if !defined(DISABLE_PSN) && defined __PS3__ || defined __PSVITA__ || defined __ORBIS__
m_bSignedOutofPSN=bPSNSignout;
#endif
app.SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected);