Okay, I looked into G2M4 closer, here’s the output:
As with the previous beast, there are two types of images combined in single tile â€” so-called synthetic layer and natural layer. What you see if the first layer decoded.
Here’s the general tile structure:
- Compression subtype (top bits from the first byte).
- Transparency colour (three bytes)
- Number of palette entries minus one (one byte)
- Palette entries (byte triplets)
- Synthetic layer (16-bit BE chunk size plus deflated data, may be not present)
- Natural layer (probably headerless JPEG data, too lazy to verify)
Synthetic layer image is (after decompression) contains packed bitmap that uses palette from above, each row is coded as
8-bit flag [packed row data]. If the flag is zero then row data is present (that’s my guess, it always seems to be zero). Row data is just palette indices stored as 1/2/4 or 8 bits per index depending on palette size. Sample output you can see above.
Feel free to complete RE.