void MM_InitWrapper(MM_Environment *env, unsigned int envSize) { char **envPtr = (char **)env; char **mmPtr =(char **)(&mmEnv); char **envEnd = (char **)((char *)envPtr + envSize); char **mmEnd =(char **)((char *)mmPtr+ sizeof(MM_Environment)); /* Copy fields from env to mmEnv, one pointer at a time */ while (mmPtr < mmEnd && envPtr < envEnd) *mmPtr++ = *envPtr++; /* If env doesn't define all of mmEnv's fields, set extras to NULL */ while (mmPtr < mmEnd) *mmPtr++ = (char *)0; /* Call user's MM_Init function */ MM_Init(); }
void APP_Start(void) { #if PL_HAS_RTOS_TRACE if(RTOSTRC1_uiTraceStart()!=1) { for(;;){} /* failure? */ } #endif #if PL_HAS_RADIO RNETA_Init(); #endif #if PL_HAS_FLOPPY FLOPPY_Init(); #endif #if PL_HAS_MIDI MM_Init(); #endif SHELL_Init(); if (FRTOS1_xTaskCreate( MainTask, /* pointer to the task */ "Main", /* task name for kernel awareness debugging */ configMINIMAL_STACK_SIZE+500, /* task stack size */ (void*)NULL, /* optional task startup argument */ tskIDLE_PRIORITY, /* initial priority */ (xTaskHandle*)NULL /* optional task handle to create */ ) != pdPASS) { /*lint -e527 */ for(;;){} /* error! probably out of memory */ /*lint +e527 */ } timerHndl = xTimerCreate("timer0", TIMER_PERIOD_MS/portTICK_RATE_MS, pdTRUE, (void *)0, vTimerCallback); if (timerHndl==NULL) { for(;;); /* failure! */ } if (xTimerStart(timerHndl, 0)!=pdPASS) { for(;;); /* failure! */ } FRTOS1_vTaskStartScheduler(); }
/* * Qcommon_Init */ void Qcommon_Init( int argc, char **argv ) { if( setjmp( abortframe ) ) Sys_Error( "Error during initialization: %s", com_errormsg ); QThreads_Init(); com_print_mutex = QMutex_Create(); // initialize memory manager Memory_Init(); // prepare enough of the subsystems to handle // cvar and command buffer management COM_InitArgv( argc, argv ); Cbuf_Init(); // initialize cmd/cvar/dynvar tries Cmd_PreInit(); Cvar_PreInit(); Dynvar_PreInit(); // create basic commands and cvars Cmd_Init(); Cvar_Init(); Dynvar_Init(); dynvars_initialized = qtrue; wswcurl_init(); Key_Init(); // we need to add the early commands twice, because // a basepath or cdpath needs to be set before execing // config files, but we want other parms to override // the settings of the config files Cbuf_AddEarlyCommands( qfalse ); Cbuf_Execute(); // wsw : aiwa : create dynvars (needs to be completed before .cfg scripts are executed) Dynvar_Create( "sys_uptime", qtrue, Com_Sys_Uptime_f, DYNVAR_READONLY ); Dynvar_Create( "frametick", qfalse, DYNVAR_WRITEONLY, DYNVAR_READONLY ); Dynvar_Create( "quit", qfalse, DYNVAR_WRITEONLY, DYNVAR_READONLY ); Dynvar_Create( "irc_connected", qfalse, Irc_GetConnected_f, Irc_SetConnected_f ); Sys_InitDynvars(); CL_InitDynvars(); #ifdef TV_SERVER_ONLY tv_server = Cvar_Get( "tv_server", "1", CVAR_NOSET ); Cvar_ForceSet( "tv_server", "1" ); #else tv_server = Cvar_Get( "tv_server", "0", CVAR_NOSET ); #endif #ifdef DEDICATED_ONLY dedicated = Cvar_Get( "dedicated", "1", CVAR_NOSET ); Cvar_ForceSet( "dedicated", "1" ); #else dedicated = Cvar_Get( "dedicated", "0", CVAR_NOSET ); #endif #ifdef MATCHMAKER mm_server = Cvar_Get( "mm_server", "1", CVAR_READONLY ); Cvar_ForceSet( "mm_server", "1" ); #else mm_server = Cvar_Get( "mm_server", "0", CVAR_READONLY ); #endif FS_Init(); Cbuf_AddText( "exec default.cfg\n" ); if( !dedicated->integer ) { Cbuf_AddText( "exec config.cfg\n" ); Cbuf_AddText( "exec autoexec.cfg\n" ); } else if( mm_server->integer ) { Cbuf_AddText( "exec mmaker_autoexec.cfg\n" ); } else if( tv_server->integer ) { Cbuf_AddText( "exec tvserver_autoexec.cfg\n" ); } else { Cbuf_AddText( "exec dedicated_autoexec.cfg\n" ); } Cbuf_AddEarlyCommands( qtrue ); Cbuf_Execute(); // // init commands and vars // Memory_InitCommands(); Qcommon_InitCommands(); host_speeds = Cvar_Get( "host_speeds", "0", 0 ); log_stats = Cvar_Get( "log_stats", "0", 0 ); developer = Cvar_Get( "developer", "0", 0 ); timescale = Cvar_Get( "timescale", "1.0", CVAR_CHEAT ); fixedtime = Cvar_Get( "fixedtime", "0", CVAR_CHEAT ); if( tv_server->integer ) logconsole = Cvar_Get( "logconsole", "tvconsole.log", CVAR_ARCHIVE ); else if( dedicated->integer ) logconsole = Cvar_Get( "logconsole", "wswconsole.log", CVAR_ARCHIVE ); else logconsole = Cvar_Get( "logconsole", "", CVAR_ARCHIVE ); logconsole_append = Cvar_Get( "logconsole_append", "1", CVAR_ARCHIVE ); logconsole_flush = Cvar_Get( "logconsole_flush", "0", CVAR_ARCHIVE ); logconsole_timestamp = Cvar_Get( "logconsole_timestamp", "0", CVAR_ARCHIVE ); com_showtrace = Cvar_Get( "com_showtrace", "0", 0 ); com_introPlayed3 = Cvar_Get( "com_introPlayed3", "0", CVAR_ARCHIVE ); Cvar_Get( "irc_server", "irc.quakenet.org", CVAR_ARCHIVE ); Cvar_Get( "irc_port", "6667", CVAR_ARCHIVE ); Cvar_Get( "irc_nick", APPLICATION "Player", CVAR_ARCHIVE ); Cvar_Get( "irc_user", APPLICATION "User", CVAR_ARCHIVE ); Cvar_Get( "irc_password", "", CVAR_ARCHIVE ); Cvar_Get( "gamename", APPLICATION, CVAR_READONLY ); versioncvar = Cvar_Get( "version", APP_VERSION_STR " " CPUSTRING " " __DATE__ " " BUILDSTRING, CVAR_SERVERINFO|CVAR_READONLY ); revisioncvar = Cvar_Get( "revision", SVN_RevString(), CVAR_READONLY ); Sys_Init(); NET_Init(); Netchan_Init(); CM_Init(); Steam_LoadLibrary(); Com_ScriptModule_Init(); MM_Init(); SV_Init(); CL_Init(); SCR_EndLoadingPlaque(); if( !dedicated->integer ) { Cbuf_AddText( "exec stuffcmds.cfg\n" ); } else if( mm_server->integer ) { Cbuf_AddText( "exec mmaker_stuffcmds.cfg\n" ); } else if( tv_server->integer ) { Cbuf_AddText( "exec tvserver_stuffcmds.cfg\n" ); } else { Cbuf_AddText( "exec dedicated_stuffcmds.cfg\n" ); } // add + commands from command line if( !Cbuf_AddLateCommands() ) { // if the user didn't give any commands, run default action if( !dedicated->integer ) { // only play the introduction sequence once if( !com_introPlayed3->integer ) { Cvar_ForceSet( com_introPlayed3->name, "1" ); #if !defined(__MACOSX__) && !defined(__ANDROID__) Cbuf_AddText( "cinematic intro.roq\n" ); #endif } } } else { // the user asked for something explicit // so drop the loading plaque SCR_EndLoadingPlaque(); } Com_Printf( "\n====== %s Initialized ======\n", APPLICATION ); Cbuf_Execute(); }
void tech_memory_init() { MM_Init(); memory = map_create(10, NULL, &compare); }