commit d706f9693ee6bfd3976fcb232c1563c32b1cff88
Author: Simon Howard <fraggle@gmail.com>
AuthorDate: Mon Mar 28 21:32:14 2011 +0000
Commit: Simon Howard <fraggle@gmail.com>
CommitDate: Mon Mar 28 21:32:14 2011 +0000
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
---
NEWS | 2 ++
src/w_wad.c | 33 ++++++++++++++++++++++-----------
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++);
}
}