* Sys_Dialog for more user friendly error reporting

* (bug #3932) Recovery from bad video settings
This commit is contained in:
Tim Angus 2010-02-15 16:20:33 +00:00
parent 4876413217
commit 005f870ebe
13 changed files with 564 additions and 120 deletions

View file

@ -82,6 +82,7 @@ cvar_t *com_unfocused;
cvar_t *com_maxfpsUnfocused;
cvar_t *com_minimized;
cvar_t *com_maxfpsMinimized;
cvar_t *com_abnormalExit;
cvar_t *com_standalone;
// com_speeds times
@ -237,7 +238,7 @@ void QDECL Com_DPrintf( const char *fmt, ...) {
Com_Error
Both client and server can use this, and it will
do the apropriate things.
do the appropriate thing.
=============
*/
void QDECL Com_Error( int code, const char *fmt, ... ) {
@ -322,7 +323,7 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
com_errorEntered = qfalse;
longjmp (abortframe, -1);
} else {
CL_Shutdown ();
CL_Shutdown (va("Client fatal crashed: %s", com_errorMessage));
SV_Shutdown (va("Server fatal crashed: %s", com_errorMessage));
}
@ -346,7 +347,7 @@ void Com_Quit_f( void ) {
char *p = Cmd_Args( );
if ( !com_errorEntered ) {
SV_Shutdown (p[0] ? p : "Server quit");
CL_Shutdown ();
CL_Shutdown (p[0] ? p : "Client quit");
Com_Shutdown ();
FS_Shutdown(qtrue);
}
@ -2737,6 +2738,7 @@ void Com_Init( char *commandLine ) {
com_maxfpsUnfocused = Cvar_Get( "com_maxfpsUnfocused", "0", CVAR_ARCHIVE );
com_minimized = Cvar_Get( "com_minimized", "0", CVAR_ROM );
com_maxfpsMinimized = Cvar_Get( "com_maxfpsMinimized", "0", CVAR_ARCHIVE );
com_abnormalExit = Cvar_Get( "com_abnormalExit", "0", CVAR_ROM );
com_standalone = Cvar_Get( "com_standalone", "0", CVAR_INIT );
com_introPlayed = Cvar_Get( "com_introplayed", "0", CVAR_ARCHIVE);
@ -2746,6 +2748,18 @@ void Com_Init( char *commandLine ) {
Sys_Init();
if( Sys_WritePIDFile( ) ) {
#ifndef DEDICATED
const char *message = "The last time " CLIENT_WINDOW_TITLE " ran, "
"it didn't exit properly. This may be due to inappropriate video "
"settings. Would you like to start with \"safe\" video settings?";
if( Sys_Dialog( DT_YES_NO, message, "Abnormal Exit" ) == DR_YES ) {
Cvar_Set( "com_abnormalExit", "1" );
}
#endif
}
// Pick a random port value
Com_RandomBytes( (byte*)&qport, sizeof(int) );
Netchan_Init( qport & 0xffff );