diff --git a/source/common/initfs.cpp b/source/common/initfs.cpp index 597c476da..3c566d97c 100644 --- a/source/common/initfs.cpp +++ b/source/common/initfs.cpp @@ -320,13 +320,14 @@ void InitFileSystem(TArray& groups) FString newname = fn + fname; D_AddFile(Files, newname); } + bool insert = (!insertdirectoriesafter && &grp == &groups[0]) || (insertdirectoriesafter && &grp == &groups.Last()); // Add the game's main directory in the proper spot. - if ((i == (insertdirectoriesafter ? 0 : dependencies.Size() - 1)) || grp.FileInfo.loaddirectory) + if (insert) { // Build's original 'file system' loads all GRPs before the first external directory. // Do this only if explicitly requested because this severely limits the usability of GRP files. - if (insertdirectoriesafter && i == 0) for (auto& file : *userConfig.AddFilesPre) + if (insertdirectoriesafter) for (auto& file : *userConfig.AddFilesPre) { D_AddFile(Files, file); } diff --git a/source/common/searchpaths.cpp b/source/common/searchpaths.cpp index 085ff873b..06d67703d 100644 --- a/source/common/searchpaths.cpp +++ b/source/common/searchpaths.cpp @@ -1086,7 +1086,7 @@ const char* G_DefaultConFile(void) if (g_gameType & GAMEFLAG_WW2GI) { - if (fileSystem.FindFile("ww2gi.con")) return "ww2gi.con"; + if (fileSystem.FindFile("ww2gi.con") >= 0) return "ww2gi.con"; } if (g_gameType & GAMEFLAG_SW) @@ -1094,14 +1094,14 @@ const char* G_DefaultConFile(void) if (g_gameType & GAMEFLAG_NAM) { - if (fileSystem.FindFile("nam.def")) return "nam.def"; - if (fileSystem.FindFile("napalm.def")) return "napalm.def"; + if (fileSystem.FindFile("nam.con") >= 0) return "nam.con"; + if (fileSystem.FindFile("napalm.con") >= 0) return "napalm.con"; } if (g_gameType & GAMEFLAG_NAPALM) { - if (fileSystem.FindFile("napalm.def")) return "napalm.def"; - if (fileSystem.FindFile("nam.def")) return "nam.def"; + if (fileSystem.FindFile("napalm.con") >= 0) return "napalm.con"; + if (fileSystem.FindFile("nam.con") >= 0) return "nam.con"; } // the other games only use game.con.