diff --git a/src/doomdef.h b/src/doomdef.h index 0e596946b..4a5f83f0b 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -441,7 +441,7 @@ UINT32 quickncasehash (const char *p, size_t n) #include "xxhash.h" #define HASH64(p, n) ((UINT64)XXH3_64bits(p, n)) #define HASH32(p, n) ((UINT32)(XXH3_64bits(p, n) & UINT32_MAX)) -#define HASHFMT "%jx" +#define HASHFMT "%016jx" #ifndef __cplusplus #ifndef min // Double-Check with WATTCP-32's cdefs.h diff --git a/src/p_setup.c b/src/p_setup.c index 3e5292273..7c9532122 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -1519,15 +1519,28 @@ static boolean TextmapCount(size_t size, boolean patch) } tkn = M_TokenizerRead(0); - char *end = NULL; - UINT64 hash = strtoull(tkn, &end, 16); - if (!end || *end) + boolean foundhash = false; + const char *hashstr = tkn; + char *end; + + // check for hashes separated by pipes + // e.g. "abc123|def456|ghi789" + do { - CONS_Alert(CONS_ERROR, "Invalid checksum value '%s'\n", tkn); - return false; + UINT64 hash = strtoull(hashstr, &end, 16); + if (hash == maphash) + foundhash = true; + if (end == hashstr || (*end && *end != '|')) + { + CONS_Alert(CONS_ERROR, "Invalid checksum string '%s'\n", tkn); + return false; + } + hashstr = end + 1; } - if (hash != maphash) - CONS_Alert(CONS_WARNING, "Patch checksum " HASHFMT " does not match map checksum " HASHFMT ". This patch may not work.\n", hash, maphash); + while (*end); + + if (!foundhash) + CONS_Alert(CONS_WARNING, "This map patch is not compatible with the current map (checksum: " HASHFMT "). The patch may not work.\n", maphash); } nummapthings = 0;