summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2011-03-28 21:32:14 +0000
committerSimon Howard2011-03-28 21:32:14 +0000
commitd706f9693ee6bfd3976fcb232c1563c32b1cff88 (patch)
tree998596b01f3c0c5591359722f4c836a8a23d38d2
parent6e099632c653dd42dbe1f719c5887844091da0cc (diff)
downloadchocolate-doom-d706f9693ee6bfd3976fcb232c1563c32b1cff88.tar.gz
chocolate-doom-d706f9693ee6bfd3976fcb232c1563c32b1cff88.tar.bz2
chocolate-doom-d706f9693ee6bfd3976fcb232c1563c32b1cff88.zip
Allow .lmp files to be loaded (and demo files to be played back) that
have long filenames (thanks blzut3). Subversion-branch: /trunk/chocolate-doom Subversion-revision: 2312
-rw-r--r--NEWS2
-rw-r--r--src/w_wad.c33
2 files changed, 24 insertions, 11 deletions
diff --git a/NEWS b/NEWS
index b7c5922e..b76917f2 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@
users have reported experiencing.
* The display settings window in the setup tool has been
reorganised to a better arrangement.
+ * It is now possible to load .lmp files (and play back demos)
+ with long filenames (thanks blzut3).
Compatibility:
* Added support for the alternate version of the Final Doom
diff --git a/src/w_wad.c b/src/w_wad.c
index 9425705c..e93147e3 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -74,27 +74,38 @@ static lumpinfo_t **lumphash;
static void ExtractFileBase(char *path, char *dest)
{
- char* src;
- int length;
+ char *src;
+ char *filename;
+ int length;
src = path + strlen(path) - 1;
-
+
// back up until a \ or the start
while (src != path && *(src - 1) != DIR_SEPARATOR)
{
src--;
}
-
- // copy up to eight characters
- memset (dest,0,8);
+
+ filename = src;
+
+ // Copy up to eight characters
+ // Note: Vanilla Doom exits with an error if a filename is specified
+ // with a base of more than eight characters. To remove the 8.3
+ // filename limit, instead we simply truncate the name.
+
length = 0;
-
- while (*src && *src != '.')
+ memset(dest, 0, 8);
+
+ while (*src != '\0' && *src != '.')
{
- if (++length == 9)
- I_Error ("Filename base of %s >8 chars",path);
+ if (length >= 8)
+ {
+ printf("Warning: Truncated '%s' lump name to '%.8s'.\n",
+ filename, dest);
+ break;
+ }
- *dest++ = toupper((int)*src++);
+ dest[length++] = toupper((int)*src++);
}
}