the client executable will now write to q3config.cfg on exit

This commit is contained in:
myT 2018-02-07 06:22:44 +01:00
parent f34c8b5001
commit 6cafc76e87
3 changed files with 15 additions and 4 deletions

View file

@ -6,6 +6,8 @@ add: on Windows, "/crashreport:yes" and "/crashreport:no" command-line arguments
add: the fs_restart command to manually restart the file system
chg: the client executable will now write to q3config.cfg on exit
chg: even lower CPU usage when minimized
chg: during id downloads (cl_allowDownload -1), the time-out is 5 seconds instead of cl_timeout

View file

@ -103,6 +103,7 @@ qbool com_fullyInitialized;
static char com_errorMessage[MAXPRINTMSG];
static void Com_WriteConfigToFile( const char* filename );
static void Com_WriteConfig_f();
static void Com_CompleteWriteConfig_f( int startArg, int compArg );
extern void CIN_CloseAllVideos( void );
@ -336,6 +337,11 @@ void QDECL Com_ErrorExt( int code, int module, qbool realError, const char *fmt,
void Com_Quit( int status )
{
#ifndef DEDICATED
// note that cvar_modifiedFlags's CVAR_ARCHIVE bit is set when a bind is modified
if ( com_frameNumber > 0 && (cvar_modifiedFlags & CVAR_ARCHIVE) != 0 )
Com_WriteConfigToFile( "q3config.cfg" );
#endif
Sys_SaveHistory();
// don't try to shutdown if we are in a recursive error
@ -2262,10 +2268,6 @@ void Com_Init( char *commandLine )
// allocate the stack based hunk allocator
Com_InitHunkMemory();
// if any archived cvars are modified after this, we will trigger a writing
// of the config file
cvar_modifiedFlags &= ~CVAR_ARCHIVE;
//
// init commands and vars
//
@ -2609,6 +2611,12 @@ void Com_Frame( qbool demoPlayback )
}
com_frameNumber++;
// this is here because the platform layer can do more initialization
// work after the Com_Init call and create more archived CVars,
// meaning the config would always be written to on exit
if ( com_frameNumber == 1 )
cvar_modifiedFlags &= ~CVAR_ARCHIVE;
}

View file

@ -585,6 +585,7 @@ extern int cvar_modifiedFlags;
// a single check can determine if any CVAR_USERINFO, CVAR_SERVERINFO,
// etc, variables have been modified since the last check. The bit
// can then be cleared to allow another change detection.
// when a bind is modified, the CVAR_ARCHIVE bit is set
///////////////////////////////////////////////////////////////