User talk:Knt47

From ModdingWiki
Jump to navigation Jump to search

Dynamix BMP Format

I've been trying to implement the compression described on The Incredible Machine image format in Engie File Converter, but I can't quite figure it out. I got all the files, but so far, none of my decompression attempts give correct results.

I figured out that the 2-byte 00 commands are little-endian: the second byte's 6-bit value need to be upshifted by 6 bits and added to the first byte's 6-bit value. This wasn't mentioned on the page. Also, the offsets chunk seems to be called "OFF:", not "OFS:".

Could you give a specific decoding example for each of the commands? Because the things I decode all seem correct, but the end result is just a mess.

-Nyerguds (talk) 00:55, 28 January 2021 (UTC)

I figured it out in the end. The command '0' simply increases the write pointer by (width-6bitarg). The fact you incorporated the background fill and the zoom into your decoding algorithm made the whole thing a bit too complex, and this is kind of reflected in the explanation you put on the page. Personally, I opted for decoding everything into an 8-bit buffer, and compacting that to 4-bit in a post-decompression operation. As you can imagine, this removes all the juggling with nibbles.
By the way, in Heart of China I encountered more of these SCN/OFF files, however, they all have a value much larger than 0xF as first byte. I don't see any logic or meaning in the extra 4 bits, but if I just chop them off with a bitwise AND operation, the decompression works as it should.
However, seeing as all of the formats used inside .BMP clearly exist in multiple games, and a cleanup of the Stellar 7 RES Format page is long overdue, I would like to move the "The Incredible Machine image format" page to a more general "Dynamix BMP Format" page in the future. Then all compression types found in these .BMP files can be documented on the same page.
-Nyerguds (talk) 03:58, 28 January 2021 (UTC)