// 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(const char * wclass, const char * title, const char *app_name, const char *version_string ) { // 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); }