Archive Header
Offset | Size | Description |
---|---|---|
0x00 | 4 bytes | Magic Number: Always MPCU |
0x04 | 4 bytes | Offset from the top of the file where the catalog can be found. |
The first four bytes at CatalogOffset is always the number of records contained in the Catalog (CatalogSize. An array of these records immedately follow the CatalogSize have the following format:
Archive Record
Offset | Size | Description |
---|---|---|
0x00 | 64 bytes | FileName |
0x40 | 4 bytes | FileOffset in bytes from the top of the archive |
0x44 | 4 bytes | FileSize in bytes |
0x48 | 4 bytes | Unclear, but it's the same number as the FileSize |
0x4C | 4 bytes | FileType: 1=General, 2,4=Tile graphics, 3=Unclear what these are, 5=Frame (a different form of graphic file) |
General Notes
That's pretty much it for the archive format. It is quite trivial to walk the archive catalog and dump the raw files to disk, but they're not entirely useable as they are.
- Type: General
These files can be in many different formats. The Hyperspace Delivery Boy demo has MP3, WAV, LUA, and MSM files under this type. Fortunately, the files are there in their entirety, and the simple addition of an extension is all that is needed. In the case of the HDB demo, the extension is provided as part of the filename already. All you have to do is convert the last underscore to a period and you're done. (See the example code)
- Type: Tile graphics
Tile files are an apparently proprietary bitmap format. They're quite simple to decode, however. First, we skip the first 72 bytes. From there, they all appear to be 32x64 pixels in size. The top 32x32 block is the image while the bottom 32x32 block is a masking image. The colors are stored in 16-bit words with 5 bits going to each of red and blue, and 6 bits going to green.
RRRRR--- -------- red -----GGG GGG----- green -------- ---BBBBB blue
The sample application converts these images to standard 24-bit windows BMP files.
- Type: Frame graphics
These are similar in some ways to the Tile graphics, but different in others. The size of the frame is specified in the first 8 bytes of the file. 4 bytes for width in pixels followed by 4 bytes for height. We skip the 68 subsequent bytes of the file to get to the image bits. We don't have the implicit image-doubling (image and mask) like in the tiles, but the color data here is identical what was discussed above. Again, the sample code converts these to 24-bit windows BMP files.
Sample code:
Here is a small amount of code for a command line utility I wrote in less than 2 hours a few years ago. I've since spiffed the code up a little, but it's not exactly industrial quality. You have been warned. :-) If you want to try this out, you'll need the MPC file from Hyperspace Delivery Boy. I don't host the file here because it's not mine to give out.