[ Main Page | SourceForge Project Page | Download Files | Screenshots | FAQ | User's Guide | CVS ]
 

Note: all of the long integers used in the Doom WADs are signed 32-bit numbers, in a lo-hi format. So byte values in a file will be need to be transposed before they can be used.

Sample line:

0000000 50 57 41 44 30 02 00 00 58 3c 45 00 f8 09 e8 f8 [PWAD0...X<E.....]

2 byte format: 58 3c 45 00
4 byte format: 00453c58
Final number: 00453c58, the offset to the directory where the lump information is. A lump is a block of data; some contain sound data, some contain graphics data, some contain level structure data, etc.

Doom WAD Identification & Internals
Bytes Example Purpose
00-03 50 57 41 44 [ 44415750 -or- 'PWAD' ] Identifies whether the WAD is a regular WAD (IWAD),
or patch WAD (PWAD)
04-07 30 02 00 00 [ 00000230 ] Number of lumps in the WAD
08-11 58 3c 45 00 [ 00453c58 ] Byte offset in the WAD file to the start of the Directory

Doom WAD Directory Entry
Bytes Example Purpose
00-03 f4 12 00 00  [ 000012f4 ] Offset from the beginning of the file
to the start of the lump
04-07 8a 58 00 00 [ 0000588a ] Size of the lump in bytes
08-15 4c 49 4e 45 44 45 46 45 [ 454e494c 53464544 -or- 'LINEDEFS' ] 8 byte string, name of the lump

Note that 'marker' and 'label' lump names like "S_START" and "E1M1" will always be zero length, and have zero offset, as they only serve to mark the beginning or end of a set of related lumps.
 

Handy Commands:
[eightball][osiris 520] od -t x1z -N 48 OSIRIS.WAD 
0000000 50 57 41 44 30 02 00 00 58 3c 45 00 f8 09 e8 f8  >PWAD0...X<E.....<
0000020 87 00 01 00 07 00 80 09 80 eb 0e 01 0e 00 07 00  >................<
0000040 50 06 a8 ee 00 00 dc 07 17 00 10 0a 28 ea 00 00  >P...........(...<

outputs the first 48 bytes of a WAD file, in byte groups 

[eightball][osiris 522] od -t x4z -N 48 wadfile.wad
0000000 44415750 00000230 00453c58 f8e809f8  >PWAD0...X<E.....<
0000020 00010087 09800007 010eeb80 0007000e  >................<
0000040 eea80650 07dc0000 0a100017 0000ea28  >P...........(...<

outputs the first 48 bytes of the wadfile, in word (4 byte) groups

[eightball][osiris 527] od -t x4z -N 48 -j 0x453c58 OSIRIS.WAD          
21236130 00000000 00000000 3050414d 00000031  >........MAP01...<
21236150 0000000c 000012e8 4e494854 00005347  >........THINGS..<
21236170 000012f4 0000588a 454e494c 53464544  >.....X..LINEDEFS<

goes to the offset called for in the -j switch, which is the first level in the WAD, display in word groups

GHex is a good GUI editor to use to view the WAD file

Psuedocode for reading the WAD file and extracting the levels the wad replaces

[ Main Page | SourceForge Project Page | Download Files | Screenshots | FAQ | User's Guide | CVS ]