From ec5817869592660af6837b9f4e20ed140972a2b2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 7 Feb 2015 15:27:31 +0100 Subject: [PATCH] - replace all \0 characters in Dehacked patches with spaces. This is needed to make some old and broken patches in some WolfenDoom mods load. --- src/c_dispatch.cpp | 2 +- src/d_dehacked.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/c_dispatch.cpp b/src/c_dispatch.cpp index 7a6748fdc..06bcf6b58 100644 --- a/src/c_dispatch.cpp +++ b/src/c_dispatch.cpp @@ -694,7 +694,7 @@ void C_DoCommand (const char *cmd, int keynum) } else { - Printf ("Unknown command \"%.*s\"\n", len, beg); + Printf ("Unknown command \"%.*s\"\n", (int)len, beg); } } } diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 41ad71472..8debb69a4 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -2455,6 +2455,12 @@ static bool DoDehPatch() Printf (PRINT_BOLD, "\"%s\" is an old and unsupported DeHackEd patch\n", PatchFile); return false; } + // fix for broken WolfenDoom patches which contain \0 characters in some places. + for (int i = 0; i < PatchSize; i++) + { + if (PatchFile[i] == 0) PatchFile[i] = ' '; + } + PatchPt = strchr (PatchFile, '\n'); while ((cont = GetLine()) == 1) {