Fix X360 Crossplay (#26)
^Reviewed-on: #26 Co-authored-by: qloak <realminecart@gmail.com>
This commit was merged in pull request #26.
This commit is contained in:
@@ -100,12 +100,14 @@ void CGameNetworkManager::DoWork()
|
||||
{
|
||||
case XN_LIVE_LINK_STATE_CHANGED:
|
||||
{
|
||||
#ifndef _DISABLE_XBLIVE
|
||||
int iPrimaryPlayer = g_NetworkManager.GetPrimaryPad();
|
||||
bool bConnected = (pNotification->uiParam!=0)?true:false;
|
||||
if((g_NetworkManager.GetLockedProfile()!=-1) && iPrimaryPlayer!=-1 && bConnected == false && g_NetworkManager.IsInSession() )
|
||||
{
|
||||
app.SetAction(iPrimaryPlayer,eAppAction_EthernetDisconnected);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case XN_LIVE_INVITE_ACCEPTED:
|
||||
@@ -782,7 +784,11 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
|
||||
|
||||
app.DebugPrintf("JoinFromInvite_SignInReturned, iPad %d\n",iPad);
|
||||
// It's possible that the player has not signed in - they can back out
|
||||
#ifndef _DISABLE_XBLIVE
|
||||
if(ProfileManager.IsSignedIn(iPad) && ProfileManager.IsSignedInLive(iPad) )
|
||||
#else
|
||||
if(ProfileManager.IsSignedIn(iPad))
|
||||
#endif
|
||||
{
|
||||
app.DebugPrintf("JoinFromInvite_SignInReturned, passed sign-in tests\n");
|
||||
int localUsersMask = 0;
|
||||
@@ -794,7 +800,9 @@ int CGameNetworkManager::JoinFromInvite_SignInReturned(void *pParam,bool bContin
|
||||
if(ProfileManager.IsSignedIn(index) )
|
||||
{
|
||||
++joiningUsers;
|
||||
#ifndef _DISABLE_XBLIVE
|
||||
if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
|
||||
#endif
|
||||
localUsersMask |= GetLocalPlayerMask( index );
|
||||
}
|
||||
}
|
||||
@@ -890,6 +898,12 @@ bool CGameNetworkManager::IsNetworkThreadRunning()
|
||||
|
||||
int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
|
||||
{
|
||||
if( g_NetworkManager.m_bNetworkThreadRunning )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
g_NetworkManager.m_bNetworkThreadRunning = true;
|
||||
|
||||
// Share AABB & Vec3 pools with default (main thread) - should be ok as long as we don't tick the main thread whilst this thread is running
|
||||
AABB::UseDefaultThreadStorage();
|
||||
Vec3::UseDefaultThreadStorage();
|
||||
@@ -897,7 +911,6 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
|
||||
Tile::CreateNewThreadStorage();
|
||||
IntCache::CreateNewThreadStorage();
|
||||
|
||||
g_NetworkManager.m_bNetworkThreadRunning = true;
|
||||
bool success = g_NetworkManager._RunNetworkGame(lpParameter);
|
||||
g_NetworkManager.m_bNetworkThreadRunning = false;
|
||||
if( !success)
|
||||
@@ -905,7 +918,7 @@ int CGameNetworkManager::RunNetworkGameThreadProc( void* lpParameter )
|
||||
TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected();
|
||||
while ( tPack->isLoadingData() || (Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin()) )
|
||||
{
|
||||
Sleep(1);
|
||||
Sleep(0);
|
||||
}
|
||||
ui.CleanUpSkinReload();
|
||||
if(app.GetDisconnectReason() == DisconnectPacket::eDisconnect_None)
|
||||
@@ -942,7 +955,7 @@ int CGameNetworkManager::ServerThreadProc( void* lpParameter )
|
||||
{
|
||||
while((Minecraft::GetInstance()->skins->needsUIUpdate() || ui.IsReloadingSkin()))
|
||||
{
|
||||
Sleep(1);
|
||||
Sleep(0);
|
||||
}
|
||||
param->levelGen->loadBaseSaveData();
|
||||
}
|
||||
@@ -984,7 +997,7 @@ int CGameNetworkManager::ExitAndJoinFromInviteThreadProc( void* lpParam )
|
||||
|
||||
while( g_NetworkManager.IsInSession() )
|
||||
{
|
||||
Sleep(1);
|
||||
Sleep(0);
|
||||
}
|
||||
|
||||
// Xbox should always be online when receiving invites - on PS3 we need to check & ask the user to sign in
|
||||
@@ -1260,7 +1273,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
||||
// wait for the current session to end
|
||||
while( g_NetworkManager.IsInSession() )
|
||||
{
|
||||
Sleep(1);
|
||||
Sleep(0);
|
||||
}
|
||||
|
||||
// Reset this flag as the we don't need to know that we only lost the room only from this point onwards, the behaviour is exactly the same
|
||||
@@ -1665,6 +1678,7 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
||||
{
|
||||
if (ProfileManager.IsSignedIn(i) && (i == ProfileManager.GetPrimaryPad() || isLocalMultiplayerAvailable))
|
||||
{
|
||||
#ifndef _DISABLE_XBLIVE
|
||||
if (isSignedInLive && !ProfileManager.IsSignedInLive(i))
|
||||
{
|
||||
// Record the first non signed in live pad
|
||||
@@ -1672,6 +1686,9 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
||||
}
|
||||
|
||||
isSignedInLive = isSignedInLive && ProfileManager.IsSignedInLive(i);
|
||||
#else
|
||||
isSignedInLive = true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1743,7 +1760,9 @@ void CGameNetworkManager::GameInviteReceived( int userIndex, const INVITE_INFO *
|
||||
if(index==userIndex || pMinecraft->localplayers[index]!=NULL )
|
||||
{
|
||||
++joiningUsers;
|
||||
#ifndef _DISABLE_XBLIVE
|
||||
if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true;
|
||||
#endif
|
||||
localUsersMask |= GetLocalPlayerMask( index );
|
||||
}
|
||||
}
|
||||
@@ -1898,6 +1917,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I
|
||||
if(!app.IsLocalMultiplayerAvailable())
|
||||
#endif
|
||||
{
|
||||
#ifndef _DISABLE_XBLIVE
|
||||
bool noPrivileges=!ProfileManager.AllowedToPlayMultiplayer(userIndex);
|
||||
|
||||
if(noPrivileges)
|
||||
@@ -1908,6 +1928,7 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
ProfileManager.SetLockedProfile(userIndex);
|
||||
ProfileManager.SetPrimaryPad(userIndex);
|
||||
|
||||
@@ -1930,7 +1951,9 @@ void CGameNetworkManager::HandleInviteWhenInMenus( int userIndex, const INVITE_I
|
||||
{
|
||||
app.DebugPrintf( "Failed joining game from invite\n" );
|
||||
}
|
||||
#ifndef _DISABLE_XBLIVE
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user