From c75e3de08dd53576d172da51f90c2f07ef7c6b1d Mon Sep 17 00:00:00 2001
From: James R <justsomejames2@gmail.com>
Date: Thu, 3 Oct 2019 13:31:14 -0700
Subject: [PATCH] Don't forget NMUS check in addfile, oh no no no

---
 src/w_wad.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/w_wad.c b/src/w_wad.c
index 54d5e2075..04f6a3e15 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -1753,24 +1753,21 @@ static int W_VerifyFile(const char *filename, lumpchecklist_t *checklist,
 	FILE *handle;
 	size_t i, j;
 	int goodfile = false;
+	int type;
 
 	if (!checklist)
 		I_Error("No checklist for %s\n", filename);
-	// open wad file
-	if ((handle = W_OpenWadFile(&filename, false)) == NULL)
-		return -1;
-
-	// detect wad file by the absence of the other supported extensions
-	if (stricmp(&filename[strlen(filename) - 4], ".soc")
-#ifdef HAVE_BLUA
-	&& stricmp(&filename[strlen(filename) - 4], ".lua")
-#endif
-	&& stricmp(&filename[strlen(filename) - 4], ".pk3"))
+	type = ResourceFileDetect(filename);
+	if (type == RET_WAD)
 	{
 		// assume wad file
 		wadinfo_t header;
 		filelump_t lumpinfo;
 
+		// open wad file
+		if ((handle = W_OpenWadFile(&filename, false)) == NULL)
+			return -1;
+
 		// read the header
 		if (fread(&header, 1, sizeof header, handle) == sizeof header
 			&& header.numlumps < INT16_MAX
@@ -1821,8 +1818,12 @@ static int W_VerifyFile(const char *filename, lumpchecklist_t *checklist,
 			if (!goodfile)
 				break;
 		}
+
+		fclose(handle);
 	}
-	fclose(handle);
+	else if (type == RET_UNKNOWN)
+		goodfile = true;
+
 	return goodfile;
 }
 
-- 
GitLab