Massive info dump

As promised last week, you can find a tarball of the latest version at:
http://www.its.caltech.edu/~szerrade/scummsci.tar.bz2

Disclaimer: This is mostly for the benefit of people curious as to the current state of the project, and probably shouldn’t be used by anyone actually looking to play a game.

There are about 1700 lines of new code in this build (as compared to the repository jvprat had at the beginning of the summer). About 1200 of those are in new sound and file IO drivers, and the rest are scattered throughout the dozen or so files that had to be rewritten to use the new drivers.

The testing has been limited to King’s Quest IV and a couple of game demos on my Ubuntu PC- cross-platform/cross-game testing is reserved for the final stage of the project. To build, do:
./free_configure
make

The new files are described below. All of them are in engines/sci/src/.

scicore/file_hander.c and include/file_handler.h : This routes the file access system calls to the relevant drivers. It’s patterned after the FreeSCI exe.h/exe.c drivers. These calls are sort of a compromise between the FILE* methods used in FreeSCI and ScummVM’s methods. Getting them to fit together has sort of been a square-peg round-hole problem.

scicore/scumm_file_driver.c: This is the part that turns various FILE*-style calls into scummvm commands. The implementation is not always 100% faithful – for example, I was not able to figure out how to translate scanf into something the Scumm savefile drivers could work with – but I’ve tested it (mostly on King’s Quest IV) and it works well enough to access resource files and save/restore games.

Files are divided into save files (for which read/write is allowed) and resource files (which can only be read). This is necessary because some backends (Playstation 2 comes to mind) force you to use memory sticks for save state and read-only disks for game data. Which type of file you open depends on the driver method you call. Generally, if you want to open a file for writing you should explicity use the sci_save_write_open method.

scicore/unix_file_driver.c : This maps abstract driver commands to C FILE* methods. Currently disabled in favor of:

sfx/seq/scumm-adlib.c: This implements a sequencer that uses ScummVM’s Midi drivers to play Adlib music. The hardest part of writing this was debugging the custom instrument patches.

sfx/device/scumm-midi.c: This implements the Scumm drivers as a FreeSCI midi device, allowing them to be used by FreeSCI’s GM and MT32 drivers. You can change the driver used by modifying the invocation on line 85 – since the next stage in the project is to overhaul the config system, I didn’t see much point in setting up a runtime control for this only to have it replaced in a week.