void CGameLobbyManager::EthernetStateCallback(UCryLobbyEventData eventData, void *arg)
{
	if(eventData.pEthernetStateData)
	{
		CryLog("[GameLobbyManager] EthernetStateCallback state %d", eventData.pEthernetStateData->m_curState);

		CGameLobbyManager *pGameLobbyManager = (CGameLobbyManager*)arg;
		CRY_ASSERT(pGameLobbyManager);

		if(g_pGame->HasExclusiveControllerIndex())
		{
			ECableState newState = eventData.pEthernetStateData->m_curState;
#if 0 // old frontend
			if(pMPMenuHub)
			{
				pMPMenuHub->EthernetStateChanged(newState);
			}
#endif

			// cable has been removed, clear dialog
			if ((newState == eCS_Unplugged) || (newState == eCS_Disconnected))
			{
				CErrorHandling *pErrorHandling = CErrorHandling::GetInstance();
				if (pErrorHandling)
				{
					pErrorHandling->OnFatalError(CErrorHandling::eFE_EthernetCablePulled);
				}
#if 0 // old frontend
				CWarningsManager *pWM = g_pGame->GetWarnings();
				if(pWM)
				{
					pWM->RemoveWarning("ChatRestricted");
				}
#endif
			}
		}

		pGameLobbyManager->m_isCableConnected = (eventData.pEthernetStateData->m_curState == eCS_Connected) ? true : false;
	}
}
void CGameLobbyManager::EthernetStateCallback(UCryLobbyEventData eventData, void *arg)
{
	if(eventData.pEthernetStateData)
	{
		CryLog("[GameLobbyManager] EthernetStateCallback state %d", eventData.pEthernetStateData->m_curState);

		CGameLobbyManager *pGameLobbyManager = (CGameLobbyManager*)arg;
		CRY_ASSERT(pGameLobbyManager);

		if(g_pGame->HasExclusiveControllerIndex())
		{
			ECableState newState = eventData.pEthernetStateData->m_curState;







			// cable has been removed, clear dialog
			if ((newState == eCS_Unplugged) || (newState == eCS_Disconnected))
			{
				CErrorHandling *pErrorHandling = CErrorHandling::GetInstance();
				if (pErrorHandling)
				{
					pErrorHandling->OnFatalError(CErrorHandling::eFE_EthernetCablePulled);
				}







			}
		}

		pGameLobbyManager->m_isCableConnected = (eventData.pEthernetStateData->m_curState == eCS_Connected) ? true : false;
	}
}
Exemple #3
0
void CDLCManager::OnPlatformEvent(const IPlatformOS::SPlatformEvent& event)
{
	switch(event.m_eEventType)
	{
		case IPlatformOS::SPlatformEvent::eET_ContentInstalled:
		{
			break;
		}

		case IPlatformOS::SPlatformEvent::eET_ContentRemoved:
		{
			OnDLCRemoved(event.m_uParams.m_contentRemoved.m_root);
			m_bContentAvailable = false;

			CErrorHandling *pErrorHandling = CErrorHandling::GetInstance();
			if (pErrorHandling)
			{
				pErrorHandling->OnFatalError(CErrorHandling::eFE_ContentRemoved);
			}
			break;
		}
	}
}
//Handles online state changes - when you sign out it returns you
void CGameLobbyManager::OnlineCallback(UCryLobbyEventData eventData, void *arg)
{
	if (g_pGameCVars->g_ProcessOnlineCallbacks == 0)
		return;

	if(eventData.pOnlineStateData)
	{
		CGameLobbyManager *pLobbyManager = static_cast<CGameLobbyManager*>(arg);

#if defined(DEDICATED_SERVER)
		EOnlineState previousState = pLobbyManager->m_onlineState[eventData.pOnlineStateData->m_user];
#endif

		CRY_ASSERT(eventData.pOnlineStateData->m_user < MAX_LOCAL_USERS);
		pLobbyManager->m_onlineState[eventData.pOnlineStateData->m_user] = eventData.pOnlineStateData->m_curState;

		uint32 userIndex = g_pGame->GetExclusiveControllerDeviceIndex();

		ICryLobby *pLobby = FakeGetLobby();

#ifndef _RELEASE
		const char *pEventType = "eOS_Unknown";
		if (eventData.pOnlineStateData->m_curState == eOS_SignedOut)
		{
			pEventType = "eOS_SignedOut";
		}
		else if (eventData.pOnlineStateData->m_curState == eOS_SigningIn)
		{
			pEventType = "eOS_SigningIn";
		}
		else if (eventData.pOnlineStateData->m_curState == eOS_SignedIn)
		{
			pEventType = "eOS_SignedIn";
		}
		CryLog("[GameLobbyManager] OnlineCallback: eventType=%s, user=%u, currentUser=%u", pEventType, eventData.pOnlineStateData->m_user, userIndex);

		if (g_pGameCVars->autotest_enabled && pLobby != NULL && (pLobby->GetLobbyServiceType() == eCLS_LAN))
		{
			// Don't care about signing out if we're in the autotester and in LAN mode
			return;
		}
#endif

		{
			EOnlineState onlineState = eventData.pOnlineStateData->m_curState;
			if(onlineState == eOS_SignedOut)
			{
				if(pLobby && pLobby->GetLobbyServiceType() == eCLS_Online)
				{
					if(eventData.pOnlineStateData->m_reason != eCLE_CyclingForInvite)
					{
						CErrorHandling *pErrorHandling = CErrorHandling::GetInstance();
						if (pErrorHandling)
						{
							pErrorHandling->OnFatalError(CErrorHandling::eFE_PlatformServiceSignedOut);
						}
						else
						{
							pLobbyManager->LeaveGameSession(eLSR_SignedOut);
						}

						IPlayerProfileManager *pPPM = g_pGame->GetIGameFramework()->GetIPlayerProfileManager();
						if(pPPM)
						{
							pPPM->ClearOnlineAttributes();
						}

#if 0 // old frontend
						CWarningsManager *pWM = g_pGame->GetWarnings();
						if(pWM)
						{
							pWM->RemoveWarning("ChatRestricted");
						}
#endif 
					}


#if defined(DEDICATED_SERVER)
					if (previousState != eOS_SignedOut)
					{
						CryLogAlways("We've been signed out, reason=%u, bailing", eventData.pOnlineStateData->m_reason);
						gEnv->pConsole->ExecuteString("quit", false, true);
					}
#endif
				}
			}					
		}
	}
}