示例#1
0
//-----------------------------------------------------------------------------
// Invokes a method on all installed game systems in reverse order
//-----------------------------------------------------------------------------
void InvokeMethodReverseOrder( GameSystemFunc_t f )
{
	int i;
	int c = s_GameSystems.Count();
	for ( i = c; --i >= 0; )
	{
		IGameSystem *sys = s_GameSystems[i];
#if (VPROF_LEVEL > 0) && defined(VPROF_ACCOUNT_GAMESYSTEMS)   // make sure each game system is individually attributed
		// because vprof nodes must really be constructed with a pointer to a static
		// string, we can't create a temporary char[] here and sprintf a distinctive
		// V_snprintf( buf, 63, "gamesys_preframe_%s", sys->Name() ). We'll have to
		// settle for just the system name, and distinguish between pre and post frame
		// in hierarchy.
		VPROF( sys->Name() );
#endif
		MDLCACHE_CRITICAL_SECTION();
		(sys->*f)();
	}
}
示例#2
0
//-----------------------------------------------------------------------------
// Invokes a method on all installed game systems in proper order
//-----------------------------------------------------------------------------
void InvokeMethod( GameSystemFunc_t f, char const *timed /*=0*/ )
{
#if defined( _XBOX )
#if !defined( _RETAIL )
	char sz[ 128 ];
#endif
#else
	NOTE_UNUSED( timed );
#endif
	int i;
	int c = s_GameSystems.Count();
	for ( i = 0; i < c ; ++i )
	{
		IGameSystem *sys = s_GameSystems[i];

		MDLCACHE_CRITICAL_SECTION();

#if !defined( _RETAIL )
#if defined( _XBOX )
		if ( timed )
		{
			Q_snprintf( sz, sizeof( sz ), "%s->%s():Start", sys->Name(), timed );
			XBX_rTimeStampLog( Plat_FloatTime(), sz );
		}
#endif
#endif
		(sys->*f)();
#if !defined( _RETAIL )
#if defined( _XBOX )
		if ( timed )
		{
			Q_snprintf( sz, sizeof( sz ), "%s->%s():Finish", sys->Name(), timed );
			XBX_rTimeStampLog( Plat_FloatTime(), sz );
		}
#endif
#endif
	}
}
示例#3
0
//-----------------------------------------------------------------------------
// Invokes methods on all installed game systems
//-----------------------------------------------------------------------------
bool IGameSystem::InitAllSystems()
{
	int i;

	{
		// first add any auto systems to the end
		CAutoGameSystem *pSystem = s_pSystemList;
		while ( pSystem )
		{
			if ( s_GameSystems.Find( pSystem ) == s_GameSystems.InvalidIndex() )
			{
				Add( pSystem );
			}
			else
			{
				DevWarning( 1, "AutoGameSystem already added to game system list!!!\n" );
			}
			pSystem = pSystem->m_pNext;
		}
		s_pSystemList = NULL;
	}

	{
		CAutoGameSystemPerFrame *pSystem = s_pPerFrameSystemList;
		while ( pSystem )
		{
			if ( s_GameSystems.Find( pSystem ) == s_GameSystems.InvalidIndex() )
			{
				Add( pSystem );
			}
			else
			{
				DevWarning( 1, "AutoGameSystem already added to game system list!!!\n" );
			}

			pSystem = pSystem->m_pNext;
		}
		s_pSystemList = NULL;
	}
	// Now remember that we are initted so new CAutoGameSystems will add themselves automatically.
	s_bSystemsInitted = true;

	for ( i = 0; i < s_GameSystems.Count(); ++i )
	{
		MDLCACHE_CRITICAL_SECTION();

		IGameSystem *sys = s_GameSystems[i];

#if defined( _X360 )
		char sz[128];
		Q_snprintf( sz, sizeof( sz ), "%s->Init():Start", sys->Name() );
		XBX_rTimeStampLog( Plat_FloatTime(), sz );
#endif
		bool valid = sys->Init();

#if defined( _X360 )
		Q_snprintf( sz, sizeof( sz ), "%s->Init():Finish", sys->Name() );
		XBX_rTimeStampLog( Plat_FloatTime(), sz );
#endif
		if ( !valid )
			return false;
	}

	return true;
}