From 7ae3678abc322f6a951916b8ccb5cf18bae33a00 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 11 Jan 2015 11:43:43 +0200 Subject: [PATCH] Extended check for embedded WADs with one special case Added loading of embedded WAD file if `myfile.wad` is placed in `myfile` directory inside `myfile.zip` This helps with an unpleasant and very annoying fashion to zip a folder instead of just .wad and .txt files. Recent examples include Monster Hunter Ltd.: http://www.doomworld.com/idgames/?id=17601 and http://www.doomworld.com/idgames/?id=17625 Hell Awakened 2 Episode 1: http://www.doomworld.com/idgames/?id=17795 Bauhaus: http://www.doomworld.com/idgames/?id=17954 --- src/resourcefiles/resourcefile.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/resourcefiles/resourcefile.cpp b/src/resourcefiles/resourcefile.cpp index 8a4f07fd7..24b3ad3d6 100644 --- a/src/resourcefiles/resourcefile.cpp +++ b/src/resourcefiles/resourcefile.cpp @@ -150,11 +150,22 @@ void FResourceLump::LumpNameSetup(const char *iname) // //========================================================================== +static bool IsWadInFolder(const char* const fullName) +{ + // Checks a special case when was put in + // directory inside + + const FString baseName = ExtractFileBase(fullName); + const FString fileName = baseName + '/' + baseName + ".wad"; + + return 0 == fileName.CompareNoCase(fullName); +} + void FResourceLump::CheckEmbedded() { // Checks for embedded archives const char *c = strstr(FullName, ".wad"); - if (c && strlen(c) == 4 && !strchr(FullName, '/')) + if (c && strlen(c) == 4 && (!strchr(FullName, '/') || IsWadInFolder(FullName))) { // Mark all embedded WADs Flags |= LUMPF_EMBEDDED;