Contents

Technical Documentation - Dungeon Master II Graphics.dat: How to read a directory entry

Author of this documentation: Kentaro.k-21
It will be simple to read.
I took the 1st raw data from dm2 amiga graphics.dat.

ADDRESS 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF
-------------------------------------------------------------------------
0000000 80 01 27 3D 00 07 54 01 49 01 44 01 53 01 46 01 ..'=..T.I.D.S.F.
0000010 47 01 50 02 00 00 08 00 00 00 00 01 00 00 0B 00 G.P.............
0000020 00 00 00 2B 00 01 00 00 00 FE 00 02 01 00 04 00 ...+............
0000030 00 00 00 F3 01 00 05 06 10 00 00 F8 01 00 05 06 ................

The 1st highlighted word value (27 3D) represents how many entries exist in this binary.
Read this value as a big endian word value even if the target platform is oriented in little endian.

In this case, the value is obtained with expression 0x27 * 256 + 0x3D.
It is 10045. There are 10045 entries in dm2 amiga graphics.dat.

The offset of 1st entry begins at 0x00000014.

Each entry has 8 bytes long.

Next table shows known spec information with 1st entry
00000014: 00 00 08 00 00 00 00 01

Position Binary Known meaning
1st byte 00 Main Category. One of following values.
0x00: Unknown
0x01: Unknown (for Graphical Interface?)
0x02: No applicable data
0x03: Unknown (Text message in scrolls and message board?)
0x04: No applicable data
0x05: Unknown
0x06: Unknown
0x07: Unknown (for Graphical Interface in inventory window?)
0x08: Unknown (for wall and tile images?)
0x09: Unknown (for Wall Graphics used in dungeon.dat?)
0x0A: Unknown (for Pad Graphics used in dungeon.dat?)
0x0B: Unknown (for Ornate Graphics used in dungeon.dat?)
0x0C: Unknown
0x0D: Unknown (for magical effect images?)
0x0E: Door entry
0x0F: Creature entry
0x10: Weapon entry
0x11: Cloth entry
0x12: Scroll entry
0x13: Potion entry
0x14: Chest entry (contains magical minion maps)
0x15: Miscellaneous item entry
0x16: Hero entry
0x17: Unknown (for weather images?)
0x18: Unknown
0x19: No applicable data
0x1A: Dialogue Interface
2nd byte 00 Data index in Main Category.
3rd byte 08 Data representation. One of following values.
0x01: Images
0x05: Text
Other: Unknown
4th byte 00 Depending on what kind of "Data representation".
5th byte 00 Depending on what kind of "Data representation".
6th byte 00 Depending on what kind of "Data representation".
7th and 8th byte 00 01 This entry may store the binary index in graphics.dat to represent data.
*If this represents the binary index, it is always stored in big endian format.
Depending on what kind of "Data representation".
0x01: The value indicates an index to stored image.
0x05: The value indicates an index to stored text.
Other: Unknown

This is a sample for image entry.
0001313C: 1A 00 01 00 00 FF 00 11

Position Binary Meaning
1st byte 1A Main Category.
2nd byte 00 Index in Main Category.
3rd byte 01 It represents an image.
4th byte 00 -
5th byte 00 -
6th byte FE -
7th and 8th byte 00 11 0x00 * 256 + 0x11 = 17.
17th raw data (0 based index) has an image for this entry.

This is a sample for text entry.
0001315C: 1A 00 05 14 10 FF 00 12

Position Binary Meaning
1st byte 1A Main Category.
2nd byte 00 Index in Main Category.
3rd byte 05 It represents a text.
4th byte 14 -
5th byte 10 -
6th byte FF -
7th and 8th byte 00 12 0x00 * 256 + 0x12 = 18.
18th raw data (0 based index) has a text for this entry.