|
| 1 | +# MES File Format |
| 2 | +Used to store texts in: |
| 3 | +* *Pokémon Ranger: Shadows of Almia* (version 1) |
| 4 | +* *Pokémon Ranger: Guardian Signs* (version 2) |
| 5 | + |
| 6 | +## Format specifications |
| 7 | +### Common |
| 8 | +* 32-bit little-endian integer values |
| 9 | +* Encoded as raw byte strings |
| 10 | +* Always null-terminated |
| 11 | +* Followed by zero padding so that the total size is a multiple of 4 bytes |
| 12 | + |
| 13 | +### Pokémon Ranger: Shadows of Almia |
| 14 | +Use version 1 of the MES format, where strings are stored sequentially, each preceded by a block size. They are read in order; offsets are implicit. |
| 15 | +```rust |
| 16 | +{ |
| 17 | + u32 total_size // total file size in bytes |
| 18 | + u32 count // number of strings |
| 19 | +} |
| 20 | +``` |
| 21 | + |
| 22 | +Repeat count times: |
| 23 | +```rust |
| 24 | +{ |
| 25 | + u32 block_size // string length + null terminator + padding bytes |
| 26 | + char string[] // null-terminated |
| 27 | + // zero padding bytes |
| 28 | +} |
| 29 | +``` |
| 30 | + |
| 31 | +### Pokémon Ranger: Guardian Signs |
| 32 | +Use version 2 of the MES format, where strings are stored in a data section and referenced sequentially via an offset table. |
| 33 | +```rust |
| 34 | +{ |
| 35 | + u32 total_size // total file size in bytes |
| 36 | + u32 count // number of strings |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | +Offset table begins at byte `0x08` and count entries. Offsets are absolute, relative to the start of the file. |
| 41 | +```rust |
| 42 | +{ |
| 43 | + u32 offset[0] |
| 44 | + u32 offset[1] |
| 45 | + // ... |
| 46 | + u32 offset[n-1] |
| 47 | +} |
| 48 | +``` |
| 49 | + |
| 50 | +String data, repeated for each string: |
| 51 | +```rust |
| 52 | +{ |
| 53 | + char string[] // null-terminated |
| 54 | + // zero padding bytes |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +## List of control characters |
| 59 | +Unless constants are specified, X is a numeric variable, whose action associated with its value (usually 0, then 1, 2, etc. if necessary) is assigned on the fly in the game code. For instance, if the game decides to set `[P:0]` to Pikachu, then using `[P:0]` in the text displayed at that moment will display the name "Pikachu". Another instance: the text color is a constant, so using `[C:5]` in the text will always output green text. |
| 60 | + |
| 61 | +### Pokémon Ranger: Shadows of Almia |
| 62 | +* `[B]` Big text |
| 63 | +* `[C:X]` Text color |
| 64 | + * `0` Transparent |
| 65 | + * `1` White |
| 66 | + * `2` Black (default) |
| 67 | + * `3` Red |
| 68 | + * `4` Blue |
| 69 | + * `5` Green |
| 70 | +* `[E]` Line break |
| 71 | +* `[F:X]` Move name |
| 72 | +* `[K:X]` Number |
| 73 | +* `[M]` Player name |
| 74 | +* `[N:X]` Pokémon encounter text |
| 75 | + * `0` Empty |
| 76 | + * `1` "The wild" (default) |
| 77 | + * `2` "attacked!" |
| 78 | +* `[O:XX]` Display image |
| 79 | + * `04` Styler Menu button icon |
| 80 | + * `05` Change Screen button icon |
| 81 | +* `[P:X]` Pokémon name |
| 82 | +* `[Q]` Yes/No question |
| 83 | +* `[R]` New dialog page after button press |
| 84 | +* `[V:X]` Play Pokémon cry |
| 85 | +* `[W:XX]` Text speed |
| 86 | + * `00` Default |
| 87 | + * `01` Fast |
| 88 | + * `03` A bit slow |
| 89 | + * Slower as the value increases |
| 90 | + * `60` Slowest speed used in-game |
| 91 | +* `[Y:X]` Target name |
| 92 | + |
| 93 | +### Pokémon Ranger: Guardian Signs |
| 94 | +* `[C:X]` Text color |
| 95 | + * `0` White (default) |
| 96 | + * `1` Orange in Ranger Net menu, white elsewhere |
| 97 | + * `2` Black |
| 98 | + * `3` Red |
| 99 | + * `4` Blue |
| 100 | + * `5` Green |
| 101 | +* `[D]` Resets text speed to default, remove first character on the right |
| 102 | +* `[D:]` Resets text speed to default |
| 103 | +* `[E]` Line break |
| 104 | +* `[F:X]` Destination name |
| 105 | +* `[K:X]` Number |
| 106 | +* `[M]` Player name, remove first character on the right |
| 107 | +* `[M:]` Player name |
| 108 | +* `[N:X]` Player's counterpart name |
| 109 | +* `[O:XX]` Display image |
| 110 | + * `00` Speech bubble with ellipsis |
| 111 | + * `01` Cut Field Move icon |
| 112 | + * `02` Recharge Field Move icon |
| 113 | + * `03` Fire Group icon |
| 114 | + * `04` Water Group icon |
| 115 | + * `05` Grass Group icon |
| 116 | + * `06` Electric Group icon |
| 117 | + * `07` Ground Group icon |
| 118 | +* `[P:X]` Pokémon name |
| 119 | +* `[Q]` Yes/No question (auto skip text if no answer is defined) |
| 120 | +* `[Q:]` Yes/No question (auto skip text if no answer is defined), remove first character on the right |
| 121 | +* `[R]` New dialog page after button press |
| 122 | +* `[S:XX]` Text speed, testing only and non-functional |
| 123 | +* `[T:X]` Target name |
| 124 | +* `[W:XX]` Text speed |
| 125 | + * `00` Instant |
| 126 | + * `01` Fast |
| 127 | + * `02` Normal (default) |
| 128 | + * Slower as the value increases |
| 129 | + * `90` Slowest speed used in-game |
0 commit comments