/* ============= Sys_Error Show the early console as an error dialog ============= */ void Sys_Error( const char *error, ... ) { va_list argptr; char text[4096]; MSG msg; va_start( argptr, error ); vsprintf( text, error, argptr ); va_end( argptr); Conbuf_AppendText( text ); Conbuf_AppendText( "\n" ); Win_SetErrorText( text ); Sys_ShowConsole( 1, true ); timeEndPeriod( 1 ); Sys_ShutdownInput(); GLimp_Shutdown(); extern idCVar com_productionMode; if ( com_productionMode.GetInteger() == 0 ) { // wait for the user to quit while ( 1 ) { if ( !GetMessage( &msg, NULL, 0, 0 ) ) { common->Quit(); } TranslateMessage( &msg ); DispatchMessage( &msg ); } } Sys_DestroyConsole(); exit (1); }
/* ============== Sys_Quit ============== */ void Sys_Quit( void ) { timeEndPeriod( 1 ); Sys_ShutdownInput(); Sys_DestroyConsole(); ExitProcess( 0 ); }
/* ================= Sys_Quit ================= */ void Sys_Quit( void ) { Sys_Exit( 0 ); #if defined (_WIN32) && !defined (_DEBUG) Sys_DestroyConsole(); #endif }
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; unsigned int time, oldtime, newtime; // char *cddir; /* previous instances do not exist in Win32 */ if (hPrevInstance) return 0; global_hInstance = hInstance; // done before Com/Sys_Init since we need this for error output Sys_CreateConsole(); // no abort/retry/fail errors SetErrorMode (SEM_FAILCRITICALERRORS); ParseCommandLine (lpCmdLine); FixWorkingDirectory (); // if we find the CD, add a +set cddir xxx command line #if 0 cddir = Sys_ScanForCD (); if (cddir && argc < MAX_NUM_ARGVS - 3) { int i; // don't override a cddir on the command line for (i=0 ; i<argc ; i++) if (!strcmp(argv[i], "cddir")) break; if (i == argc) { argv[argc++] = "+set"; argv[argc++] = "cddir"; argv[argc++] = cddir; } } #endif #ifdef USE_DBGHELP #ifdef _MSC_VER __try { #else __try1( Sys_ExceptionHandler ); #endif #endif /* USE_DBGHELP */ Qcommon_Init (argc, argv); oldtime = Sys_Milliseconds (); //Com_Error (ERR_FATAL, "Testing"); if (dedicated->integer) { Sys_ShowConsole(1, false); } else if(!win_consolelogging->integer) { qDedConsole = false; Sys_DestroyConsole(); } //_controlfp( _PC_24, _MCW_PC ); /* main window message loop */ while (1) { // if at a full screen console, don't update unless needed if (!ActiveApp || dedicated->integer) Sleep (3); while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) { sys_msg_time = msg.time; TranslateMessage(&msg); DispatchMessage(&msg); } do { newtime = Sys_Milliseconds (); time = newtime - oldtime; } while (time < 1); _controlfp( _PC_24, _MCW_PC ); Qcommon_Frame( time ); oldtime = newtime; } #ifdef USE_DBGHELP #ifdef _MSC_VER } __except( Sys_ExceptionHandler( GetExceptionCode(), GetExceptionInformation() ) ) { return 1; } #else __except1; #endif #endif /* USE_DBGHELP */ // never gets here return 0; }
void kexSystem::DestroyInternalConsole(void) { #ifdef _WIN32 Sys_DestroyConsole(); #endif }
void Syscon_Cleanup() { con_redirectOutput(NULL); Sys_DestroyConsole(); }