LOD archives are used by HoMM III to store most of its data files conviniently in one place. A single archive can store up to a hard limit of 10000 files, either compressed using zlib or included as-is, with a size limit for a single file of 2^32 bytes and identical offset limit - thus making it theoretically possible to cram almost 8GB of data into one archive, however pointless would that be.

The archive format itself is very simple, with a static header of 320092 bytes followed by raw compressed or stored data:

struct h3lod {
	uint32_t magic; // always 0x00444f4c, that is, a null-terminated "LOD" string
	uint32_t type; // 200 for base archives, 500 for expansion pack archives, probably completely arbitrary numbers
	uint32_t files_count; // obvious
	uint8_t unknown[80]; // 80 bytes of hell knows what - in most cases that's all zeros, but in H3sprite.lod there's a bunch of seemingly irrelevant numbers here, any information is welcome
	struct h3lod_file[10000]; // file list
}
 
struct h3lod_file {
	char name[16]; // null-terminated, sometimes null-padded too, sometimes padded with, well, something after the null
	uint32_t offset; // includes the header size, no preprocessing required
	uint32_t size_original; // before compression, that is
	uint32_t type; // what's in the file - probably not used by the game directly, more on that below
	uint32_t size_compressed; // how many bytes to read, starting from offset - can be zero for stored files, use size_original in such case 
}

The only complicated thing here is the type field, but it was probably only used by the NWC's development tools, the game seems to just ignore it. Most LOD-editing tools out there set it to zero when adding a file (proved by experiment, as not a single one of those comes with a source code). For the sake of completeness, that's the list:

There's probably some more I'll add as I notice them.

 
homm/homm3-lod-archives.txt · Last modified: 2008/03/23 10:43 by enleth
 
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki