- Partially resolve issues loading autoexec.cfg files.

* This works for Raze's running directory, but is not pulling in autoexec.cfg files from subdirectories from Raze's running directory (Duke, Duke.Duke) or paths where game content resides (Steam, for instance).
* Partially addresses #110
This commit is contained in:
Mitchell Richters 2020-10-17 12:58:00 +11:00
parent 3582717c43
commit a9ad043c36
2 changed files with 39 additions and 3 deletions

View File

@ -503,6 +503,21 @@ CCMD (whereisini)
FGameConfigFile* GameConfig;
static FString GameName;
//==========================================================================
//
// D_MultiExec
//
//==========================================================================
FExecList *D_MultiExec (FArgs *list, FExecList *exec)
{
for (int i = 0; i < list->NumArgs(); ++i)
{
exec = C_ParseExecFile(list->GetArg(i), exec);
}
return exec;
}
void G_LoadConfig()
{
GameConfig = new FGameConfigFile();
@ -513,6 +528,30 @@ void G_ReadConfig(const char* game)
{
GameConfig->DoGameSetup(game);
GameConfig->DoKeySetup(game);
// Process automatically executed files
FExecList *exec;
FArgs *execFiles = new FArgs;
GameConfig->AddAutoexec(execFiles, game);
exec = D_MultiExec(execFiles, NULL);
delete execFiles;
// Process .cfg files at the start of the command line.
execFiles = Args->GatherFiles ("-exec");
exec = D_MultiExec(execFiles, exec);
delete execFiles;
// [RH] process all + commands on the command line
exec = C_ParseCmdLineParams(exec);
// Actually exec command line commands and exec files.
if (exec != NULL)
{
exec->ExecCommands();
delete exec;
exec = NULL;
}
FBaseCVar::EnableCallbacks();
GameName = game;
}

View File

@ -867,9 +867,6 @@ int RunGame()
I_FatalError("There was a problem initializing the Build engine: %s\n", engineerrstr);
}
auto exec = C_ParseCmdLineParams(nullptr);
if (exec) exec->ExecCommands();
SetupGameButtons();
gameinfo.mBackButton = "engine/graphics/m_back.png";
gi->app_init();