Win format

From Aleph One Wiki

Jump to: navigation, search

Marathon 2 for Windows Data Formats

Return to History

Christian Bauer

Thanks to some guy I was now able to take a look at the data file formats used in the Win95 version of Marathon 2. Here are my findings:

  • The "Shapes" and "Sounds" files, while not identical to the ones from the Mac version of M2, appear to have exactly the same format (the "Sounds" file even has the MacOS sound header structures in it).
  • The "Music" file is just a WAV (22kHz, 16bit stereo) instead of an AIFF.
  • The "Images" file is actually a Marathon "wad" file (i.e. it has the same structure as M2/Minf map files). There is one directory entry for each picture, each containing a 'pict' tag and (optionally) a 'clut' tag. The 'pict' tags appear to store uncomressed image data with just a small header giving the dimensions and color depth of the picture. The picture resource ID is stored in the "index" member of the directory_entry structure.

Here is an example of what one entry looks like (produced with the 'dumpwad' utility that is now in CVS):

Directory entry 2:
data size 308784, index 1400

2 tags:
'pict' (0x70696374), size 307210
'clut' (0x636c7574), size 1542


This corresponds to the PICT resource ID 1400 in the Mac "Images" file.

  • The "Map" file stores terminal pictures in the same way as in the "Images" file ('pict' and 'clut' tags). They are not part of the per-level tags but in separate directory entries after the entries for the game levels. Their directory_data has the mission, environment, and entry point flags members set to 0, and the "index" set to the PICT ID, as in the "Images" file:
Directory entry 41:
data size 308784, index 1500
level name 'IMG1500.8'
mission flags:
none
environment flags:
none
entry point flags:
none

2 tags:
'pict' (0x70696374), size 307210
'clut' (0x636c7574), size 1542

(this is the first picture in the "Map" file, directory entry 40 is the last proper level of the game ("5-D Space"))

  • In general, there appear to be no endianess differences in the files.The Win95 files use big-endian byte-order even for the additional data.

I'm not exactly sure where the chapter screen sounds are stored. They are not in the "Map" file. Maybe they are in the "Sounds" file. The Win95 "Sounds" file has 212 sounds while the Mac file has 203 sounds. The difference of 9 sounds is exactly the number of 'snd' resources in the Mac M2 "Map" file.

Supporting the Win95 file formats in Aleph One seems to be simple: The "Sounds" and "Shapes" are the same, replaying a WAV file is trivial, and the code in images.cpp can easily be expanded to check whether the "Images" file is in wad format, and to look for images in wad directory entries in the "Images" and "Map" files, with complete backwards compatibility and fallbacks in either case.

I intend to work on this (and on completing TCP/IP networking) this weekend or next week (this week is going to be busy...).