int main( int argc , char** argv, char** env ) { if(attestation()<1) { print("无法通过正版验证!具体请联系购买者!\n"); exit(0); } #ifdef _ONLINENUM_FIX system("ulimit -HSn 2048"); #endif /* 午曰丐尹内凛棉毛涩烂仄化云仁 */ setNewTime(); /* if ( argc > 1 && 0==strcmp(argv[1],"-v")) { printf("%s",genver); exit(0); } else fprintf(stderr,"%s",genver);*/ readconfigfile(getConfigfilename()); EXITWITHEXITCODEIFFALSE( util_Init() , 1); LoadAnnounce(); // Arminius 7.12 loginannounce /* 赓渝涩烂 */ memcpy( &tmOld, localtime( (time_t *)&NowTime.tv_sec), sizeof( tmNow ) ); sasql_init(); EXITWITHEXITCODEIFFALSE( init(argc , argv ,env ) , 1); sasql_online(NULL,NULL,NULL,NULL,NULL,3); LoadPetTalk(); // Arminius 8.14 pet talk #ifdef _GAMBLE_BANK Load_GambleBankItems(); #endif #ifdef _CFREE_petskill Load_PetSkillCodes(); #endif #ifdef _ITEM_PILEFORTRADE TRADE_InitTradeList(); #endif mainloop(); return 0; }
/* Pone en funcionamiento el TIMER y la salida de comparación * FUNCION GENERADORA DE SEÑAL PWM */ void Soft_PWM::run(void) { /* Se prepara la mascara de señales para esperar la señal del timer */ sigemptyset(&signal_set); sigaddset(&signal_set,get_Signum()); sigprocmask(SIG_SETMASK, &signal_set, NULL);// SIG_SETMASK->termina la llamada, otro controlador puede invocarse signal(get_Signum(),dummy); //Explicacion en la funcion dummy /* Se crea un hilo desde este mismo objeto, que correra una funcion miembro * la cual tiene acceso a los miembros de la clase */ thread_calculate = thread(&Soft_PWM::calculate, this); /* Se dispara el Timer y empieza tod.....*/ setNewTime(0,us_resolution*1000); }
void mainloop( void ) { print("初始化NPC..."); NPC_generateLoop( 1 ); print("完成\n"); print("初始化signal1..."); signal(SIGUSR1,sigusr1); print("完成\n"); print("初始化signal2..."); signal(SIGUSR2,sigusr2); print("完成\n"); #ifdef _MAP_WARPPOINT print("初始化地图传送点..."); MAPPOINT_InitMapWarpPoint(); print("完成\n"); if( !MAPPOINT_loadMapWarpPoint() ){ return; } #endif #ifdef _ASSESS_SYSEFFICACY Assess_InitSysEfficacy(); #endif #ifdef _CHATROOMPROTOCOL // (不可开) Syu ADD 聊天室频道 print("初始化聊天室频..."); InitChatRoom(); print("完成\n"); #endif #ifdef _CHANNEL_MODIFY print("初始化职业频道..."); if(!InitOccChannel()) return; // 初始化职业频道 print("完成\n"); #endif #ifdef _ANGEL_SUMMON print("初始化精灵召奂时间..."); AngelReady = 0; #ifdef _ANGEL_TIME AngelNextTime = time(NULL) + getAngelPlayerTime(); #else AngelNextTime = time(NULL) + 1*60; #endif print("完成\n"); #endif #ifdef _JZ_NEWSCRIPT_LUA print("初始化LNS引擎..."); NPC_Lua_Init(getLuaFile()); print("完成\n"); #endif //#ifdef _ALLDOMAN // print("初始化英雄表列..."); // InitHeroList(); // print("完成\n"); //#endif int itime=0; while(1){ if(getCpuUse()!=-1){ itime++; if(itime>getCpuUse()){ itime=0; usleep(1); } } #ifdef _ASSESS_SYSEFFICACY Assess_SysEfficacy( 0 ); #endif setNewTime(); memcpy(&tmNow, localtime( (time_t *)&NowTime.tv_sec), sizeof( tmNow ) ); if( tmOld.tm_hour != getLogHour( ) && tmNow.tm_hour == getLogHour( ) ){ #ifdef _GMSV_DEBUG DebugMainFunction="backupAllLogFile"; #endif backupAllLogFile( &tmOld ); } setNewTime(); pthread_t tid1; #ifdef _ASSESS_SYSEFFICACY_SUB //显示LOOP时间 //Assess_SysEfficacy_sub( 0, 1); //#ifdef _GMSV_DEBUG // DebugMainFunction="netloop_faster"; //#endif // netloop_faster(); //Assess_SysEfficacy_sub( 1, 1); pthread_create(&tid1, NULL, net_battle_loop, NULL); Assess_SysEfficacy_sub( 0, 2); #ifdef _GMSV_DEBUG DebugMainFunction="NPC_generateLoop"; #endif NPC_generateLoop( 0 ); Assess_SysEfficacy_sub( 1, 2); //Assess_SysEfficacy_sub( 0, 3); //#ifdef _GMSV_DEBUG // DebugMainFunction="BATTLE_Loop"; //#endif // BATTLE_Loop(); //Assess_SysEfficacy_sub( 1, 3); Assess_SysEfficacy_sub( 0, 4); #ifdef _GMSV_DEBUG DebugMainFunction="CHAR_Loop"; #endif CHAR_Loop(); Assess_SysEfficacy_sub( 1, 4); pthread_join(tid1,NULL); #ifdef _GMSV_DEBUG DebugMainFunction="PETMAIL_proc"; #endif PETMAIL_proc(); #ifdef _GMSV_DEBUG DebugMainFunction="family_proc"; #endif family_proc(); #ifdef _GMSV_DEBUG DebugMainFunction="chardatasavecheck"; #endif chardatasavecheck(); #ifdef _GMSV_DEBUG DebugMainFunction="AngelReadyProc"; #endif AngelReadyProc(); tmOld = tmNow; if( tmOld.tm_sec != tmNow.tm_sec ) { #ifdef _GMSV_DEBUG DebugMainFunction="CHAR_checkEffectLoop"; #endif CHAR_checkEffectLoop(); } if( SERVSTATE_getShutdown()> 0 ) { ShutdownProc(); #ifdef _GMSV_DEBUG DebugMainFunction="ShutdownProc"; #endif } tmOld = tmNow; #ifdef _ASSESS_SYSEFFICACY Assess_SysEfficacy( 1 ); #endif #endif } }