-
Notifications
You must be signed in to change notification settings - Fork 0
Format: WAD file
WAD files are the standard method of storage for game data in LEGO Rock Raiders. They contain files with hierarchic path names (not just a base filename at the root level).
LEGO Rock Raiders searches for up to 10 WAD files upon boot: LegoRR0.WAD
up to LegoRR9.WAD
These files must be in the current working directory (which should be the same directory as the LegoRR executable). Additionally, the WAD file names searched for are based on the executable name... so running a copy of LegoRR.exe
renamed to LegoABC.exe
would search for WAD files: LegoABC0.WAD
up to LegoABC9.WAD
.
Keep in mind that the executable name should start with Lego
for numerous reasons (most of which relating to the CFG configuration format), but besides this, changes beyond that are fair game.
WAD files do not need to exist in order. Essentially, the file LegoRR9.WAD
can exist even if no others are present, and LegoRR will still use it.
Higher number WAD files have higher priority over lower numbered files. If a file entry being searched for exists in multiple WAD files, the first-found file entry in the higher-numbered WAD file will always be used. This allows for a form of incremental updating, by adding new WAD files onto your existing game.
Relative file paths in WAD files are listed relative to the Data directory. So Data\Lego.cfg
would be listed as Lego.cfg
in a WAD file. And Data\Sounds\DRIP1.WAV
would be listed as Sounds\DRIP1.WAV
.
WAD file entry paths should always use \
backslash path separators. This is a rule of thumb that should be maintained for all aspects of LEGO Rock Raiders.
LEGO Rock Raiders: Community Edition supports WAD files just like the original. However the Cafeteria mod manager always creates a LegoRR0.WAD
-named WAD file, meaning this would need to be manually renamed after every rebuild with mods.
LEGO Rock Raiders uses 3 separate sources when searching for game data files (listed in order of priority from highest to lowest).
WAD files are not required, but a Data directory is required in order to read streamed file types (and write file data, which does not seem to happen normally).
About Streaming: A handful of media file types are streamed (where data is read as-needed). This is true for AVI videos, OGG music, and WAV files present in the Sounds\Streamed\
folder. For WAV files, streaming is specified by the @
prefix on a file path in the Samples
block in Lego.cfg
.
- WAD files can only be used to read data.
- WAD files cannot support streaming of files, they must be read in-full upon usage. (WAD files only have one file handle open to them at any given time)
- This must be the path
.\Data\
(where.
represents the current working directory).
- On boot, the CD-ROM Data directory is checked for in order from driver letters
C-Z
(LettersA,B
are reserved for floppy drives). - The drive type must be that of a CD-ROM (
DRIVE_CDROM
as returned by GetDriveTypeA). - The drive must contain the file:
CD:\Data\cd.key
(the contents are unimportant, as long as the file as read access).
Type | Value | Description |
---|---|---|
char[4] |
"WWAD" | File signature |
uint32 |
Count | Number of file entries |
cstring[] |
Names | Entry file paths relative to inside the WAD file ("Relative directories" or "Reldirs") |
cstring[] |
BuildNames | Absolute file paths taken when building the WAD file ("Absolute directories" or "Absdirs") |
Entry[] | Entries | Entry file storage metadata (Location, size, and storage format) |
Type | Value | Description |
---|---|---|
uint32 |
Flags¹ | Flags determining storage format ( 1 = Store, 2 = RNC Compressed) |
uint32 |
PackedSize² | Packed size of file data (as present in WAD file) |
uint32 |
UnpackedSize | Original unpacked size of file data |
uint32 |
Offset | Absolute offset to file data |
[1]: Note that Flags are possibly stored internally as a single byte (however it still takes up 4 bytes of space before the next field).
[2]: When a WAD Entry is uncompressed ("Stored"), PackedSize must be identical to UnpackedSize.
Name | Value | Description |
---|---|---|
Store³ | 0x1 |
File data is stored in its original uncompressed form (this flag is never checked) |
Rnc | 0x2 |
File data is stored using Rob Northern Compression (RNC). |
[3]: The Store flag is never checked for in the engine (only the Rnc flag is checked against). However it is always the value used for uncompressed WAD entries (as far as I know.... not to mention that Rnc compression might not appear in any releases of LegoRR).
- RRUKB: WAD file
- RRU: NO WADS! or 10 Wads (Forum thread on usage/exclusion of WAD files)
- RRU: Ogun's WAD Tool (Forum thread for Ogun's WAD Tool)
- jgrip/wadtool (GitHub repo for Ogun's WAD Tool)
- lab313ru/rnc_propack_source (Tool and source code for creating RNC-compressed file data, compatible with LegoRR)