![]() |
TSunmix 0.2
|
Mix archive header. More...
#include <mix_file.h>
Public Attributes | |
struct { | |
unsigned short c_files | |
unsigned int size | |
}; | |
unsigned int | flags |
Mix archive header.
Mix archive starts with archive header storing information about number of files included and their total size. Some archives (RA/TS) starts with 4b flags, which is followed by header.
Now here comes part which might be hard to understand. Data are stored in little endian format, which means little ending is stored first and big ending last. Number 0x11223344, where little ending is 44, will be stored like this 44 33 22 11 - bytes are stored in reverse direction as you can see.
Flags are stored only in LAST 2 bytes, that means if file starts with flags, FIRST 2 bytes are 00 00, and other 2 bytes contains flag. If there are no flags, archive can not start with 00 00, because that would mean it contains no files.
So we read header no matter what type archive is and check for first two bytes,which are stored in c_files. If c_files == 0, we take first 4 bytes, which are stored in flags as flag information, move file pointer to 4th byte and repeat reading of header (6b). Now c_files contains number of files and size contains size of all files.