Skip to content

Commit

Permalink
Change configuration handling to always execute default.cfg, config.c…
Browse files Browse the repository at this point in the history
…fg again

...but also always execute baseq2/autoexec.cfg, if present.
This hopefully strikes a balance between "user preference" and "properly support mods" -
they may set things in default.cfg that are required to make things work.
  • Loading branch information
res2k committed Apr 12, 2021
1 parent f0d3154 commit 6fbdc98
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/common/files.c
Original file line number Diff line number Diff line change
Expand Up @@ -3690,13 +3690,15 @@ static void fs_game_changed(cvar_t *self)
// otherwise, restart the filesystem
CL_RestartFilesystem(qfalse);

// FIXME: if baseq2/autoexec.cfg exists DO NOT exec default.cfg and config.cfg.
// this assumes user prefers to do configuration via autoexec.cfg and doesn't
// want settings and binds messed up whenever gamedir changes after startup.
if (!FS_FileExistsEx(COM_AUTOEXEC_CFG, FS_TYPE_REAL | FS_PATH_BASE)) {
Com_AddConfigFile(COM_DEFAULT_CFG, FS_PATH_GAME);
Com_AddConfigFile(COM_Q2RTX_CFG, 0);
Com_AddConfigFile(COM_CONFIG_CFG, FS_TYPE_REAL | FS_PATH_GAME);
Com_AddConfigFile(COM_DEFAULT_CFG, FS_PATH_GAME);
Com_AddConfigFile(COM_Q2RTX_CFG, 0);
Com_AddConfigFile(COM_CONFIG_CFG, FS_TYPE_REAL | FS_PATH_GAME);

// If baseq2/autoexec.cfg exists exec it again after default.cfg and config.cfg.
// Assumes user prefers to do configuration via autoexec.cfg and hopefully
// settings and binds will be restored to their preference whenever gamedir changes after startup.
if(Q_stricmp(s, BASEGAME) && FS_FileExistsEx(COM_AUTOEXEC_CFG, FS_TYPE_REAL | FS_PATH_BASE)) {
Com_AddConfigFile(COM_AUTOEXEC_CFG, FS_TYPE_REAL | FS_PATH_BASE);
}

// exec autoexec.cfg (must be a real file within the game directory)
Expand Down

0 comments on commit 6fbdc98

Please sign in to comment.