File archive: Difference between revisions
No edit summary |
No edit summary |
||
Line 7: | Line 7: | ||
|0x0 | |0x0 | ||
|0x4 | |0x4 | ||
|Magic, <code>44 49 52 1A</code> ( | |Magic, <code>44 49 52 1A</code> (<code>DIR\x1A</code>) | ||
|- | |- | ||
|0x4 | |0x4 |
Revision as of 21:18, 1 January 2021
.wad file format is exactly the same as Worms .dir format, only extension is different.
Offset | Size | Description |
---|---|---|
0x0 | 0x4 | Magic, 44 49 52 1A (DIR\x1A )
|
0x4 | 0x4 | File size |
0x8 | 0x4 | Directory address |
0xC | ??? | Files data |
- file data spans up to the "address of directory". These two subpoints are optional, but they provide nice alignment
- There is
1A 00
at the end of each file - There may be
00
padding after that, so the next file/section starts at offset % 4 == 0
- There is
Following offsets are counted from "Directory address"
Offset | Size | Description |
---|---|---|
0x0 | 0x4 | Magic, 0A 00 00 00
|
0x4 | 0x1000 | Hash table, 1024 4-byte entries |
0x1004 | ??? | File descriptors |
Hash table
- each entry value + "address of directory" is a pointer to corresponding file descriptor
- each position is calculated, hash function is available at https://worms2d.info/Graphics_directory
each file descriptor have following structure:
Offset | Size | Description |
---|---|---|
0x0 | 0x4 | Next hash, by default is set to 00 00 00 00
|
0x4 | 0x4 | File data offset in archive |
0x8 | 0x4 | File size |
0xC | 0x4 | Filename with path |
File descriptors
- if two files have the same hash, then hash table points to first file, which have "next hash" to another file descriptor with the same hash. If there is no collision then it's 0.
- filename is 4 bytes aligned, terminated by 0x00 (and padded with 0x00 to 4 bytes)