Monday, January 6, 2014

FMod - I Have a Dream

Huffman decompression is pretty easy, especially now that I know about that weird bit order reversal that goes on with the dictionary! Compression was a little harder because I need to create a dictionary, but I had it default to the trivial dictionary (no compression) unless a better one is specified. There was also the issue of writing down that dictionary to EGADICT, which I did in a way a little messier than the original. It's OK; it's the same size and is equally fast, just looks strange to the eye.

While trying to add new GalaxyGraphicsChunkSettings instances, I discovered that some episodes have texts in a different order. That immediately presented an issue: it always assumed the order used by Keen 4. So, I changed those variables into a list of strings. Shortly, I discovered that Keen 6 lacks some resources that both 4 and 5 have. So, I went back through and inserted checks to see if various fields of the chunk settings object were zero before trying to read the resources.

Though I didn't get a chance to test reading episodes 5 and 6, I went on to Keen Dreams, that strange in-between episode that is full of exceptions and special cases. It took an hour just to get the EGAHEAD reader generalized to its four-byte arrays instead of the newer three bytes. I also discovered a problem with the hardcoded chunk sizes of the small tiles; Keen Dreams has fewer of them. That was solved by adding new fields for that to the settings instance. I'm still having trouble with getting decompressed sizes for KD, though; they always return zero.

No comments:

Post a Comment