static int initialise(void) {//======================== int param; int result; // It seems that the wctype functions don't work until the locale has been set // to something other than the default "C". Then, not only Latin1 but also the // other characters give the correct results with iswalpha() etc. #ifdef PLATFORM_RISCOS setlocale(LC_CTYPE,"ISO8859-1"); #else #if 0 if(setlocale(LC_CTYPE,"en_US.UTF-8") == NULL) { if(setlocale(LC_CTYPE,"UTF-8") == NULL) setlocale(LC_CTYPE,""); } #endif #endif WavegenInit(22050,0); // 22050 if((result = LoadPhData()) != 1) { if(result == -1) { fprintf(stderr,"Failed to load espeak-data\n"); exit(1); } else fprintf(stderr,"Wrong version of espeak-data 0x%x (expects 0x%x) at %s\n",result,version_phdata,path_home); } LoadConfig(); SetVoiceStack(NULL); SynthesizeInit(); for(param=0; param<N_SPEECH_PARAM; param++) param_stack[0].parameter[param] = param_defaults[param]; return(0); }
int InitTic(void) { FILE *fil; memset(&tic, 0, sizeof(tic)); memset(&fgroup, 0, sizeof(fgroup)); LoadConfig(); sysstart = -1; snprintf(tic_fil, PATH_MAX -1, "%s/etc/tic.data", getenv("MBSE_ROOT")); if ((fil = fopen(tic_fil, "r")) == NULL) return FALSE; fread(&tichdr, sizeof(tichdr), 1, fil); fseek(fil, 0, SEEK_END); tic_cnt = (ftell(fil) - tichdr.hdrsize) / (tichdr.recsize + tichdr.syssize); fclose(fil); snprintf(tgrp_fil, PATH_MAX -1, "%s/etc/fgroups.data", getenv("MBSE_ROOT")); return TRUE; }
BOOL CImagePack::OnInitDialog() { CDialog::OnInitDialog(); // TODO: 在此添加额外的初始化 m_MaxWEdit.SetWindowText("1024"); m_MaxHEdit.SetWindowText("1024"); m_SpaceEdit.SetWindowText("1"); GetDlgItem(IDOK)->SetFocus(); m_listType.SetCurSel(1); m_HistoryCombo.LimitText(MAX_PATH); m_pDCCombo = m_HistoryCombo.GetDC(); m_pFontCombo = m_HistoryCombo.GetFont(); m_pOldFontCombo = m_pDCCombo->SelectObject(m_pFontCombo); m_pDCCombo->GetTextMetrics(&m_tmCombo); m_nExtendWidth = ::GetSystemMetrics(SM_CXVSCROLL) + 2*::GetSystemMetrics(SM_CXEDGE); LoadConfig(); return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE }
// Called before render is available bool j1App::Awake() { bool ret = LoadConfig(); if (ret == true) { p2List_item<j1Module*>* item; item = modules.start; while (item != NULL && ret == true) { // TODO 1: Every awake to receive a xml node with their section of the config file if exists ret = item->data->Awake(config.child(item->data->name.GetString())); item = item->next; } } return ret; }
INT_PTR MainDlg::OnLoadProfile( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) { std::wstring path; #ifdef USE64 if (OpenSaveDialog( L"Xenos profiles (*.xpr64)\0*.xpr64\0", 1, path )) #else if (OpenSaveDialog( L"Xenos profiles (*.xpr)\0*.xpr\0", 1, path )) #endif { // Reset loaded images _profileMgr.config().images.clear(); _images.clear(); _modules.reset(); _exports.clear(); LoadConfig( path ); _status.SetText( 0, blackbone::Utils::StripPath( path ) ); } return TRUE; }
bool Graphics::Initialise(void) /* Initialises the graphics engine with the configuration in graphics.config */ { while (running){ // Possible freeze spot if renderloop stops responding if (!locked && !kill) { locked = true; kill = true; locked = false; } Delay(); } LoadConfig(); SDL_Init(INIT_FLAGS); SDL_SetVideoMode(res.x, res.y, 0, VIDEO_FLAGS); LoadAssets(); // Need to start renderloop thread }
// Called before render is available bool j1App::Awake() { bool ret = LoadConfig(); // self-config title.create(app_config.child("title").child_value()); organization.create(app_config.child("organization").child_value()); if(ret == true) { p2List_item<j1Module*>* item; item = modules.start; while(item != NULL && ret == true) { const char* debug = item->data->name.GetString(); ret = item->data->Awake(config.child(item->data->name.GetString())); item = item->next; } } return ret == true; }
void ToastEngine::run() { g_config = new (std::nothrow)toast::SystemConfig; LoadConfig(Daemon::Instance()->config); int lastTime = time(NULL); // initlize global varables Initlize(); // Create agent response thread; g_agent_response_threads = MultiWorkQueueThreadPool::Create(g_config->num_response_process_threads, NULL); CreateFunctionalThreads(); Log::Debug("All the thread created " ); while(false==Daemon::Instance()->IsStop()) { int now = time(NULL); usleep(1000000); } KillThreads(m_OtherThreadPool); }
cPreMenu::cPreMenu(cInit *apInit) : iUpdateable("PreMenu") { mpInit = apInit; mpDrawer = mpInit->mpGame->GetGraphics()->GetDrawer(); //Load fonts mpFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("verdana.fnt"); mpTextFont = mpInit->mpGame->GetResources()->GetFontManager()->CreateFontData("font_computer.fnt"); //Load config file LoadConfig(); //Load text tWString sText = kTranslate("MainMenu", "PreMenuText"); mpTextFont->GetWordWrapRows(750, 19,17,sText,&mvTextRows); mlMaxChars =0; for(size_t i=0; i < mvTextRows.size(); ++i) mlMaxChars += (int)mvTextRows[i].length(); Reset(); }
int main ( int argc, char **argv ) { cmdline.Decipher(argc,argv); LoadConfig(); OUTPUT("Initializing server.\n"); // This has to be here so broken connections don't end the application. signal( SIGPIPE, SIG_IGN ); if ( signal( SIGINT, signal_handler ) == SIG_ERR ) { OUTPUT("Unable to capture SIGINT - Ctrl-C will cause hard shutdown\n"); } int main_port=cfg.integer("paths","main"); if ( !cfg.found ) main_port=3333; int rwho_port=cfg.integer("paths","rwho"); if ( !cfg.found ) rwho_port=0; int aux_port =cfg.integer("paths","aux" ); if ( !cfg.found ) aux_port=0; if ( signalled_abort ) return 0; server = new Server( rwho_port, main_port, aux_port ); while ( !server->shutdown ) { timekeeper.Between(); server->Between(); } OUTPUT("Shutting down.\n"); server->Shutdown(); return 0; }
bool AuctionBotBuyer::Initialize() { LoadConfig(); bool activeHouse = false; for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i) { if (_houseConfig[i].BuyerEnabled) { activeHouse = true; break; } } if (!activeHouse) return false; // load Check interval _checkInterval = sAuctionBotConfig->GetConfig(CONFIG_AHBOT_BUYER_RECHECK_INTERVAL) * MINUTE; TC_LOG_DEBUG("ahbot", "AHBot buyer interval is %u minutes", _checkInterval / MINUTE); return true; }
/* -----------------------------------------------------------------------------*/ Boolean OpenSynth() { DriverDataPtr data = GetData (); /* use MidiShare audio buffer size*/ data->buffersize = LoadBufferSize(); data->soundfont = LoadConfig("Configuration", "SoundFont", GetProfileFullName(kProfileName),kDefaultSoundFont); if (open_iiwusynth()) { LoadSlot ("Output Slots", GetProfileFullName(kProfileName),SynthDriverName); return true; }else { /* tries to use default soundfont */ data->soundfont = kDefaultSoundFont; if (open_iiwusynth()) { LoadSlot ("Output Slots", GetProfileFullName(kProfileName),SynthDriverName); return true; }else{ return false; } } }
Game::Game() : panel_(ControlPanel::GetInstance()), message_(GET_BITMAP_FONT("retro")), controller_(InputController::GetInstance()) { Log::SetLogger(new LogDebug()); LoadConfig(CONFIG_FILE); app_.Create(sf::VideoMode(APP_WIDTH, APP_HEIGHT, APP_BPP), APP_TITLE, APP_STYLE); app_.SetFramerateLimit(options_.fps); const sf::Image& icon = GET_IMG("icon"); app_.SetIcon(icon.GetWidth(), icon.GetHeight(), icon.GetPixelsPtr()); #ifndef NO_SPLASH Splash splash(app_); if (!splash.Run()) { exit(EXIT_SUCCESS); } #endif #ifdef CONSOLE_TEST log_ = new LogConsole(); Log::SetLogger(log_); #endif if (options_.panel_on_top) { map_.SetPosition(0, ControlPanel::HEIGHT_PX); } else { panel_.SetPosition(0, Zone::HEIGHT_PX); } option_win_ = new Option; }
int aisradar_pi::Init(void) { AddLocaleCatalog( _T("opencpn-aisradar_pi") ); m_radar_frame_x = m_radar_frame_y = 0; m_radar_frame_sx = m_radar_frame_sy = 200; m_pRadarFrame = 0; m_lat= m_lon=0.; m_cog= m_sog=0.; m_sats=0; ::wxDisplaySize(&m_display_width, &m_display_height); m_pconfig = GetOCPNConfigObject(); LoadConfig(); if (AisTargets) { // Init may be called more than once, check for cleanup WX_CLEAR_ARRAY(*AisTargets); delete AisTargets; } AisTargets = GetAISTargetArray(); m_parent_window = GetOCPNCanvasWindow(); if(m_radar_show_icon) { m_leftclick_tool_id = InsertPlugInTool(_T(""), _img_radar, _img_radar, wxITEM_NORMAL, wxString::Format(_T("AIS Radar View %d.%d"), PLUGIN_VERSION_MAJOR, PLUGIN_VERSION_MINOR ), _T(""), 0, RADAR_TOOL_POSITION, 0, this ); } return (WANTS_TOOLBAR_CALLBACK | INSTALLS_TOOLBAR_TOOL | WANTS_CONFIG | WANTS_PREFERENCES | WANTS_AIS_SENTENCES | WANTS_NMEA_EVENTS | WANTS_PLUGIN_MESSAGING | USES_AUI_MANAGER ); }
int main (int argc, char **argv) { /* Save our program name - for error messages */ set_DeadPipe_handler(DeadPipe); InitMyApp (CLASS_AUDIO, argc, argv, NULL, NULL, 0 ); LinkAfterStepConfig(); ConnectX( ASDefaultScr, PropertyChangeMask ); ConnectAfterStep ( mask_reg, 0 ); Config = CreateAudioConfig(); LOCAL_DEBUG_OUT("parsing Options ...%s",""); LoadBaseConfig (GetBaseOptions); LoadColorScheme(); LoadConfig ("audio", GetOptions); #ifdef HAVE_RPLAY_H memset( rplay_table, 0x00, sizeof(RPLAY *)*MAX_SOUNDS); #endif memset( sound_table, 0x00, sizeof(char *)*MAX_SOUNDS); if (!SetupSound ()) { show_error("Failed to initialize sound playing routines. Please check your config."); return 1; } /* * Play the startup sound. */ audio_play (EVENT_Startup); SendInfo ( "Nop", 0); HandleEvents(); return 0; }
int main(int argc, char* argv[]) { PTaskInfo task_list; int task_num = 0; int monitor_tick = 0; if(!LoadConfig(task_list, task_num, monitor_tick)) { return -1; } // output printf("monitoring every %d second...", monitor_tick); while(1) { for(int i = 0; i<task_num; i++) { getProcMemoryUsage(task_list[i]); } Sleep(monitor_tick * 500); } return 0; }
void MainFrame::OnBtnFileDstClick(wxCommandEvent& /*event*/) { wxString filename = FileSelector(); if (filename.IsEmpty() || SameConfig(filename, txtFileSrc)) return; if (!LoadConfig(filename, &mCfgDst) || !mCfgDst) { wxMessageBox(wxT("Hint: To backup (export) your configuration use the \"Export\" button,\n" "to transfer to an existing (valid Code::Blocks) configuration file,\n" "use the \"Transfer\" button."), wxT("Information"), wxICON_INFORMATION | wxOK); mCfgDstValid = false; return; } mFileDst = filename; txtFileDst->SetValue(filename); mCfgDstValid = true; // put configuration to wxListBox OfferConfig(mCfgDst, lstCfgDst, &mNodesDst); }// OnBtnFileDstClick
TacticsInstrument_BearingCompass::TacticsInstrument_BearingCompass(wxWindow *parent, wxWindowID id, wxString title, int cap_flag) : TacticsInstrument_Dial(parent, id, title, cap_flag, 0, 360, 0, 360) { SetOptionMarker(5, DIAL_MARKER_SIMPLE, 2); SetOptionLabel(20, DIAL_LABEL_ROTATED); SetOptionMainValue(_T("%.0f"), DIAL_POSITION_INSIDE); // Get a pointer to the opencpn configuration object m_pconfig = GetOCPNConfigObject(); LoadConfig(); m_Bearing = NAN; m_lat = NAN; m_lon = NAN; m_CurrDir = NAN; m_CurrSpeed = NAN; m_ExtraValueDTW = NAN; m_MainValue = NAN; m_Leeway = 0; m_AngleStart = 0; m_ExpSmoothDegRange = 0; mExpSmDegRange = new ExpSmooth(g_dalphaDeltCoG); m_Cog = -999; m_Hdt = -999; m_diffCogHdt = 0; m_predictedSog = NAN; m_TWA = NAN; m_AWA = -999; m_TWS = NAN; m_TWD = NAN; m_StW = 0.0; m_ToWpt = _T("---"); alpha_diffCogHdt = 0.1; m_ExpSmoothDiffCogHdt = 0; m_oldExpSmoothDiffCogHdt = 0; for (int i = 0; i < COGRANGE; i++) m_COGRange[i] = 0; }
CMasterServerConfig::CMasterServerConfig() { const char* group = "MasterServer"; if(_access(configFile, 0) != 0) { r3dError("can't open config file %s\n", configFile); } maxrent = r3dReadCFG_I(configFile, group, "MaxRent",0); masterPort_ = r3dReadCFG_I(configFile, group, "masterPort", SBNET_MASTER_PORT); clientPort_ = r3dReadCFG_I(configFile, group, "clientPort", GBNET_CLIENT_PORT); masterCCU_ = r3dReadCFG_I(configFile, group, "masterCCU", 3000); supervisorCoolDownSeconds_ = r3dReadCFG_F(configFile, group, "supervisorCoolDownSeconds", 15.0f); #define CHECK_I(xx) if(xx == 0) r3dError("missing %s value in %s", #xx, configFile); #define CHECK_S(xx) if(xx == "") r3dError("missing %s value in %s", #xx, configFile); CHECK_I(masterPort_); CHECK_I(clientPort_); #undef CHECK_I #undef CHECK_S serverId_ = r3dReadCFG_I(configFile, group, "serverId", 0); if(serverId_ == 0) { MessageBox(NULL, "you must define serverId in MasterServer.cfg", "", MB_OK); r3dError("no serverId"); } if(serverId_ > 255 || serverId_ < 1) { MessageBox(NULL, "bad serverId", "", MB_OK); r3dError("bad serverId"); } LoadConfig(); return; }
bool ZConfiguration::Load() { bool retValue; // Config 는 외부 파일도 읽을수 있도록....외부파일들은 개별 지정해야 함.. #ifdef _PUBLISH ////MZFile::SetReadMode( MZIPREADFLAG_ZIP | MZIPREADFLAG_MRS | MZIPREADFLAG_MRS2 | MZIPREADFLAG_FILE ); #endif //ZGetLocale()->Init(DEFAULT_COUNTRY); if ( !LoadLocale(FILENAME_LOCALE) ) { mlog( "Cannot open %s file.\n", FILENAME_LOCALE); return false; } retValue = LoadConfig(FILENAME_CONFIG); // 넷마블 버전은 구분해야함... 넷마블 버전은 MZIPREADFLAG_MRS1 도 읽어야함... #ifdef _PUBLISH ////MZFile::SetReadMode( MZIPREADFLAG_MRS2 ); #endif if ( !LoadSystem(FILENAME_SYSTEM)) { mlog( "Cannot open %s file.\n", FILENAME_SYSTEM); return false; } if ( !retValue) return false; return retValue; }
//로그 객체는 가장 먼저 만들고 가장 나중에 해제할 것 ERROR_CODE Main::Init() { m_pLogger = std::make_unique<ConsoleLog>(); LoadConfig(); m_pNetwork = std::make_unique<NServerNetLib::TcpNetwork>(); auto result = m_pNetwork->Init(m_pServerConfig.get(), m_pLogger.get()); if (result != NET_ERROR_CODE::NONE) { m_pLogger->Write(LOG_TYPE::L_ERROR, "%s | Init Fail. NetErrorCode(%s)", __FUNCTION__, (short)result); return ERROR_CODE::MAIN_INIT_NETWORK_INIT_FAIL; } //접속한 클라이언트의 정보 관리 (로그인 정보 등) m_pUserMgr = std::make_unique<UserManager>(); m_pUserMgr->Init(m_pServerConfig->MaxClientCount); //방 객체 관리 (room은 lobby안에) m_pLobbyMgr = std::make_unique<LobbyManager>(); m_pLobbyMgr->Init({ m_pServerConfig->MaxLobbyCount, m_pServerConfig->MaxLobbyUserCount, m_pServerConfig->MaxRoomCountByLobby, m_pServerConfig->MaxRoomUserCount }, m_pNetwork.get(), m_pLogger.get()); //패킷이 만들어지면 가져와서 처리 m_pPacketProc = std::make_unique<PacketProcess>(); m_pPacketProc->Init(m_pNetwork.get(), m_pUserMgr.get(), m_pLobbyMgr.get(), m_pLogger.get()); m_IsRun = true; m_pLogger->Write(LOG_TYPE::L_INFO, "%s | Init Success. Server Run", __FUNCTION__); return ERROR_CODE::NONE; }
void wxJigsawEditorMainFrame::Init() { m_ShapeRegistry = new wxJigsawShapeList; m_Config = NULL; m_ShapeRegistry->DeleteContents(true); InitConfigSerialization(); /*m_Config->GetShapesLookupDirectories().Add(wxT(".")); m_Config->GetShapesLookupDirectories().Add(wxT("shapes")); SaveConfig();*/ LoadConfig(); LoadPalettes(); LoadShapeRegistry(); ////@begin wxJigsawEditorMainFrame member initialisation m_ScaleValue = 100; m_ScaleSlider = NULL; m_SearchTextCtrl = NULL; m_CategoryList = NULL; m_Palette = NULL; m_Canvas = NULL; ////@end wxJigsawEditorMainFrame member initialisation }
/************************************************************************ * 构造函数 ************************************************************************/ GameLogic::GameLogic() { m_bInit = false; m_pMainScene = 0; m_pNetwork = 0; if (m_pNetwork == 0) { m_pNetwork = new NetworkMoudle(); } m_Player = new Player; m_nGameType = INVALID_GAME_TYPE; m_nSuspendState = NOT_SUSPEND; LoadConfig(); }
int iacfleet_pi::Init( void ) { AddLocaleCatalog( _T("opencpn-iacfleet_pi") ); // And load the configuration items LoadConfig(); // This PlugIn needs a toolbar icon, so request its insertion if enabled locally #ifdef IACFLEET_USE_SVG m_leftclick_tool_id = InsertPlugInToolSVG( _T( "IACFleet" ), _svg_iacfleet, _svg_iacfleet_rollover, _svg_iacfleet_toggled, wxITEM_CHECK, _( "IACFleet" ), _T( "" ), NULL, IACFLEET_TOOL_POSITION, 0, this); #else m_leftclick_tool_id = InsertPlugInTool(_T(""), _img_iacfleet_pi, _img_iacfleet_pi, wxITEM_NORMAL, _("IACFleet"), _T(""), NULL, IACFLEET_TOOL_POSITION, 0, this); #endif return (WANTS_OVERLAY_CALLBACK | WANTS_OPENGL_OVERLAY_CALLBACK | WANTS_CURSOR_LATLON | WANTS_TOOLBAR_CALLBACK | INSTALLS_TOOLBAR_TOOL | WANTS_CONFIG ); }
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch(uMsg) { case WM_INITDIALOG: LoadConfig(); if (conf.Log) CheckDlgButton(hW, IDC_LOGGING, TRUE); return TRUE; case WM_COMMAND: switch(LOWORD(wParam)) { case IDCANCEL: EndDialog(hW, TRUE); return TRUE; case IDOK: if (IsDlgButtonChecked(hW, IDC_LOGGING)) conf.Log = 1; else conf.Log = 0; SaveConfig(); EndDialog(hW, FALSE); return TRUE; } } return FALSE; }
Ztamp::Ztamp(QByteArray const& ztampID) { // Check ztamps folder QDir ztampsDir = QDir(QCoreApplication::applicationDirPath()); if (!ztampsDir.cd("ztamps")) { if (!ztampsDir.mkdir("ztamps")) { LogError("Unable to create ztamps directory !\n"); exit(-1); } ztampsDir.cd("ztamps"); } id = ztampID; configFileName = ztampsDir.absoluteFilePath(ztampID.toHex()+".dat"); // Check if config file exists and load it if (QFile::exists(configFileName)) LoadConfig(); saveTimer = new QTimer(this); connect(saveTimer, SIGNAL(timeout()), this, SLOT(SaveConfig())); saveTimer->start(5*60*1000); // 5min }
// Called before render is available bool j1App::Awake() { bool ret = false; //We load the config node, that is the rood node of config_xml config = LoadConfig(); if (config.empty() == false) { ret = true; title.create(config.child("app").child("title").child_value()); creator.create(config.child("app").child("creator").child_value()); } p2List_item<j1Module*>* item; item = modules.start; while(item != NULL && ret == true) { ret = item->data->Awake(config.child(item->data->name.GetString())); item = item->next; } return ret; }
UINT32 FunLStart( EVENT_STACK_T *ev_st, REG_ID_T reg_id, UINT32 param2 ) { APP_FUNL_T *app = NULL; UINT32 status = RESULT_OK; app = (APP_FUNL_T*)APP_InitAppData( (void *)APP_HandleEvent, sizeof(APP_FUNL_T), reg_id, 0, 1, 1, 2, 0, 0 ); status = APP_Start( ev_st, &app->apt, HW_STATE_MAIN, state_handling_table, FunLExit, app_name, 0 ); LoadConfig( ); return RESULT_OK; }
MainLoop::MainLoop( Level* l, Player* p ): level(l), player(p), use_mouse(false), renderer(NULL), sound_system(NULL) { key_forward= 'W'; key_back= 'S'; key_left= 'A'; key_right= 'D'; mouse_speed= 1.0f; screen_x= 1024; screen_y= 768; LoadConfig(); current_main_loop= this; for( int i= 0; i< 256; i++ ) keys[i]= false; mouse_keys[0]= mouse_keys[1]= false; InitOGL(); GetGLFunctions(); SetupOGLState(); renderer= new Renderer( level, player ); int t0= clock(); renderer->Init(); int dt= clock() - t0; const int delay= CLOCKS_PER_SEC*3; if( dt < delay ) #ifdef MW_OS_WINDOWS Sleep( (delay-dt)*1000/CLOCKS_PER_SEC ); #else usleep( (delay-dt)*1000000/CLOCKS_PER_SEC ); #endif }
CConfigIni::CConfigIni(){LoadConfig(NULL);}