Skip to content
alice pellerin edited this page Feb 3, 2024 · 5 revisions

DEX files are used to store cutscenes/scripted events. At a high level, a DEX file is simply a nested list of commands, each executed one after the other.

               0x00          0x04          0x08          0xC
╭───────────────┼─────────────┼─────────────┼─────────────┼────────────┬───────────╮
│ Raw           │ 44 45 58 00 │ 17 00 00 00 │ 0C 00 00 00 │            │           │
├───────────────┼─────────────┼─────────────┼─────────────┤            │           │
│ Little-endian │ 00584544    │ 00000017    │ 0000000C    │ Indexes... │ Scenes... │
├───────────────┼─────────────┼─────────────┼─────────────┤            │           │
│ Formatted     │ "DEX"       │ 23          │ 12          │            │           │
╰───────────────┼─────────────┼─────────────┼─────────────┴────────────┴───────────╯
                ╰╴File Format ╰╴Scene count ╰╴Constant offset to indexes

Source: episode/e0047

Index

╭───────────────┬─────────────╮
│ Raw           │ 94 00 00 00 │
├───────────────┼─────────────┤
│ Little-endian │ 00000094    │
├───────────────┼─────────────┤
│ Formatted     │ 148         │
╰───────────────┼─────────────╯
                ╰╴Offset to scene (from DEX+0)

Source: episode/e0047

Scene

Each scene is a list of commands. I'm not sure what role scenes serve, but they at least serve to break the list of commands into chunks.

               0x00          0x04          0x8
╭───────────────┼─────────────┼─────────────┼────────────┬─────────────╮
│ Raw           │ 25 00 00 00 │ 08 00 00 00 │            │             │
├───────────────┼─────────────┼─────────────┤            │             │
│ Little-endian │ 00000025    │ 00000008    │ Indexes... │ Commands... │
├───────────────┼─────────────┼─────────────┤            │             │
│ Formatted     │ 37          │ 8           │            │             │
╰───────────────┼─────────────┼─────────────┴────────────┴─────────────╯
                │             ╰╴ Constant offset to indexes
                ╰╴Command count

Source: episode/e0047

Index

╭───────────────┬─────────────╮
│ Raw           │ 9C 00 00 00 │
├───────────────┼─────────────┤
│ Little-endian │ 0000009C    │
├───────────────┼─────────────┤
│ Formatted     │ 156         │
╰───────────────┼─────────────╯
                ╰╴ Offset to command (from Scene+0)

Source: episode/e0047

Command

There are many different types of commands, but they're all stored in the same way. A type of command always has the same number of arguments.

               0x00          0x04          0x08          0x0C
╭───────────────┼─────────────┼─────────────┼─────────────┼──────────────╮
│ Raw           │ 14 00 00 00 │ 01 00 00 00 │ 0C 00 00 00 │              │
├───────────────┼─────────────┼─────────────┼─────────────┤              │
│ Little-endian │ 00000014    │ 00000001    │ 0000000C    │ Arguments... │
├───────────────┼─────────────┼─────────────┼─────────────┤              │
│ Formatted     │ 20          │ 1           │ 12          │              │
╰───────────────┼─────────────┼─────────────┼─────────────┴──────────────╯
                ╰╴Type        │             ╰╴Constant offset to arguments
                              ╰╴Argument count

Source: episode/e0047

Argument

╭───────────────┬─────────────╮
│ Raw           │ 1E 00 00 00 │
├───────────────┼─────────────┤
│ Little-endian │ 0000001E    │
├───────────────┼─────────────┤
│ Formatted     │ 30          │
╰───────────────┼─────────────╯
                ╰╴Argument value (a signed integer)

Source: episode/e0047

Found

episode/e*

Clone this wiki locally