Skip to content
alice pellerin edited this page Feb 1, 2024 · 6 revisions

DMG files are used to store dialogue. They are very similar to DTX files, but with 8 extra bytes of information at the beginning of each string.

               0x00          0x04          0x08          0x0C
╭───────────────┼─────────────┼─────────────┼─────────────┼────────────┬────────────╮
│ Raw           │ 44 4D 47 00 │ 45 00 00 00 │ 0C 00 00 00 │            │            │
├───────────────┼─────────────┼─────────────┼─────────────┤            │            │
│ Little-endian │ 00474D44    │ 00000045    │ 0000000C    │ Indexes... │ Strings... │
├───────────────┼─────────────┼─────────────┼─────────────┤            │            │
│ Formatted     │ "DMG"       │ 69          │ 12          │            │            │
╰───────────────┼─────────────┼─────────────┼─────────────┴────────────┴────────────╯
                ╰╴File format │             ╰╴Constant offset to indexes (from DMG+0)
                              ╰╴Number of strings

Source: msg/msg_0071

Index

Each index is simply an offset that points to the beginning of a string.

╭───────────────┬─────────────╮
│ Raw           │ 20 01 00 00 │
├───────────────┼─────────────┤
│ Little-endian │ 00000120    │
├───────────────┼─────────────┤
│ Formatted     │ 288         │
╰───────────────┼─────────────╯
                ╰╴Offset to string (from DMG+0)

Source: msg/msg_0071

String

Each string index is 4-byte aligned, and each UTF-8 string is null-terminated. This occasionally results in a 4-byte block of 0s.

               0x00          0x04          0x08
╭───────────────┼─────────────┼─────────────┼─────────────────╮
│ Raw           │ C8 00 00 00 │ 08 00 00 00 │                 │
├───────────────┼─────────────┼─────────────┤                 │
│ Little-endian │ 000000C8    │ 00000008    │ UTF-8 string... │
├───────────────┼─────────────┼─────────────┤                 │
│ Formatted     │ 200         │ 8           │                 │
╰───────────────┼─────────────┼─────────────┴─────────────────╯
                ╰╴Index       ╰╴Constant offset to string

Source: msg/msg_0071

Found

msg/*

Clone this wiki locally