Lord of the Ring: War of thr Ring H2O file format
This format was designed by Liquid Entertainment, hence the name H2O. The games
resources and settings are maintained in a relational database. And this format
is used for backing storage of BLOB's. Each table that contains a column marked
as BLOB has an H2O archive. Each row of the table matches an entry in the
archive, and since whole rows can be null (unused) in the tables so can entries
in an archive. These have their index_file and index_dir set to -1.
The format is composed of 6 areas:
* Header
* Entries
* File names
* Directory names
* Directory structure
* Data area
The format uses PKWARE's Data Compression Library, compressed data is prefixed
with the following structure:
uint32 size_compressed
uint32 size
uint32 checksum generated with CRC32
Mark Adler, author of zlib has written source to decompress DCL compressed
data and made it available for download at:
http://www.alumni.caltech.edu/~madler/blast10.tar.gz
Header
------
char[8] ident 'LIQDLH2O'
float version 6.0
char[] comment ends with 0x1A
uint32 version 6
uint32 num_entries
uint64 datasize_archived
uint64 datasize_raw
Entries
-------
An array of structures, as depicted below, that describes each entry
uint32 unknown 0 for uncompressed entries, varies for
compressed, reason unknown
int32 index_dir -1 if there there is no associated directory
int32 index_file -1 if the entry is unused
uint32 index_entry increases from zero
uint32 size
uint32 size_compressed same as size for uncompressed entries
uint64 offset offset in the file to where the raw or
compressed data is stored
uint32 checksum generated with CRC32
uint32 unknown always 1239288 or 1239252
File names
----------
This area is compressed, so it starts with the compressed data descriptor
descbribed above. The strings are in unicode. You'll have to search the
array looking for 0x0000 to find out where each string starts and ends.
uint32 numstrings
uint32 size size in bytes of the array and the two
uint32's numstrings and size
(array of strings)
Directory names
---------------
Stored in the same way as the file names.
Directory structure
-------------------
This is an array of int32's with one entry for each directory. The value of an
entry is the index into the same array of the parent directory, or -1 if it
has no parent directory.
uint32 numdirs
int32[numdirs] parentindex
Data Area
---------
Contains the actual content, the offset value of entries point into this area.
Compressed entries start with the structure described in the introduction.
Remarks
-------
The directory names are complete paths, i.e. textures/balrog/front.tga is
textures/balrog, not just balrog, so the directory structure area isnt really
needed.