From 33b2c792cd872b204306f4159a457a4b2b10d82d Mon Sep 17 00:00:00 2001 From: dpjudas Date: Wed, 14 May 2025 02:15:37 +0200 Subject: [PATCH] Pick up iwads from folders --- src/d_iwad.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index 9954e896d..d326bce64 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -493,6 +493,7 @@ void FIWadManager::CollectSearchPaths() void FIWadManager::AddIWADCandidates(const char *dir) { FileSys::FileList list; + FString iwadinfoName = "iwadinfo"; if (FileSys::ScanDirectory(list, dir, "*", true)) { @@ -517,6 +518,23 @@ void FIWadManager::AddIWADCandidates(const char *dir) } } } + else + { + FileSys::FileList list; + if (FileSys::ScanDirectory(list, entry.FilePath.c_str(), "*", true)) + { + for (auto& entry2 : list) + { + std::string s = entry2.FileName; + s.resize(std::min(s.size(), iwadinfoName.Len())); + if (iwadinfoName.CompareNoCase(s.c_str()) == 0) + { + mFoundWads.Push(FFoundWadInfo{ entry.FilePath.c_str(), "", -1 }); + break; + } + } + } + } } } } @@ -543,7 +561,12 @@ void FIWadManager::ValidateIWADs() } else { - index = ScanIWAD(p.mFullPath.GetChars()); + bool isdir = false; + bool exists = FileSys::FS_DirEntryExists(p.mFullPath.GetChars(), &isdir); + if (exists && isdir) + index = CheckIWADInfo(p.mFullPath.GetChars()); + else + index = ScanIWAD(p.mFullPath.GetChars()); } p.mInfoIndex = index; }