mirror of
https://github.com/ioquake/ioq3.git
synced 2025-05-30 00:20:59 +00:00
* Add con_log.c to log all console output
* Add con_passive.c to cut down on #ifdef DEDICATED in sys_main.c * Add Sys_ErrorDialog to report ERR_FATALs to the user + On Windows use a MessageBox and offer to copy the console log to the clipboard + On everything else print to the terminal and save the console log as crashlog.txt
This commit is contained in:
parent
ccc66aadff
commit
3cde9bf0dc
10 changed files with 340 additions and 95 deletions
|
@ -106,34 +106,6 @@ void Sys_In_Restart_f( void )
|
|||
IN_Init();
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Sys_ConsoleInputInit
|
||||
|
||||
Start the console input subsystem
|
||||
=================
|
||||
*/
|
||||
void Sys_ConsoleInputInit( void )
|
||||
{
|
||||
#ifdef DEDICATED
|
||||
CON_Init( );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Sys_ConsoleInputShutdown
|
||||
|
||||
Shutdown the console input subsystem
|
||||
=================
|
||||
*/
|
||||
void Sys_ConsoleInputShutdown( void )
|
||||
{
|
||||
#ifdef DEDICATED
|
||||
CON_Shutdown( );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Sys_ConsoleInput
|
||||
|
@ -143,11 +115,7 @@ Handle new console input
|
|||
*/
|
||||
char *Sys_ConsoleInput(void)
|
||||
{
|
||||
#ifdef DEDICATED
|
||||
return CON_ConsoleInput( );
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
return CON_Input( );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -159,18 +127,18 @@ Single exit point (regular exit or in case of error)
|
|||
*/
|
||||
void Sys_Exit( int ex )
|
||||
{
|
||||
Sys_ConsoleInputShutdown();
|
||||
CON_Shutdown( );
|
||||
|
||||
#ifndef DEDICATED
|
||||
SDL_Quit( );
|
||||
#endif
|
||||
|
||||
#ifdef NDEBUG
|
||||
exit(ex);
|
||||
exit( ex );
|
||||
#else
|
||||
// Cause a backtrace on error exits
|
||||
assert( ex == 0 );
|
||||
exit(ex);
|
||||
exit( ex );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -179,10 +147,10 @@ void Sys_Exit( int ex )
|
|||
Sys_Quit
|
||||
=================
|
||||
*/
|
||||
void Sys_Quit (void)
|
||||
void Sys_Quit( void )
|
||||
{
|
||||
CL_Shutdown ();
|
||||
Sys_Exit(0);
|
||||
CL_Shutdown( );
|
||||
Sys_Exit( 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -227,7 +195,7 @@ Sys_AnsiColorPrint
|
|||
Transform Q3 colour codes to ANSI escape sequences
|
||||
=================
|
||||
*/
|
||||
static void Sys_AnsiColorPrint( const char *msg )
|
||||
void Sys_AnsiColorPrint( const char *msg )
|
||||
{
|
||||
static char buffer[ MAXPRINTMSG ];
|
||||
int length = 0;
|
||||
|
@ -296,18 +264,8 @@ Sys_Print
|
|||
*/
|
||||
void Sys_Print( const char *msg )
|
||||
{
|
||||
#ifdef DEDICATED
|
||||
CON_Hide();
|
||||
#endif
|
||||
|
||||
if( com_ansiColor && com_ansiColor->integer )
|
||||
Sys_AnsiColorPrint( msg );
|
||||
else
|
||||
fputs(msg, stderr);
|
||||
|
||||
#ifdef DEDICATED
|
||||
CON_Show();
|
||||
#endif
|
||||
CON_LogWrite( msg );
|
||||
CON_Print( msg );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -320,16 +278,13 @@ void Sys_Error( const char *error, ... )
|
|||
va_list argptr;
|
||||
char string[1024];
|
||||
|
||||
#ifdef DEDICATED
|
||||
CON_Hide();
|
||||
#endif
|
||||
|
||||
CL_Shutdown ();
|
||||
|
||||
va_start (argptr,error);
|
||||
Q_vsnprintf (string, sizeof(string), error, argptr);
|
||||
va_end (argptr);
|
||||
fprintf(stderr, "Sys_Error: %s\n", string);
|
||||
|
||||
Sys_ErrorDialog( string );
|
||||
|
||||
Sys_Exit( 1 );
|
||||
}
|
||||
|
@ -348,15 +303,7 @@ void Sys_Warn( char *warning, ... )
|
|||
Q_vsnprintf (string, sizeof(string), warning, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
#ifdef DEDICATED
|
||||
CON_Hide();
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "Warning: %s", string);
|
||||
|
||||
#ifdef DEDICATED
|
||||
CON_Show();
|
||||
#endif
|
||||
CON_Print( va( "Warning: %s", string ) );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -624,9 +571,9 @@ int main( int argc, char **argv )
|
|||
}
|
||||
|
||||
Com_Init( commandLine );
|
||||
NET_Init();
|
||||
NET_Init( );
|
||||
|
||||
Sys_ConsoleInputInit();
|
||||
CON_Init( );
|
||||
|
||||
#ifndef _WIN32
|
||||
// Windows doesn't have these signals
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue