- // Initialize audio support
-#ifdef ENABLE_AUDIO_SUPPORT
-
- // Start the intro music
- if ( fgGetBool("/sim/startup/intro-music") ) {
- SGPath mp3file( globals->get_fg_root() );
- mp3file.append( "Sounds/intro.mp3" );
-
- SG_LOG( SG_GENERAL, SG_INFO,
- "Starting intro music: " << mp3file.str() );
-
-# if defined( __CYGWIN__ )
- string command = "start /m `cygpath -w " + mp3file.str() + "`";
-# elif defined( _WIN32 )
- string command = "start /m " + mp3file.str();
-# else
- string command = "mpg123 " + mp3file.str() + "> /dev/null 2>&1";
-# endif
-
- if (0 != system ( command.c_str() ))
- {
- SG_LOG( SG_SOUND, SG_WARN,
- "Failed to play mp3 file " << mp3file.str() << ". Maybe mp3 player is not installed." );
- }
- }
-#endif
- // This is the top level init routine which calls all the
- // other subsystem initialization routines. If you are adding
- // a subsystem to flightgear, its initialization call should be
- // located in this routine.
- if( !fgInitSubsystems()) {
- SG_LOG( SG_GENERAL, SG_ALERT,
- "Subsystem initialization failed ..." );
- exit(-1);
- }
-
- // Torsten Dreyer:
- // ugly hack for automatic runway selection on startup based on
- // metar data. Makes startup.nas obsolete and guarantees the same
- // runway selection as for AI traffic. However, this code belongs to
- // somewhere(?) else - if I only new where...
- if( true == fgGetBool( "/environment/metar/valid" ) ) {
- SG_LOG(SG_ENVIRONMENT, SG_INFO,
- "Using METAR for runway selection: '" << fgGetString("/environment/metar/data") << "'" );
- // the realwx_ctrl fetches metar in the foreground on init,
- // If it was able to fetch a metar or one was given on the commandline,
- // the valid flag is set here, otherwise it is false
- double hdg = fgGetDouble( "/environment/metar/base-wind-dir-deg", 9999.0 );
- string apt = fgGetString( "/sim/startup/options/airport" );
- string rwy = fgGetString( "/sim/startup/options/runway" );
- double strthdg = fgGetDouble( "/sim/startup/options/heading-deg", 9999.0 );
- string parkpos = fgGetString( "/sim/presets/parkpos" );
- bool onground = fgGetBool( "/sim/presets/onground", false );
- // don't check for wind-speed < 1kt, this belongs to the runway-selection code
- // the other logic is taken from former startup.nas
- if( hdg < 360.0 && apt.length() > 0 && strthdg > 360.0 && rwy.length() == 0 && onground && parkpos.length() == 0 ) {
- extern bool fgSetPosFromAirportIDandHdg( const string& id, double tgt_hdg );
- fgSetPosFromAirportIDandHdg( apt, hdg );
- }
+ SGTimeStamp st;
+ st.stamp();
+ fgCreateSubsystems();
+ SG_LOG(SG_GENERAL, SG_INFO, "Creating subsystems took:" << st.elapsedMSec());
+ fgSplashProgress("binding-subsystems");
+
+ } else if ( idle_state == 8 ) {
+ idle_state++;
+ SGTimeStamp st;
+ st.stamp();
+ globals->get_subsystem_mgr()->bind();
+ SG_LOG(SG_GENERAL, SG_INFO, "Binding subsystems took:" << st.elapsedMSec());
+
+ fgSplashProgress("init-subsystems");
+ } else if ( idle_state == 9 ) {
+ SGSubsystem::InitStatus status = globals->get_subsystem_mgr()->incrementalInit();
+ if ( status == SGSubsystem::INIT_DONE) {
+ ++idle_state;
+ fgSplashProgress("finishing-subsystems");