Offer post-crash safe settings on a per-mod basis

Offer to restore settings when loading a mod that crashed, not the first
mod that gets loaded after a crash. Before the first mod loaded (usually
baseq3) would get the option even if missionpack or some other mod crashed.

- Make pid files separate for each fs_game.
- Remove/write pid every time switching fs_game.
- Create path before writing pid file otherwise it fails on first run.
- Show mod description.txt or fs_game instead of engine name in abnormal
  exit message.
- Check com_fullyInitialized in Com_Error before removing PID,
  otherwise "ioquake3 --version" segfaults when accessing fs_gamevar->string
  (plus not fully initialized isn't really a normal shutdown).
This commit is contained in:
Zack Middleton 2016-10-09 16:55:36 -05:00
parent 1246d16834
commit 755b2f38f0
4 changed files with 87 additions and 41 deletions

View file

@ -2776,17 +2776,7 @@ 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
}
Sys_InitPIDFile( FS_GetCurrentGameDir() );
// Pick a random port value
Com_RandomBytes( (byte*)&qport, sizeof(int) );