Hello Compression Experts,
I'm a developer desperately trying to figure out a compresion method used in an old Westwood PC game (Lands of Lore II and III from 1997/1999). I'm not very familiar with compression, and having tried for the last couple of days, I am stuck for now and hoping that maybe someone's trained eye can spot the employed method better than myself - or even knows the method from their own experience.
Some of Westwood's common algorithms used during that time are well documented (e.g. "Format80" aka. "Westwood LCW" or "Format 2", an LZW variation). The former is actually used in the game, too, but their "main" archives appears to be compressed using a method that is not the standard LCW. It is quite possibly a variant (they are indeed famous forusing variations of their file formats and algorithms…)
I've been able to obtain a decoded copy for some of the game files (but not for all, that's why the algorithm is still needed), which should be helpful in determining the compression. The files are custom-format resource archives containing textures and sprite graphics in various formats. I've been able to understand the file structure when uncompressed, but not the compression. Below is a screenshot of both compressed (top) and uncompressed (bottom). I have attached the complete (sample) file.
I've discovered that certain literals to copy to the output are prefixed by "00 xy", where xy + 18 is the length of the literal. Some smaller literals are prefixed by"0x", where x + 3 is the length instead. There also seem to be copy instructions, occuring e.g. at offset 36 and 52, but I was unable to determine their pattern. The compresion seems to be command-based to me, similar to"Format 80", but I was unable to determine their structure.
If anyone has an idea, I would be deeply grateful for any advice!
Best,
Michael