commit daaf0d1fcf4d3ed5c77806b3ea15db0f3a787f1e
Author: Simon Howard <fraggle@gmail.com>
AuthorDate: Fri Nov 10 17:32:54 2006 +0000
Commit: Simon Howard <fraggle@gmail.com>
CommitDate: Fri Nov 10 17:32:54 2006 +0000
Fix for playing demos on PPC (actually, fix for loading single lump
files on non-little-endian machines).
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 749
---
src/w_wad.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/w_wad.c b/src/w_wad.c
index 07cd9710..397ec457 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -175,9 +175,19 @@ FILE *W_AddFile (char *filename)
if (strcasecmp(filename+strlen(filename)-3 , "wad" ) )
{
// single lump file
+
+ // fraggle: Swap the filepos and size here. The WAD directory
+ // parsing code expects a little-endian directory, so will swap
+ // them back. Effectively we're constructing a "fake WAD directory"
+ // here, as it would appear on disk.
+
fileinfo = Z_Malloc(sizeof(filelump_t), PU_STATIC, 0);
- fileinfo->filepos = 0;
- fileinfo->size = FileLength(handle);
+ fileinfo->filepos = LONG(0);
+ fileinfo->size = LONG(FileLength(handle));
+
+ // Name the lump after the base of the filename (without the
+ // extension).
+
ExtractFileBase (filename, fileinfo->name);
numlumps++;
}