diff options
author | Simon Howard | 2006-11-10 17:32:54 +0000 |
---|---|---|
committer | Simon Howard | 2006-11-10 17:32:54 +0000 |
commit | daaf0d1fcf4d3ed5c77806b3ea15db0f3a787f1e (patch) | |
tree | f22a99cbd94fa737f529ff3cbdd28a063c1fd3cd | |
parent | 1d6a613b1dad36a97b7ff86eff551de2dd6a4238 (diff) | |
download | chocolate-doom-daaf0d1fcf4d3ed5c77806b3ea15db0f3a787f1e.tar.gz chocolate-doom-daaf0d1fcf4d3ed5c77806b3ea15db0f3a787f1e.tar.bz2 chocolate-doom-daaf0d1fcf4d3ed5c77806b3ea15db0f3a787f1e.zip |
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
-rw-r--r-- | src/w_wad.c | 14 |
1 files 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++; } |