ref: daaf0d1fcf4d3ed5c77806b3ea15db0f3a787f1e
parent: 1d6a613b1dad36a97b7ff86eff551de2dd6a4238
author: Simon Howard <[email protected]>
date: Fri Nov 10 12:32:54 EST 2006
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
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -175,9 +175,19 @@
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++;
}