Esempio n. 1
0
// Find currently running sessions
int XBL_MM_Find_Session(ULONGLONG GameType, // Optional: X_MATCH_NULL_INTEGER to omit
						const char *mapName, // Optional: "any" to omit
						ULONGLONG MinimumPlayers,
						ULONGLONG MaximumPlayers,
						ULONGLONG FriendlyFire, // Optional: X_MATCH_NULL_INTEGER to omit
						ULONGLONG JediMastery, // Optional: X_MATCH_NULL_INTEGER to omit
						ULONGLONG SaberOnly, // Optional: X_MATCH_NULL_INTEGER to omit
						ULONGLONG Dedicated) // Optional: X_MATCH_NULL_INTEGER to omit
{
	// Kill off a previous query that's still running
	query.Cancel();

	ULONGLONG CurrentMap = mapNameToIndex( mapName );
	if( CurrentMap == MAP_ARRAY_SIZE )
		CurrentMap = X_MATCH_NULL_INTEGER;

	HRESULT hr = query.Query(
		GameType,
		CurrentMap,
		MinimumPlayers,
		MaximumPlayers,
		FriendlyFire,
		JediMastery,
		SaberOnly,
		Dedicated);
	if ( FAILED( hr ) )
	{
		Com_Error( ERR_DROP, "@MENUS_XBOX_LOST_CONNECTION" );
	}
	// Keep servicing the query until it completes.
	// The logon task must also be serviced in order 
	// to remain connected. 
	do
	{
		if( !XBL_PumpLogon() )
			return 0;
		hr = query.Process();
	} while( query.IsRunning() );

	if( !query.Succeeded() )
	{
		Com_Error( ERR_DROP, "@MENUS_XBOX_LOST_CONNECTION" );
	}

	if (!query.Results.Size())
	{
		// VVFIXME - handle search that returns no results
		Com_Printf("No games found in query\n");
		return 0;
	}

	// The above gets all results, and does initial (can we connect) probing.
	// We wait for that, then begin real probing here, which is done async.
	query.Probe();
	optiMatchIndex = 0;

	return query.Results.Size();
}
Esempio n. 2
0
const char *Syslink_GetServerMap( const int index )
{
	serverInfo_t *s = SysLink_GetServer( index );

	int mapIndex = mapNameToIndex( s->mapName );
	if( mapIndex == MAP_ARRAY_SIZE )
		return "";

	return mapIndexToLongName( mapIndex );
}
Esempio n. 3
0
void XBL_MM_Update_Session()
{
	// VVFIXME - Do we need to ensure that slot counts are right?
	// Our gamertag hasn't changed (I hope) so we leave that alone.

	// 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;

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

	// Update the advertised session info
	session.Update();
}
Esempio n. 4
0
 /** convenience method, does the same as the getElementByName */
 T& operator[](std::string name)
 {
     return elements.at( mapNameToIndex( name ) );
 }
Esempio n. 5
0
 /** Returns the state information for the given element */
 const T& getElementByName(std::string name) const
 {
     return elements.at( mapNameToIndex( name ) );
 }
Esempio n. 6
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 );
}