UMOD/File Format
If you want to create your own tool for building or extracting files from UMOD installers, you'll need knowledge about their internal structure.
Basic structure
A UMOD installer file consists of three parts:
- First comes the (uncompressed) content of all files that are contained in the UMOD installer.
- After that, a list of files including their offset and length (and some more information which is detailed below) follows.
- At the very end of the UMOD file (with a fixed offset from the file end), the UMOD file "header" is stored.
The UMOD installer must contain a file Manifest.ini that describes the target locations of the files, the installed mod's requirements and other details, and Manifest.int that contains the textual captions and descriptions used in the installer. See /Creating on how to set up those files.
Parts
Described in reverse order of their appearance in the file, since this is the order they'll be parsed when reading the UMOD file.
UMOD file "header"
The UMOD file header is 20 bytes long. The header is stored in the last 20 bytes of the file (hence the quotes around the term "header").
Offset | Length | Type | Description |
0 | 4 | unsigned int | Magic number. Used to verify this file as a UMOD installer. Always 0x9FE3C5A3. |
4 | 4 | unsigned int | Byte offset of file directory in the UMOD file. (See below.) |
8 | 4 | unsigned int | Total byte size of the UMOD file. |
12 | 4 | unsigned int | UMOD file version. |
16 | 4 | unsigned int | CRC32 checksum over the file content. |
Mychaeel: That CRC32 checksum needs further investigation... It's just a guess that the checksum goes over the file content (first part of UMOD file) only. Besides, I've been running into problems trying to verify UnrealScript source code TextBuffer checksums using a standard CRC32 algorithm with a standard seed – or I didn't feed it the right data. Any help?
Ether: it's checksum of the whole file w/o header using a C function appmemcrc()
File directory
The file directory describes the files stored in the first part of the UMOD file. Its byte offset in the UMOD file is given in the file "header" (see above).
The directory consists of an index-type file count (the index data type is described below), followed by variable-size records, each describing one file in the UMOD installer.
Offset | Length | Type | Description |
0 | variable | index | Length of file name (including trailing null byte). |
variable | char | File name, with trailing null byte. | |
4 | unsigned int | Byte offset of file in UMOD file. | |
4 | unsigned int | Byte length of file. | |
4 | unsigned int | Bit field describing file flags. (See below.) |
Mychaeel: Feel free to investigate and contribute information about the file flags. (I know that they have to be set to 0x03 for Manifest.ini and Manifest.int to prevent those files from being copied to the user's System directory, and set to 0x00 for all other files.)
Files
The files are stored without compression starting from byte 0 of the file, one after another, with no padding or separators between them. Their respective byte offsets in the file are specified by the file directory (see above).
Data details
Specifications of the integer and index values can be found: Package File Format/Data Details