Wednesday, May 12, 2010

SCI Mac Craziness

Mac versions of SCI games started out fairly nice. SCI0/SCI1 games used the normal map/volume that their PC and Amiga counterparts used. That held true until the SCI1.1 releases.

Now, the game data is stored inside of Mac resource forks (which I have covered here before). My resource fork patch was accepted earlier this week, so I went into greater work for these games. It was pretty straightforward to get SCI's ResourceManager to support these. Mainly, it involved mapping the resource fork types to the SCI types. Nothing is ever that easy, however.

Right from the get go, it was pretty obvious that various resources were no longer all in little endian order, as had been the case with all other SCI games (even Amiga and pre-SCI1.1 Mac games). I wrote a wrapper function around the pointer reads so that it would choose the right one for the right platform/version. After some work, I got scripts to work and I saw the KQ6 title screen. Then came view support. Thanks to m_kiewitz, we figured out that some view fields were really uint32's instead of uint16's and then we had "preliminary" support for those. See the screenshot below. Also, messages were also in big endian order.

After stubbing off cursors (a view could not be found), the game was playable. There's a cursor in the screenshot, but that's because it shows the last cursor shown, which was the GUI cursor (now with the current cursor palette). However, the views didn't appear right... they could almost be made out. Fortunately, the sound format (MIDI/sequenced) is still the same and the GM mapping works well enough (the Mac/Amiga format is not supported yet). The audio (sampled) has been replaced by Mac 'snd' resources. They were easy to code, based off the Apple specs. On the bright side, font and picture resources are also the same as the normal DOS ones.

I also have Quest for Glory I Mac that I've been looking at, and it seems they may have compressed the scripts/heaps...

Anyway, here's a screenshot of my current code, obviously WIP:

EDIT: m_kiewitz cracked the Mac SCI1.1+ View compression, so we have that working now too. I also fixed cursors. It turns out that the cursors are stored in Mac CURS resources and the view that is called is a "dummy" view telling the engine to use the CURS resources instead.