Saturday, March 27, 2010

March Madness

I've been quite busy the last month, though sadly not much related to coding or reverse engineering.

In the ScummVM world, my main focus was working on rewriting the VideoDecoder system. In the current trunk, the VideoDecoder is limited in what it can be used for. It was designed for fixed-rate, 8bpp videos that do not run in the "background" (instead of say in Broken Sword where the cutscene is the only thing going on in the game and the event loop only handles the video) of the games. Because of the way this works, the QuickTime player in Mohawk does not use this (variable rate, >8bpp, and background videos needed) and I designed a different system to run the Myst and Riven videos.

DrMcCoy also had a similar problem with his Dark Seed II engine where >8bpp videos are used (in AVI files). So, I began working on a redesigned VideoDecoder system which took about a week's worth of my spare time up (with much help from DrMcCoy, especially on bug fixing and input on the new API) and we came up with this patch. Since writing the patch I haven't had time to fix some of the things in it or split it up (it's a whopping 130KB), but hopefully I'll get around to that soon. Also, the QuickTime code in Mohawk will eventually also be adapted to that and moved to common so it can be used in the SAGA and SCI engines.

Outside of the ScummVM world, I've done a bit more experimenting with my DOSBox + Windows 3.1 setup mentioned way back when. Now I'm running it at 640x480x24bpp using the S3 Trio drivers, and now Buried in Time doesn't crash on me at all and works in 24bpp. Buried in Time would be a great game to reimplement one of these, however it is entirely hardcoded and would be difficult to implement. The cursors and main menu graphics are stored in the executable too.

As for media, the audio is standard WAVE files (disguised with a .bta extension), the bitmaps are DIB's (disguised with a .btb extension, usually) and the videos are AVI's with Cinepak encoded frames (disguised with a .btv extension, usually). All of the data is normal, except for one image: TITLE/BKG.BTB. I wasn't able to open it in any image viewer, so I opened it in a hex editor only to see a very weird bitmap compression field: 'cvid' ('divc' when decoding because the field is really LE). Cinepak! I hacked together the Mohawk bitmap decoder and the Mohawk Cinepak decoder to display the image, and it came out fine. Apparently, the BKG.BTB file is displayed in the background so the main title video takes up much less room. Interesting, but again, a project that will probably never be realized because of its hardcodedness.

That's it for now... hopefully more posts soon. :)