Open vladikcomper opened 3 years ago
TODO: Check if B&R compression (much like the sound driver) was actually developed by Zyrinx and was featured in their own games, like Red Zone.
The split streams for descriptor/dictionary from issue #8 is important here.
Blocked by #25
The Adventures of Batman & Robin uses quite powerful, yet fast compression format with the sliding window of 0x6A0 bytes and maximum dictionary reference length of 0x113 bytes.
Below are my notes on this format, based on my research from 2014:
The game uses its own LZSS-based compression format. Unlike many others implementations, this one is notable for storing description fields and dictionary in separate data blocks, most likely to make fetching 16-bit fields faster as M68K would have problems with reading 16-bit words from unaligned locations.
The compressed data starts with 32-bit relative offset, which points to the beginning of the dictionary. Theoretically, this allows for 'global' or shared dictionaries, meaning different compressed data may use same dictionaries with just different description fields streams to handle decompression. However, this may be difficult to implement with the given compression format, unless the data in the question is nearly identical.
Right after the dictionary offset, description fields that operate decompression start. Those fields can be interpreted as one continous bitsteam, but technically, they are being fetched as 16-bit words.
The following combination of codes are possible in the description fields:
Here's also a working decompressor implementation that also searches for compressed art in the ROM: https://pastebin.com/RahSijzh