mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-18 22:51:39 +00:00
Added ability to load any IWAD without extension
Previously, only .wad files can specified without file extension for -iwad command line option For example, -iwad square1 will load square1.pk3 as IWAD
This commit is contained in:
parent
17bc9c3f69
commit
ca0e39cd0c
1 changed files with 27 additions and 16 deletions
|
@ -518,11 +518,15 @@ int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad,
|
|||
unsigned numFoundWads = mFoundWads.Size();
|
||||
|
||||
if (iwadparm)
|
||||
{
|
||||
const char* const extensions[] = { ".wad", ".pk3", ".iwad", ".ipk3", ".ipk7" };
|
||||
|
||||
for (auto ext : extensions)
|
||||
{
|
||||
// Check if the given IWAD has an absolute path, in which case the search path will be ignored.
|
||||
custwad = iwadparm;
|
||||
FixPathSeperator(custwad);
|
||||
DefaultExtension(custwad, ".wad");
|
||||
DefaultExtension(custwad, ext);
|
||||
bool isAbsolute = (custwad[0] == '/');
|
||||
#ifdef WINDOWS
|
||||
isAbsolute |= (custwad.Len() >= 2 && custwad[1] == ':');
|
||||
|
@ -542,6 +546,13 @@ int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mFoundWads.Size() != numFoundWads)
|
||||
{
|
||||
// Found IWAD with guessed extension
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// -iwad not found or not specified. Revert back to standard behavior.
|
||||
if (mFoundWads.Size() == numFoundWads) iwadparm = nullptr;
|
||||
|
|
Loading…
Reference in a new issue