mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2024-11-10 06:31:48 +00:00
added the -f option to /writeconfig
This commit is contained in:
parent
a7e87a065b
commit
952da7c009
5 changed files with 22 additions and 11 deletions
|
@ -4,6 +4,8 @@ See the end of this file for known issues.
|
|||
|
||||
DD Mmm 20 - 1.53
|
||||
|
||||
add: /writeconfig now has a "-f" option to force writing all CVars (whether archived or not)
|
||||
|
||||
add: /imageinfo <imagepath> prints where the image was loaded from and shaders that reference it
|
||||
|
||||
add: /shadermixeduse prints all images referenced in shaders with conflicting global directives
|
||||
|
|
|
@ -105,7 +105,7 @@ qbool com_fullyInitialized;
|
|||
|
||||
static char com_errorMessage[MAXPRINTMSG];
|
||||
|
||||
static void Com_WriteConfigToFile( const char* filename );
|
||||
static void Com_WriteConfigToFile( const char* filename, qbool forceWrite );
|
||||
static void Com_WriteConfig_f();
|
||||
static void Com_CompleteWriteConfig_f( int startArg, int compArg );
|
||||
static const char* Com_GetCompilerInfo();
|
||||
|
@ -354,7 +354,7 @@ 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" );
|
||||
Com_WriteConfigToFile( "q3config.cfg", qfalse );
|
||||
#endif
|
||||
Sys_SaveHistory();
|
||||
|
||||
|
@ -2180,7 +2180,7 @@ static const cmdTableItem_t com_cmds[] =
|
|||
{ "rand", Com_Rand_f },
|
||||
#endif
|
||||
{ "quit", Com_Quit_f, NULL, "closes the application" },
|
||||
{ "writeconfig", Com_WriteConfig_f, Com_CompleteWriteConfig_f, "write the cvars and key binds to a file" }
|
||||
{ "writeconfig", Com_WriteConfig_f, Com_CompleteWriteConfig_f, help_writeconfig }
|
||||
};
|
||||
|
||||
|
||||
|
@ -2350,7 +2350,7 @@ void Com_Init( char *commandLine )
|
|||
//==================================================================
|
||||
|
||||
|
||||
static void Com_WriteConfigToFile( const char* filename )
|
||||
static void Com_WriteConfigToFile( const char* filename, qbool forceWrite )
|
||||
{
|
||||
fileHandle_t f = FS_FOpenFileWrite( filename );
|
||||
if ( !f ) {
|
||||
|
@ -2362,7 +2362,7 @@ static void Com_WriteConfigToFile( const char* filename )
|
|||
#ifndef DEDICATED
|
||||
Key_WriteBindings(f);
|
||||
#endif
|
||||
Cvar_WriteVariables(f);
|
||||
Cvar_WriteVariables( f, forceWrite );
|
||||
FS_FCloseFile( f );
|
||||
}
|
||||
|
||||
|
@ -2371,16 +2371,17 @@ static void Com_WriteConfigToFile( const char* filename )
|
|||
|
||||
static void Com_WriteConfig_f()
|
||||
{
|
||||
if ( Cmd_Argc() != 2 ) {
|
||||
Com_Printf( "Usage: writeconfig <filename>\n" );
|
||||
if ( Cmd_Argc() < 2 ) {
|
||||
Com_Printf( "Usage: writeconfig <filename> [-f]\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
const qbool writeAllVars = Cmd_Argc() >= 3 && !Q_stricmp( Cmd_Argv(2), "-f" );
|
||||
char filename[MAX_QPATH];
|
||||
Q_strncpyz( filename, Cmd_Argv(1), sizeof( filename ) );
|
||||
COM_DefaultExtension( filename, sizeof( filename ), ".cfg" );
|
||||
Com_Printf( "Writing %s.\n", filename );
|
||||
Com_WriteConfigToFile( filename );
|
||||
Com_WriteConfigToFile( filename, writeAllVars );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -62,3 +62,9 @@ S_COLOR_VAL " 2 " S_COLOR_HELP "= JIT-compiled QVM"
|
|||
"max. allowed framerate\n" \
|
||||
"It's highly recommended to only use " S_COLOR_VAL "125 " S_COLOR_HELP "or " S_COLOR_VAL "250 " S_COLOR_HELP "with V-Sync disabled.\n" \
|
||||
"If you see 'connection interruped' with " S_COLOR_VAL "250" S_COLOR_HELP ", set it back to " S_COLOR_VAL "125" S_COLOR_HELP "."
|
||||
|
||||
#define help_writeconfig \
|
||||
"writes CVars and key binds to a file\n" \
|
||||
"Usage: " S_COLOR_CMD "writeconfig " S_COLOR_VAL "<filename> [-f]" S_COLOR_HELP "\n" \
|
||||
S_COLOR_VAL "-f " S_COLOR_HELP "will force writing all CVars,\n" \
|
||||
"whether they're archived or not."
|
||||
|
|
|
@ -1132,10 +1132,12 @@ static void Cvar_Reset_f( void )
|
|||
|
||||
// appends lines containing "seta variable value" for all cvars with the archive flag set
|
||||
|
||||
void Cvar_WriteVariables( fileHandle_t f )
|
||||
void Cvar_WriteVariables( fileHandle_t f, qbool forceWrite )
|
||||
{
|
||||
for (const cvar_t* var = cvar_vars; var; var = var->next) {
|
||||
if ((Q_stricmp( var->name, "cl_cdkey" ) == 0) || !(var->flags & CVAR_ARCHIVE))
|
||||
if (Q_stricmp( var->name, "cl_cdkey" ) == 0)
|
||||
continue;
|
||||
if (!forceWrite && !(var->flags & CVAR_ARCHIVE))
|
||||
continue;
|
||||
// write the latched value, even if it hasn't taken effect yet
|
||||
FS_Printf( f, "seta %s \"%s\"\n", var->name, var->latchedString ? var->latchedString : var->string );
|
||||
|
|
|
@ -570,7 +570,7 @@ qbool Cvar_Command();
|
|||
// called by Cmd_ExecuteString when Cmd_Argv(0) doesn't match a known command
|
||||
// returns true if the command was a variable reference that was handled. (print or change)
|
||||
|
||||
void Cvar_WriteVariables( fileHandle_t f );
|
||||
void Cvar_WriteVariables( fileHandle_t f, qbool forceWrite );
|
||||
// writes lines containing "set variable value" for all variables
|
||||
// with the archive flag set to qtrue.
|
||||
|
||||
|
|
Loading…
Reference in a new issue