Skip to content

DM2 File Formats

Daniel Nylander edited this page Aug 1, 2026 · 1 revision

Dungeon Master II: The Legend of Skullkeep File Formats

Dungeon Master II (DOS). All multi-byte values are little-endian unless noted otherwise.

GRAPHICS.DAT — GDAT Archive

Field Value
Size ~8.6 MB
Format GDAT typed record graph
Categories 240 (vs DM1's 29)
Category limit 0xF0

DM2's GRAPHICS.DAT is NOT a flat sprite sheet. It is a structured GDAT archive containing all graphics, sound, music, text, and interface data in a typed record graph.

GDAT Entry Structure

Each entry consists of 6 classification bytes plus a 2-byte data index:

Offset  Size  Description
0x00    6     cls1-cls6 (classification bytes)
0x06    2     data_index (uint16)

GDAT Entry Types

Type ID Description
IMAGE 0x01 Bitmap image
SOUND 0x02 Sound effect
HMP 0x03 HMP music
RAW4 0x04 Raw type 4
TEXT 0x05 Text string
RAW6 0x06 Raw type 6
RAW7 0x07 Raw type 7
RAW8 0x08 Raw type 8
PAL_IRGB 0x09 IRGB palette
WORD_VALUE 0x0B 16-bit value
IMAGE_OFFSET 0x0C Image offset reference
PAL_16 0x0D 16-color palette

Key GDAT Categories

ID Name Description
0x00 TECHDATA Technical/system data
0x01 INTERFACE_GENERAL General UI elements
0x02 SPELL_DEF Spell definitions
0x03 MESSAGES Game messages/text
0x04 MUSICS Music tracks (HMP)
0x05 TITLE Title screen
0x06 CREDITS Credits screen
0x07 INTERFACE_CHARSHEET Character sheet UI
0x08 GRAPHICSSET Graphics set definitions
0x09 WALL_GFX Wall textures
0x0A FLOOR_GFX Floor textures
0x0B DOOR_GFX Door textures
0x0F CREATURES Creature sprites (64 types)
0x10 WEAPONS Weapon sprites
0x17 ENVIRONMENT Outdoor assets
0x1C JAPANESE_FONT Japanese font data

Image Formats

IMG3 — 4-bit Nibble RLE

Field Value
Type ID 3
BPP 4
Encoding Nibble run-length encoding

Used for simple textures. Reads nibbles and durations via read_nibble and read_duration functions. Has underlay and overlay variants for doors and panels.

IMG9 — 9-bit Per-Pixel

Field Value
Type ID 9
BPP 9

Used for complex wall textures requiring more color depth.

U4 — Unpacked 4-bit

Field Value
Type ID 4
BPP 4

Uncompressed 4-bit source, returned as 8-bit indexed pixels.

U8 — Uncompressed 8-bit

Field Value
Type ID 8
BPP 8

Uncompressed 8-bit palette index data.

Image Metadata

Field Type Description
Width uint16 Image width
Height uint16 Image height
Bits per pixel uint8 Color depth
Query offset X int16 X draw offset
Query offset Y int16 Y draw offset
Graphicsset offset flag Uses graphics set offset
Image offset flag Uses image offset reference

Palette System

The palette chain flows through multiple stages:

dtPalIRGB → dtPalette16 → material/interface palette → framebuffer
  • Main palette: 256 colors, VGA 6-bit RGB components (>>2 step)
  • 16-color logical index table for per-texture palette selection
  • Each map selects a graphics set; wall textures decoded for one set cannot be reused for another
  • Day/night palette variants with runtime switching for outdoor levels

Display Modes

Mode Resolution Use
Standard 320x200 Indoor dungeon levels
Extended 640x400 Outdoor levels

DUNGEON.DAT — Dungeon Data

Field Value
Size ~39 KB

DM2's dungeon format extends DM1 with outdoor area support and room structures. Loaded through dm2_v1_boot_enter_game() after hash verification.

Extensions from DM1

  • Room descriptors (referenced via room helper functions)
  • Outdoor area support
  • Extended thing types for DM2-specific objects

HMP Music

HMP music is stored as original GDAT payload within GRAPHICS.DAT (GDAT type 0x03), not as a separate host-side file. The music system processes HMP data directly from the GDAT record graph.

File Verification

GRAPHICS.DAT identity is verified by content hash (low 32 bits of MD5). DUNGEON.DAT is loaded only after hash verification.

Clone this wiki locally