Subject: Re: M.A.X 2 Data Extractor
Thank you!
Now that I've got "single image" files working, I've went after multi-image files. I've been thinking that one of bytes is identificator, but I was wrong
This is a container file format that holds many images. Here is header:
DownloadSource code (Text):Offset Len Description
0 2 Number of images stored in file
2 2 Palette id
Next they have list of offsets of every image in file, four bytes each. If there's one image, it will be single 4-byte offset equaling to "8". There is as many offsets as there are images in the container.
Every image has following header starting at specified offset:
DownloadSource code (Text):Offset Len Description
0 2 Image width
2 2 Image height
4 2 Center X coord
6 2 Center Y coord
Image is then followed by number of "segment" offsets - each being 4 bytes long.
Each segment follows this structure:
DownloadSource code (Text):Offset Len Description
0 2 Start pixels
2 2 N of pixels
After N is read, next N of bytes are how many N pixels should be drawn, and in what colors. For example, if first 3 pixels are empty, but next five aren't, it will be "3 5 6 7 8 9 10", where 6-10 are numbers of colors from image's palette. (Shadow images skip color bytes altogether).
If byte "FF" is reached, transparent pixels should be added until image width is reached. After that pixels counter should be reset and second row of image should be drawn.
It looks like units have "faction color ring" baked in, which makes me sad, but it appears to have constant color, so should be easy to filter off.
Didn't check for sure, but it seems that there are three "type 2" asset files:
DownloadSource code (Text):Name Description
ASSET Complete asset file
I_ASSET Asset file containing only single image
S_ASSET Asset shadows images
I am guessing the "I_*" variants were introduced for memory conservation reasons, so if you want to, say, display tank in the building UI, you have single image to load instead of many.
Thumbnails of attached images:
Filetype:
png
Downloads: 2474
Filesize: 1.19 KB
Image size: 43 x 24 Pixels
Filetype:
png
Downloads: 2270
Filesize: 501 Byte
Image size: 23 x 16 Pixels
Filetype:
png
Downloads: 2215
Filesize: 1.08 KB
Image size: 32 x 25 Pixels
This post has been edited
2
times. Last edit on Feb 13, 2019 10:40 pm by riess.