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. :)


J.J. said...

I found this post as I was trying to find something that plays the Mohawk format for the CDToons codec that is apparently used for the ending scenes in Carmen Sandiego's Great Chase Through Time. (See, I just completed the game after many, many crashes. When I FINALLY was about to confront Carmen my game did a super-crash and erased all of my game files.)

I am going to try out your ScummVW program momentarily. From what I've just read in the other posts, it is essentially superior to DOSBox? I've written this longwinded post simply to say... Thank you for your awesomeness!

J.J. said...

Results: I tried to use the ScummVW program and learned that Carmen Sandiego's Great Chase Through Time is not supported. Is there any way I can use the Video Decoder from ScummVW as a standalone viewer for those annoying CDToon codecs in these games?