int main(int argc, char *argv[]) { uint32 loglevel = 1; DEBUG(loglevel = 3); log_setloglevel(loglevel); EditorEngine::RelocateWorkingDir(); // a pity that this has to be done before opening the log file ... log_prepare("editor_log.txt", "w"); EditorEngine::PrintSystemSpecs(); SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_JOYSTICK); SDL_EnableUNICODE(1); SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); atexit(log_close); atexit(SDL_Quit); mtRandSeed(time(NULL)); EditorEngine editor; editor.HookSignals(); try { editor.InitScreen(320,240,0,SDL_RESIZABLE); editor.SetTitle("Lost Vikings 3 Project - Level Editor"); if(!editor.Setup()) { logerror("Failed to setup editor. Exiting."); editor.UnhookSignals(); return 1; } editor.Run(); } catch(gcn::Exception ex) { editor.UnhookSignals(); logerror("An unhandled gcn::Exception occurred! Infos:"); logerror("File: %s:%u", ex.getFilename().c_str(), ex.getLine()); logerror("Function: %s", ex.getFunction().c_str()); logerror("Message: %s", ex.getMessage().c_str()); } editor.UnhookSignals(); editor.Shutdown(); return 0; }
int main(int argc, char **argv) { SDL_Init(SDL_INIT_NOPARACHUTE | SDL_INIT_JOYSTICK); //Bootstrap::RelocateWorkingDir(); Bootstrap::HookSignals(); log_prepare("game_log.txt", "w"); log_setloglevel(4); Bootstrap::PrintSystemSpecs(); // this should be checked, especially in larger projects if(!ttvfs::checkCompat()) return 1; vfs.LoadFileSysRoot(false); vfs.Prepare(); srand(42); // FIXME: temporary ScriptedEngine that; if(!that.Setup()) { logerror("Failed to setup engine. Exiting."); return 1; } //#ifdef _DEBUG that.InitScreen(800, 600); /*#else const SDL_VideoInfo *info = SDL_GetVideoInfo(); that.InitScreen(info->current_w, info->current_h, 0, 0, true); #endif*/ that.Run(); that.Shutdown(); SDL_Quit(); Bootstrap::UnhookSignals(); return 0; }
int main(int argc, char* argv[]) { try { std::set_new_handler(_new_handler); log_prepare("logfile.txt","a"); logcustom(0,LGREEN,"+----------------------------------+"); logcustom(0,LGREEN,"| (C) 2006-2009 Snowstorm Software |"); logcustom(0,LGREEN,"| http://www.mangosclient.org |"); logcustom(0,LGREEN,"+----------------------------------+"); logcustom(0,GREEN,"Platform: %s",PLATFORM_NAME); logcustom(0,GREEN,"Compiler: %s ("COMPILER_VERSION_OUT")",COMPILER_NAME,COMPILER_VERSION); logcustom(0,GREEN,"Compiled: %s %s",__DATE__,__TIME__); _HookSignals(); MemoryDataHolder::Init(); // 1 instance is enough for now PseuInstanceRunnable *r=new PseuInstanceRunnable(); ZThread::Thread t(r); instanceList.push_back(r); t.setPriority((ZThread::Priority)2); //... t.wait(); //... log_close(); _UnhookSignals(); raise(SIGABRT); // this way to terminate is not nice but the only way to quit the CLI thread raise(SIGQUIT); return 0; } catch (...) { printf("ERROR: Unhandled exception in main thread!\n"); raise(SIGABRT); return 1; } }
/*============================================================================* * log_do_open * *============================================================================*/ PRIVATE int log_do_open(message *m_ptr) { if (log_prepare(m_ptr->DEVICE) == NULL) return(ENXIO); return(OK); }