Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:PIG (Descent)

From ReverseEngineering.wiki
Format
Magic D2: 50 50 49 47 ("PPIG") + int32 2; D1: none
Extensions .pig
Endianness little
On this wiki Facts · Code · Notes · Topics

Bitmap and sound container of Descent 1 (DESCENT.PIG) and Descent 2 (GROUPA.PIG etc.): a table of 17-byte (D1) or 18-byte (D2) bitmap headers and 20-byte sound headers, then the data; D2 files start with the tag 'PPIG' and version 2, D1 files are told apart by file size.

Descent 2

Header, little-endian: int32 id (bytes PPIG), int32 version (2), int32 N_bitmaps, then N_bitmaps DiskBitmapHeader of 18 bytes. Bitmap data follows the headers; a bitmap's data offset is header.offset + data_start, where data_start is the file position after the last bitmap header. Sounds are not in the PIG; they are in the sound files (descent2.s11, descent2.s22) or, for older versions, in the HAM (see Format:HAM (Descent)).

Descent 1

There is no tag. Rebirth distinguishes the releases by the exact file size of descent.pig (listed in the fact). For the retail/1.4 sizes the file starts with an int32 Pigdata_start, the position where the bitmap table begins (Rebirth reads the game tables from the bytes in between when BITMAPS.TBL is absent); for the shareware 1.0-1.4 and the 1.0 retail sizes the table begins at offset 0. At Pigdata_start: int32 N_bitmaps, int32 N_sounds, N_bitmaps 17-byte bitmap headers, N_sounds 20-byte sound headers, then the data. Data offsets are offset + header table size + 8 + Pigdata_start.

Bitmap header fields

See the structs. dflags bits 0-5 are the animation frame number and bit 6 marks an animated bitmap (ABM); Rebirth names such bitmaps name#frame. Descent 1 uses bit 7 of dflags to add 256 to the width; Descent 2 stores the high 4 bits of width and height in wh_extra. The flags byte carries transparency, RLE and lighting flags (Rebirth copies BM_FLAG_TRANSPARENT, SUPER_TRANSPARENT, NO_LIGHTING and RLE from it; the numeric values of those flags were not read).

Unverified

Unverified: the RLE compression format of the bitmap data and the palette (256-color palette files) were not read here; Descent 3 does not use this format.

Code & repositories

  • https://github.com/dxx-rebirth/dxx-rebirth @ 6943b924bea749543ef5729f31a28345e79716d2 · license: GPL-3.0-only (declared by the contributor; GitHub's detector did not recognize COPYING.txt)
    D1X-Rebirth/D2X-Rebirth source port of Descent 1 and 2: similar/main/piggy.cpp (PIG, HAM, sound files), similar/main/bm.cpp (game tables), d2x-rebirth/utilities/hogcreate.c and hogextract.c (HOG). Distributed under GPLv3 with a special exception for the original Parallax license (COPYING.txt); cite facts only.
    Tested on: source read, not run: source read at the cited commit, not run · checked 2026-10-19; last activity 2026-10-11