diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index b9a8ae5d02..9b9cb7f7d7 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -263,6 +263,8 @@ void FIWadManager::ParseIWadInfo(const char *fn, const char *data, int datasize, // Look for IWAD definition lump // //========================================================================== +extern const char* iwad_folders[13]; +extern const char* iwad_reserved[12]; FIWadManager::FIWadManager(const char *firstfn, const char *optfn) { @@ -352,7 +354,13 @@ int FIWadManager::CheckIWADInfo(const char* fn) { FileSystem check; - check.InitSingleFile(fn, true); + LumpFilterInfo lfi; + for (auto p : iwad_folders) lfi.reservedFolders.Push(p); + for (auto p : iwad_reserved) lfi.requiredPrefixes.Push(p); + + TArray filenames; + filenames.Push(fn); + check.InitMultipleFiles(filenames, true, &lfi); if (check.GetNumEntries() > 0) { int num = check.CheckNumForName("IWADINFO"); diff --git a/src/d_main.cpp b/src/d_main.cpp index 70a95aa05f..163c9824f0 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -184,6 +184,9 @@ extern bool M_DemoNoPlay; // [RH] if true, then skip any demos in the loop extern bool insave; extern TDeletingArray LightDefaults; +const char* iwad_folders[13] = { "flats/", "textures/", "hires/", "sprites/", "voxels/", "colormaps/", "acs/", "maps/", "voices/", "patches/", "graphics/", "sounds/", "music/" }; +const char* iwad_reserved[12] = { "mapinfo", "zmapinfo", "gameinfo", "sndinfo", "sbarinfo", "menudef", "gldefs", "animdefs", "decorate", "zscript", "iwadinfo" "maps/" }; + CUSTOM_CVAR(Float, i_timescale, 1.0f, CVAR_NOINITCALL) { @@ -1850,8 +1853,12 @@ static FString CheckGameInfo(TArray & pwads) { FileSystem check; + LumpFilterInfo lfi; + for (auto p : iwad_folders) lfi.reservedFolders.Push(p); + for (auto p : iwad_reserved) lfi.requiredPrefixes.Push(p); + // Open the entire list as a temporary file system and look for a GAMEINFO lump. The last one will automatically win. - check.InitMultipleFiles(pwads, true); + check.InitMultipleFiles(pwads, true, &lfi); if (check.GetNumEntries() > 0) { int num = check.CheckNumForName("GAMEINFO"); @@ -2989,11 +2996,8 @@ static int D_DoomMain_Internal (void) } lfi.gameTypeFilter.Push(FStringf("game-%s", GameTypeName())); - static const char* folders[] = { "flats/", "textures/", "hires/", "sprites/", "voxels/", "colormaps/", "acs/", "maps/", "voices/", "patches/", "graphics/", "sounds/", "music/" }; - for (auto p : folders) lfi.reservedFolders.Push(p); - - static const char* reserved[] = { "mapinfo", "zmapinfo", "gameinfo", "sndinfo", "sbarinfo", "menudef", "gldefs", "animdefs", "decorate", "zscript", "maps/" }; - for (auto p : reserved) lfi.requiredPrefixes.Push(p); + for (auto p : iwad_folders) lfi.reservedFolders.Push(p); + for (auto p : iwad_reserved) lfi.requiredPrefixes.Push(p); lfi.postprocessFunc = [&]() {