/* * ML_Restart * Restart map list stuff */ void ML_Restart( qboolean forcemaps ) { ML_Shutdown(); if( forcemaps ) FS_RemoveFile( MLIST_CACHE ); FS_Rescan(); ML_Init(); }
/* * ML_Restart * Restart map list stuff */ void ML_Restart( bool forcemaps ) { ML_Shutdown(); if( forcemaps ) { int filenum; if( FS_FOpenFile( MLIST_CACHE, &filenum, FS_WRITE|FS_CACHE ) != -1 ) FS_FCloseFile( filenum ); } FS_Rescan(); ML_Init(); }
BOOL BAL_TaskInit() { UINT8 i = 0; INT32 err_code = 0x00; UINT32 fs_dev_count = 0; FS_DEV_INFO* fs_dev_info = NULL; UINT32 fs_root_dev_count = 0; #if ( CHIP_ASIC_ID != CHIP_ASIC_ID_JADE) csw_RegisterYourself(); #else DM_CheckPowerOnCause(); #endif // hal_fastOSTimInit(); BAL_DevHandlerInit(); TS_Init_Inner(); // TS_SetOutputMask(CSW_TS_ID, 1); // TS_SetOutputMask(CFW_SIM_TS_ID, 1); // TS_SetOutputMask(CFW_NW_TS_ID, 1); // TS_SetOutputMask(CFW_SMS_TS_ID, 1); // TS_SetOutputMask(CFW_CC_TS_ID, 1); // TS_SetOutputMask(CFW_SS_TS_ID, 1); // TS_SetOutputMask(CFW_PM_TS_ID, 1); // TS_SetOutputMask(BASE_FFS_TS_ID, 1); // TS_SetOutputMask(BASE_TM_TS_ID, 1); // TS_SetOutputMask(CFW_SHELL_TS_ID, 1); // TS_SetOutputMask(CFW_AOM_TS_ID, 1); // open 1,2,3,4 // sxs_IoCtx.TraceBitMap [TGET_ID(_CSW)] = 1|(1 << 1) | (1 << 2)|(1<<3); // open shell trace sxs_IoCtx.TraceBitMap[TGET_ID(_CSW)] = (1 << 1); // // sxs_IoCtx.TraceBitMap [TGET_ID(_MMI)] = 0; // sxs_IoCtx.TraceBitMap [TGET_ID(_MM)] = 0; BAL_SetMMIDefaultValue(); // CSW_CheckMMIDefaultValue() ; CSW_CheckMMIDefaultValue(); // add wys 2007-06-20 csw_MemIint(); PM_CheckValidPowerOnVoltage(3000); /* if(0x00 == CFW_GetValidMarker())//0x00 表示非生产模式 { CSW_TRACE(100, TSTXT("norm modle")); if(!PM_CheckValidPowerOnVoltage(g_MMI_Default_Value.nMinVol)) { hal_ShutDown(); } } else { CSW_TRACE(100, TSTXT("e modle")); } //deleted by mabo to power on at low power voltage,20070829 //add wys 2007-06-20 if(0x00 == CFW_GetValidMarker())//0x00 表示非生产模式 { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("BAL_TaskInit norm modle")); if(!PM_CheckValidPowerOnVoltage(g_MMI_Default_Value.nMinVol)) { hal_ShutDown(); } } else { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("BAL_TaskInit e modle")); } //add end */ CSW_TRACE(BASE_BAL_TS_ID, TSTXT("\nBAL_TaskInit Start. \n")); DRV_FlashPowerUp(); //mabo deleted,20070813 //DRV_FlashInit(CSW_DVR_FLASH_INIT_PARA) ; //romuald added 20080425 #if (CHIP_ASIC_ID != CHIP_ASIC_ID_JADE) DRV_FlashInit(); #endif //Modify for memory overflow bug at 20090724 //for(i = 0; i< SIZEOF(g_BalTasks); i++) for(i = 0; i< MAX_BAL_TASK_NUM; i++) g_BalTasks[i] = HNULL; g_BalTasks[BAL_TASK_NUM(BAL_SYS_TASK_PRIORITY)] = COS_CreateTask_Prv(BAL_SysTask, NULL, NULL, BAL_SYS_TASK_STACK_SIZE, BAL_SYS_TASK_PRIORITY, COS_CREATE_DEFAULT, 0, "BAL_SysTask"); #ifdef CFW_TCPIP_SUPPORT g_BalTasks[BAL_TASK_NUM(BAL_CFW_ADV_TASK_PRIORITY)] = COS_CreateTask_Prv(BAL_CFWApsTask, NULL, NULL, BAL_CFW_ADV_TASK_STACK_SIZE, BAL_CFW_ADV_TASK_PRIORITY, COS_CREATE_DEFAULT, 0, "BAL_CFWApsTask"); #endif g_BalTasks[BAL_TASK_NUM(BAL_DEV_MONITOR_TASK_PRIORITY)] = COS_CreateTask_Prv(BAL_DevMonitorTask, NULL, NULL, BAL_DEV_MONITOR_TASK_STACK_SIZE, BAL_DEV_MONITOR_TASK_PRIORITY, COS_CREATE_DEFAULT, 0, "BAL_DevMonitorTask"); g_BalTasks[3] = COS_CreateTask_Prv(BAL_BackgroundTask, NULL, NULL, BAL_BG_TASK_STACK_SIZE, COS_BK_TASK_PRI, COS_CREATE_DEFAULT, 0, "BAL_BackgroundTask"); //Add by lixp at 20080201 // #ifdef ML_SUPPORT ML_Init(); ML_SetCodePage(ML_ISO8859_1); #elif defined(NEW_ML_SUPPORT) #endif BAL_ApplicationInit(); err_code = VDS_Init(); // Initialize VDS. added bye nie. 20070322 if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"VDS_Init() OK.\n"); } else { CSW_TRACE(BASE_BAL_TS_ID,"VDS_Init() ERROR, Error code: %d.\n", err_code); } err_code = DSM_DevInit(); if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"DSM_DevInit OK.\n"); } else { CSW_TRACE(BASE_BAL_TS_ID,"DSM_DevInit ERROR, Error code: %d. \n",err_code); } err_code = REG_Init(); if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("REG_Init() OK.\n")); } else { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("REG_Init() Fail!Error code:%d.\n"),err_code); } err_code = CFW_CfgInit(); if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("CFW_CfgInit OK.\n")); } else { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("CFW_CfgInit ERROR, Error code: 0x%08x \n"), err_code); } err_code = SMS_DM_Init(); if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("SMS_DM_Init OK.\n")); } else { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("SMS_DM_Init ERROR, Error code: %d.\n"), err_code); } err_code = FS_PowerOn(); if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"FS Power On Check OK.\n"); } else { CSW_TRACE(BASE_BAL_TS_ID,"FS Power On Check ERROR, Error code: %d. \n",err_code); } // Get FS device table. err_code = FS_GetDeviceInfo(&fs_dev_count, &fs_dev_info); if(err_code != ERR_SUCCESS) { CSW_TRACE(BASE_BAL_TS_ID,"Device not register.\n"); fs_dev_count = 0; } // Check the state of root device ,if not format, format it. // Mount root device. for(i = 0; i < fs_dev_count; i++) { // format the flash device. if(fs_dev_info[i].dev_type == FS_DEV_TYPE_FLASH && fs_dev_info[i].is_root == TRUE) { err_code = FS_HasFormatted(fs_dev_info[i].dev_name,FS_TYPE_FAT); if(ERR_FS_HAS_FORMATED == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"The flash device %s has formated.\n",fs_dev_info[i].dev_name); } else if(ERR_FS_NOT_FORMAT == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"The flash device %s not format.\n",fs_dev_info[i].dev_name); err_code = FS_Format(fs_dev_info[i].dev_name,FS_TYPE_FAT,0); if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"The flash device %s format ok.\n",fs_dev_info[i].dev_name); } else if(ERR_FS_NOT_FORMAT == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"The flash device %s format error.Error code:%d.\n",fs_dev_info[i].dev_name,err_code); } } else { CSW_TRACE(BASE_BAL_TS_ID,"The flash device %s has formated error.Error code:%d.\n",fs_dev_info[i].dev_name,err_code); } // Mount root device. if(fs_root_dev_count > 0) { CSW_TRACE(BASE_BAL_TS_ID,"The FS root device too more:%d.\n",fs_root_dev_count); } else { err_code = FS_MountRoot(NULL); if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"FS MountRoot(%s) OK.\n",fs_dev_info[i].dev_name); } else { CSW_TRACE(BASE_BAL_TS_ID,"FS MountRoot(%s) ERROR, Error code: %d. \n",fs_dev_info[i].dev_name,err_code); } } fs_root_dev_count ++; } } //#ifdef SIM_SWITCH_ENABLE #if 0 // //Add by lixp at 070407 //SimSwitch(UINT8 SimNum) //#define SIM_1 1 //simcard 1 //#define SIM_2 2 //simcard 2 // UINT8 nSIMCARD_INDEX = 0x00; err_code = CFW_CfgGetSimSwitch(&nSIMCARD_INDEX); if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("CFW_CfgGetSimSwitch OK.\n")); } else { CSW_TRACE(BASE_BAL_TS_ID, TSTXT("CFW_CfgGetSimSwitch ERROR, Error code: 0x%08x \n"), err_code); } SimSwitch(nSIMCARD_INDEX); CSW_TRACE(BASE_BAL_TS_ID, TSTXT("nSIMCARD_INDEX is %d\n"),nSIMCARD_INDEX); #endif #ifdef FSTRACE_SUPPORT fsTace_task_create(); #endif #if defined(USER_DATA_CACHE_SUPPORT) && !defined(_T_UPGRADE_PROGRAMMER) err_code = VDS_InitCache(); // Initialize VDS Cache. if(ERR_SUCCESS == err_code) { CSW_TRACE(BASE_BAL_TS_ID,"VDS_InitCache() OK.\n"); } else { CSW_TRACE(BASE_BAL_TS_ID,"VDS_InitCache() ERROR, Error code: %d.\n", err_code); } #endif return TRUE; }
/* * SV_Init * * Only called at plat.exe startup, not for each game */ void SV_Init( void ) { cvar_t *sv_pps; cvar_t *sv_fps; assert( !sv_initialized ); memset( &svc, 0, sizeof( svc ) ); SV_InitOperatorCommands(); sv_mempool = Mem_AllocPool( NULL, "Server" ); Cvar_Get( "sv_cheats", "0", CVAR_SERVERINFO | CVAR_LATCH ); Cvar_Get( "protocol", va( "%i", APP_PROTOCOL_VERSION ), CVAR_SERVERINFO | CVAR_NOSET ); sv_ip = Cvar_Get( "sv_ip", "", CVAR_ARCHIVE | CVAR_LATCH ); sv_port = Cvar_Get( "sv_port", va( "%i", PORT_SERVER ), CVAR_ARCHIVE | CVAR_LATCH ); sv_ip6 = Cvar_Get( "sv_ip6", "::", CVAR_ARCHIVE | CVAR_LATCH ); sv_port6 = Cvar_Get( "sv_port6", va( "%i", PORT_SERVER ), CVAR_ARCHIVE | CVAR_LATCH ); #ifdef TCP_SUPPORT sv_tcp = Cvar_Get( "sv_tcp", "1", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_LATCH ); #endif rcon_password = Cvar_Get( "rcon_password", "", 0 ); sv_hostname = Cvar_Get( "sv_hostname", APPLICATION " server", CVAR_SERVERINFO | CVAR_ARCHIVE ); sv_timeout = Cvar_Get( "sv_timeout", "125", 0 ); sv_zombietime = Cvar_Get( "sv_zombietime", "2", 0 ); sv_enforcetime = Cvar_Get( "sv_enforcetime", "1", 0 ); sv_showclamp = Cvar_Get( "sv_showclamp", "0", 0 ); sv_showRcon = Cvar_Get( "sv_showRcon", "1", 0 ); sv_showChallenge = Cvar_Get( "sv_showChallenge", "0", 0 ); sv_showInfoQueries = Cvar_Get( "sv_showInfoQueries", "0", 0 ); sv_highchars = Cvar_Get( "sv_highchars", "1", 0 ); sv_uploads_baseurl = Cvar_Get( "sv_uploads_baseurl", "", CVAR_ARCHIVE ); sv_uploads_demos_baseurl = Cvar_Get( "sv_uploads_demos_baseurl", "", CVAR_ARCHIVE ); if( dedicated->integer ) { sv_uploads = Cvar_Get( "sv_uploads", "1", CVAR_READONLY ); sv_uploads_from_server = Cvar_Get( "sv_uploads_from_server", "1", CVAR_READONLY ); sv_autoUpdate = Cvar_Get( "sv_autoUpdate", "1", CVAR_ARCHIVE ); sv_pure = Cvar_Get( "sv_pure", "1", CVAR_ARCHIVE | CVAR_LATCH | CVAR_SERVERINFO ); #ifdef PUBLIC_BUILD sv_public = Cvar_Get( "sv_public", "1", CVAR_ARCHIVE | CVAR_LATCH ); #else sv_public = Cvar_Get( "sv_public", "0", CVAR_ARCHIVE | CVAR_LATCH ); #endif } else { sv_uploads = Cvar_Get( "sv_uploads", "1", CVAR_ARCHIVE ); sv_uploads_from_server = Cvar_Get( "sv_uploads_from_server", "1", CVAR_ARCHIVE ); sv_autoUpdate = Cvar_Get( "sv_autoUpdate", "0", CVAR_READONLY ); sv_pure = Cvar_Get( "sv_pure", "0", CVAR_ARCHIVE | CVAR_LATCH | CVAR_SERVERINFO ); sv_public = Cvar_Get( "sv_public", "0", CVAR_ARCHIVE ); } sv_iplimit = Cvar_Get( "sv_iplimit", "3", CVAR_ARCHIVE ); sv_lastAutoUpdate = Cvar_Get( "sv_lastAutoUpdate", "0", CVAR_READONLY|CVAR_ARCHIVE ); sv_pure_forcemodulepk3 = Cvar_Get( "sv_pure_forcemodulepk3", "", CVAR_LATCH ); sv_defaultmap = Cvar_Get( "sv_defaultmap", "wdm1", CVAR_ARCHIVE ); sv_write_defaultmap = Cvar_Get( "sv_write_defaultmap", "0", CVAR_ARCHIVE ); sv_reconnectlimit = Cvar_Get( "sv_reconnectlimit", "3", CVAR_ARCHIVE ); sv_maxclients = Cvar_Get( "sv_maxclients", "8", CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_LATCH ); sv_maxmvclients = Cvar_Get( "sv_maxmvclients", "4", CVAR_ARCHIVE | CVAR_SERVERINFO ); Cvar_Get( "sv_modmanifest", "", CVAR_READONLY ); Cvar_ForceSet( "sv_modmanifest", "" ); // fix invalid sv_maxclients values if( sv_maxclients->integer < 1 ) Cvar_FullSet( "sv_maxclients", "1", CVAR_ARCHIVE|CVAR_SERVERINFO|CVAR_LATCH, qtrue ); else if( sv_maxclients->integer > MAX_CLIENTS ) Cvar_FullSet( "sv_maxclients", va( "%i", MAX_CLIENTS ), CVAR_ARCHIVE|CVAR_SERVERINFO|CVAR_LATCH, qtrue ); sv_demodir = Cvar_Get( "sv_demodir", "", CVAR_NOSET ); if( sv_demodir->string[0] && Com_GlobMatch( "*[^0-9a-zA-Z_@]*", sv_demodir->string, qfalse ) ) { Com_Printf( "Invalid demo prefix string: %s\n", sv_demodir->string ); Cvar_ForceSet( "sv_demodir", "" ); } // wsw : jal : cap client's exceding server rules sv_maxrate = Cvar_Get( "sv_maxrate", "0", CVAR_DEVELOPER ); sv_compresspackets = Cvar_Get( "sv_compresspackets", "1", CVAR_DEVELOPER ); sv_skilllevel = Cvar_Get( "sv_skilllevel", "1", CVAR_SERVERINFO|CVAR_ARCHIVE|CVAR_LATCH ); if( sv_skilllevel->integer > 2 ) Cvar_ForceSet( "sv_skilllevel", "2" ); if( sv_skilllevel->integer < 0 ) Cvar_ForceSet( "sv_skilllevel", "0" ); sv_masterservers = Cvar_Get( "masterservers", DEFAULT_MASTER_SERVERS_IPS, CVAR_LATCH ); sv_debug_serverCmd = Cvar_Get( "sv_debug_serverCmd", "0", CVAR_ARCHIVE ); sv_MOTD = Cvar_Get( "sv_MOTD", "0", CVAR_ARCHIVE ); sv_MOTDFile = Cvar_Get( "sv_MOTDFile", "", CVAR_ARCHIVE ); sv_MOTDString = Cvar_Get( "sv_MOTDString", "", CVAR_ARCHIVE ); SV_MOTD_Update(); // this is a message holder for shared use MSG_Init( &tmpMessage, tmpMessageData, sizeof( tmpMessageData ) ); // init server updates ratio if( dedicated->integer ) sv_pps = Cvar_Get( "sv_pps", "20", CVAR_SERVERINFO|CVAR_NOSET ); else sv_pps = Cvar_Get( "sv_pps", "20", CVAR_SERVERINFO ); svc.snapFrameTime = (int)( 1000 / sv_pps->value ); if( svc.snapFrameTime > 200 ) { // too slow, also, netcode uses a byte Cvar_ForceSet( "sv_pps", "5" ); svc.snapFrameTime = 200; } else if( svc.snapFrameTime < 10 ) { // abusive Cvar_ForceSet( "sv_pps", "100" ); svc.snapFrameTime = 10; } sv_fps = Cvar_Get( "sv_fps", "62", CVAR_NOSET ); svc.gameFrameTime = (int)( 1000 / sv_fps->value ); if( svc.gameFrameTime > svc.snapFrameTime ) { // gamecode can never be slower than snaps svc.gameFrameTime = svc.snapFrameTime; Cvar_ForceSet( "sv_fps", sv_pps->dvalue ); } Com_Printf( "Game running at %i fps. Server transmit at %i pps\n", sv_fps->integer, sv_pps->integer ); //init the master servers list SV_InitMaster(); SV_MM_Init(); ML_Init(); sv_initialized = qtrue; }