The "/FONT/kaomado.kao" file contains character portraits for the Pokémon Mystery Dungeon: Explorers games. It consists of a table of content, also used to look-up portraits available to each characters, and a data section filed with the actual portraits.
By default it contains enough ToC entries for 1,154 pokemon. Out of those, only 652 are in use, and many are placeholders containing duplicate data.
|0x00||160||Null Entry||The first entry in the table of content is entirely filled with zeros.|
|0xA0||ToC End Offset - 160||Table of Content||The table of content goes from here, to the offset of the first valid pointer in the ToC. More details below in the Table of Content section.|
|After ToC||Varies||Portraits Data||This is where all the portrait data is stored one after the other. More details in the Portraits Data section below.|
Table of Content
Each block of 160 bytes represent all possible portrait slots for a single pokemon. There are 40 potraits slots per pokemon, however not a single pokemon uses its 40 slots. Each of these slots are 32 bits signed integers containing the offset of the portrait data it refers to. Most of those slots are filled with a null value.
The null value is particular in that, its not just 0. Its actually calculated by taking the end offset of the data pointed to by the last valid pointer we've encountered starting from offset 0, and then changing the sign of the end offset to negative.
For example, if our last valid pointer's value is 0x030058, and the end offset of the data pointed to by that pointer is 0x03034C. Then the value for any subsequent null entries, until the next non-null one would be:
-( 0x0003034C ) => 0xFFFCFCB4
|0x0||4||little||int32||Portrait Pointer 0||The Table of Content is made up of 40 pointers such as this one. Their value is signed!|
|... Rest of the pointers here ...|
|0x9C||4||little||int32||Portrait Pointer 39||This is the last entry for this pokemon's block !|
Each portraits is made up of 2 things. A 16 color palette, followed immediately by a AT4PX compressed container containing the actual image data for the portrait.
The portraits do not carry any information about their formats. However, we do know that they're all 4 bits per pixels indexed images, and have a resolution of 40 x 40 pixels. The images are also tiled, which means they're made up of smaller "images" called tiles. Each tile is 8 x 8 pixels itself. Each tiles are filled linearly with the pixels contained in the decompressed file. The portraits are made of 5 tiles on their width, and 5 on their height for a total of 25 tiles.
|0x00||48||-||-||Color Palette||The first part of a portrait block is a 16 colors RGB 24 bits palette, stored on 3 bytes per color. The first color is transparent.|
|0x30||Varies||-||-||Compressed Image||This contains the actual image data for the portrait. Its a compressed AT4PX container that contains the raw pixels of the image. The image itself, once decompressed, is stored as an indexed 4 bits per pixels, 40x40, tiled image. Once decompressed each images has a length of 800 bytes.|
So far, it seems that some of those 40 slots for portraits are re-used between pokemon.
For example, slot 0 is the "standard" default image shown when a pokemon talk, or the image that appears in Chimecho's assembly for a pokemon specie. It seems that odd numbered slots are a relic from Pokémon Mystery Dungeon : Blue Rescue Team. They contain mirrored portraits for some characters. However, the PMD:Explorers games all support mirroring the portraits at runtime. And so, it appears that most pokemon never use odd numbered slots. Even numbered slots on the other hand contain the portraits of the pokemon facing right.
|0||Standard||Default pokemon portrait (Blue-Green BG)|
|2||Grin||Smiling pokemon portrait (Yellow-Orange BG)|
|4||Pained||Pained/Discouraged pokemon portrait (Blue-LightBlue BG)|
|6||Angry||Angry pokemon portrait (Read-Pink with sharp white line BG)|
|8||Worried||Worried pokemon portrait (blue-lightblue BG)|
|10||Sad||Sad/Disapointed pokemon portrait (blue-lightblue BG)|
|12||Crying||Crying pokemon portrait (blue-lightblue BG)|
|14||Shouting||Shouting pokemon portrait (Blue with light yellow "sunrays" BG)|
|16||Teary Eye||Teary eyed pokemon portrait (Light pink-darker pink BG)|
|18||Determined||Determined pokemon portrait (pink-red pink BG)|
|20||Joyous||Joyous/Very Happy/Ecstatic pokemon portrait (light yellow-yellow BG)|
|22||Inspired||Inspired/Admirative/Amazed pokemon portrait (light yellow-yellow BG)|
|24||Surprised||Surprised/Shocked pokemon portrait (blue-light blue BG)|
|26||Dizzy||Dizzy/(Spiral-Eyed) pokemon portrait (green to yellowish green BG)|
|32||Sigh||Sigh/Embarassed/Relieved pokemon portrait (light yellow to yellow BG)|
|34||Stunned||Stunned/Disheartened/Unnerved pokemon portrait (dark blue to light blue BG)|
|36||-||Wigglytuff YOM-TAH !|
A big thanks to Zhorken, who figured out the compression format, the emotion name corresponding to each slots, and to what Pokémon each blocks of 160 bytes in the ToC was associated to!
Edited by evandixon
There are no comments to display.