CFREDApp::CFREDApp() { app_init = 0; #ifndef NDEBUG outwnd_init(); #endif // TODO: add construction code here, // Place all significant initialization in InitInstance }
void test::FSTestFixture::SetUp() { auto currentTest = ::testing::UnitTest::GetInstance()->current_test_info(); pushModDir(currentTest->name()); init_cmdline(); timer_init(); #ifndef NDEBUG outwnd_init(); mprintf(("TEST: Setting up test '%s.%s'\n", currentTest->test_case_name(), currentTest->name())); #endif os_init("Test", "Test"); if (_initFlags & INIT_CFILE) { SCP_string cfile_dir(TEST_DATA_PATH); cfile_dir += DIR_SEPARATOR_CHAR; cfile_dir += "test"; // Cfile expects something after the path if (cfile_init(cfile_dir.c_str())) { FAIL() << "Cfile init failed!"; } if (_initFlags & INIT_MOD_TABLE) { mod_table_init(); // load in all the mod dependent settings } lcl_init(-1); lcl_xstr_init(); if (_initFlags & INIT_MOD_TABLE) { mod_table_init(); // load in all the mod dependent settings } if (_initFlags & INIT_GRAPHICS) { if (!gr_init(nullptr, GR_STUB, 1024, 768)) { FAIL() << "Graphics init failed!"; } if (_initFlags & INIT_FONTS) { font::init(); } } if (_initFlags & INIT_SHIPS) { ship_init(); } } }
// If app_name is NULL or ommited, then TITLE is used // for the app name, which is where registry keys are stored. void os_init(char * wclass, char * title, char *app_name, char *version_string ) { os_init_registry_stuff(Osreg_company_name, title, version_string); strcpy( szWinTitle, title ); strcpy( szWinClass, wclass ); #ifndef NDEBUG outwnd_init(1); #endif InitializeCriticalSection( &Os_lock ); #ifdef THREADED { // Create an condition variable to signal that the window is // created, so that we don't return from this function until the // window is all properly created. os_cv_t Window_created; Window_created.lock(); // Create the thread pthread_create(&ThreadID, NULL, unix_process, &Window_created); // Wait for thread to signal the cv timeval now; timespec wait_time; gettimeofday(&now); wait_time.tv_sec = now.tv_sec + 5; // wait 5 seconds wait_time.tv_nsec = now.tv_usec * 1000; // usec -> msec while (!Window_created.status) { int status = Window_created.wait(&wait_time); if (status == ETIMEDOUT) { mprintf(( "Wait timeout!\n" )); break; } } } #else unix_process1(0); #endif // THREADED // initialized Os_inited = 1; atexit(os_deinit); }
// If app_name is NULL or ommited, then TITLE is used // for the app name, which is where registry keys are stored. void os_init(char * wclass, char * title, char *app_name, char *version_string ) { #ifndef NDEBUG outwnd_init(1); #endif // create default ini entries for the user if (os_config_read_string(NULL, NOX("VideocardFs2open"), NULL) == NULL) os_config_write_string(NULL, NOX("VideocardFs2open"), NOX("OGL -(640x480)x16 bit")); os_init_registry_stuff(Osreg_company_name, title, version_string); strcpy_s( szWinTitle, title ); strcpy_s( szWinClass, wclass ); INITIALIZE_CRITICAL_SECTION( Os_lock ); unix_process(0); // initialized Os_inited = 1; atexit(os_deinit); }