示例#1
0
// Finish off and tidy up match making
void XBL_MM_Shutdown( bool processLogon )
{
	// We're killing our session, no matter what
	session.Delete();

	// XDK code to finish this off, while not letting the logon task expire,
	// except if we're already leaving live, where we can get into a recursive
	// com_error situation:
	HRESULT hr;
	do
	{
		if( processLogon && !XBL_PumpLogon() )
			return;
		hr = session.Process();
	} while ( session.IsDeleting() );
}
示例#2
0
// run this code every game tick
// will only be called while logged on
//
void XBL_MM_Tick()
{
	// VVFIXME - SOF2 re-advertised after some crazy timeout.

	// New version just ticks the session object as well, it does nothing if it's not real
	HRESULT hr = session.Process();
#ifdef _DEBUG
	if ( FAILED( hr ) )
		Com_Printf("session.Process() failed: %s\n", getXBLErrorName(hr));
#endif

	// The only time we need to do async work on the query is when probing for QoS
	if ( query.IsProbing() )
	{
		query.Process();
	}
}
示例#3
0
// SOF2 had some silly two-stage thing. They stored off the session parms here, then used
// a couple globals to delay advertisement until later. I'm going to try and avoid that
void XBL_MM_Init_Session()
{
	// Fill in # of slots. OpenPublic is total slots, minus one for server, minus # reserved for private
	session.PrivateFilled		= 0;
	session.PrivateOpen			= sv_privateClients->integer;
	session.PublicFilled		= (com_dedicated->integer ? 0 : 1);	// Non-dedicated server fills a slot
	session.PublicOpen			= sv_maxclients->integer - (session.PrivateOpen + session.PublicFilled);
	session.TotalPlayers		= session.PublicFilled;

	// Get current map index, and gametype
	int index = mapNameToIndex( sv_mapname->string );
	if (index == MAP_ARRAY_SIZE)
	{
		Com_Error( ERR_FATAL, "Bad map name: %s\n", sv_mapname->string );
	}
	session.CurrentMap = index;
	session.GameType = sv_gametype->integer;

	// Copy the host's gamertag to the session name
	XONLINE_USER* pHostAccount = XBL_GetUserInfo( XBL_GetSelectedAccountIndex() );
	WCHAR sessionName[XONLINE_GAMERTAG_SIZE] = { 0 };
	if ( pHostAccount )
	{
		charToWchar( sessionName, pHostAccount->szGamertag );
	}
	else
	{
		charToWchar( sessionName, "unknown" );
	}
	session.SetSessionName( sessionName );

	// All other game options:
	session.FriendlyFire	= g_friendlyFire.integer;
	session.JediMastery		= g_maxForceRank.integer;
	session.SaberOnly		= HasSetSaberOnly();
	session.Dedicated		= com_dedicated->integer;

	// Actually create the session. If we don't call Process immediately, it explodes
	HRESULT hr = session.Create();
	if (hr != S_OK)
	{
		Com_Error( ERR_DROP, "Failed to create session: 0x%x\n", hr );
	}

	do
	{
		if( !XBL_PumpLogon() )
			return;
		hr = session.Process();
	} while ( session.IsCreating() );

	// VVFIXME - Better error handling
	if ( !session.Exists() )
	{
		Com_Error( ERR_DROP, "Failed to create session #2: 0x%x\n", hr );
	}

	// Fix for a bug. Server was using Notification API before advertising, so for
	// the first few seconds, had the wrong sessionID, and thus couldn't invite.
	// Force an update now:
	XBL_F_CheckJoinableStatus( true );
}