PCX Library

From ModdingWiki
Jump to: navigation, search
PCX Library
Format typeArchive
Max files65,535
File Allocation Table (FAT)Beginning
Filenames?Yes, 8.3
Metadata?None
Supports compression?No
Supports encryption?No
Supports subdirectories?No
Hidden data?Yes
Games

Some games use PCX libraries to store .PCX files. This format was developed by Genus Microprogramming, Inc. and is handled by the PCXLIB.EXE tool distributed with their PCX Utilities (later renamed to PCX Toolkit). This library file archive format has two versions, here called v1 and v2. Unlike v1 there is no public documentation for v2, so more research is needed. Note that the library file may contain not only .PCX images, but any type of file.

The default library extensions are .PCL or .LIB, but this is not required. Library files can be easily identified by the copyright text at the beginning (see below).

Library files consists of two parts - the header and file directory.

PCX library v1 format

Each file begins with the following header.

Data type Name Description
char[10] id Library ID string. Must be null-terminated "pcxLib" string. Following three bytes are unused and generally random (e.g. "pcxLib\x00\x14\xBE\x00"). Some games (at least those using toolkit v3.53) only verify the first character is 'p' and ignore the rest.
char[50] copyright Copyright notice (example: "Copyright (c) Genus Microprogramming, Inc. 1988-89"). The copyright notice is never verified.
INT16LE version pcxLib version
char[40] vollabel Library volume label
char[20] xtra Filler

Immediately after the header are the files, each with their own header.

Data type Name Description
UINT8 synch Synch byte (always 1)
char[13] name Image file name (8.3, name padding with spaces before dot from extension, ends with 0)
UINT32LE size File size
UINT16LE data File date
UINT16LE time File time
UINT16LE pack Packing type
char[40] note Image note
char[20] xtra Extra filler, unused/ignored, set to 0

After the file's header is size bytes of file data. This file header and file data are then repeated for each file in the library. The library file should be read until the end of the file or while synch byte still 1 (in case of extra data at the end of the library).

PCX library v2 format

Each file begins with the following header.

Data type Name Description
UINT16LE id Library ID. Must be 0xCA01 (bytes 0x01 0xCA)
char[50] copyright Copyright notice (example: "Copyright (c) Genus Microprogramming, Inc. 1988-90"). The copyright notice is never verified.
UINT16LE version pcxLib version. Always 100 (0x0064)
char[40] vollabel Library volume label
UINT16LE count Number of files in the library
BYTE[32] xtra Pad structure up to 128-bytes, unused/ignored, set to 0

After the header is count records of an image header and image data:

Data type Name Description
UINT8 synch Synch byte (always 0)
char[13] name Image file name (8.3, name padding with spaces before dot from extension, ends with 0)
UINT32LE offs File offset (absolute)
UINT32LE size File size
UINT16LE data File date
UINT16LE time File time

After this records follows file data for each file in library. The files in the directory are NOT in the same order as the files in the archive (i.e. file 1 in the directory may actually be file 5 in the archive, etc).

Tools

The following tools are able to work with files in this format.

Name PlatformExtract files? Decompress on extract? Create new? Modify? Compress on insert? Access hidden data? Edit metadata? Notes
PCX library unpacker WindowsYesN/ANoNoN/ANoNo PCX library v1/v2 support (with Delphi source code)
Camoto Linux/WindowsYesN/AYesYesN/ANoNo PCX library v2 only

Credits

This file format was reverse engineered by CTPAX-X_Team. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)