Pmd2 kaomado.kao: Difference between revisions

From ProjectPokemon Wiki
Jump to navigation Jump to search
m (→‎File Structure: reworded and fixed bad choice of words)
(Added missing categories)
Line 1: Line 1:
[[Category:Structures]]
[[Category:ROM Hacking]]
[[Category:Technical References]]
The "/FONT/kaomado.kao" file contains character portraits for the [[Pokémon Mystery Dungeon Explorers|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.  
The "/FONT/kaomado.kao" file contains character portraits for the [[Pokémon Mystery Dungeon Explorers|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.  



Revision as of 05:19, 10 December 2014


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.

File Structure

Overview

Offset Length Endianness Type Name Description
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


Anatomy of a single ToC entry. (Total size 160 bytes)
Offset Length Endianness Type Name Description
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 !


Portraits Data

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.


Anatomy of a single portrait block
Offset Length Endianness Type Name Description
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.
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.

More Details

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 left.

List of what each slots/pointers in a single pokemon's block are for.
slot# Name Description
0 Standard Default pokemon portrait (Blue-Green BG)
1 - -
2 Grin Smiling pokemon portrait (Yellow-Orange BG)
3 - -
4 Pained Pained/Discouraged pokemon portrait (Blue-LightBlue BG)
5 - -
6 Angry Angry pokemon portrait (Read-Pink with sharp white line BG)
7 - -
8 Worried Worried pokemon portrait (blue-lightblue BG)
9 - -
10 Sad Sad/Disapointed pokemon portrait (blue-lightblue BG)
11 - -
12 Crying Crying pokemon portrait (blue-lightblue BG)
13 - -
14 Shouting Shouting pokemon portrait (Blue with light yellow "sunrays" BG)
15 - -
16 Teary Eye Teary eyed pokemon portrait (Light pink-darker pink BG)
17 - -
18 Determined Determined pokemon portrait (pink-red pink BG)
19 - -
20 Joyous Joyous/Very Happy/Ecstatic pokemon portrait (light yellow-yellow BG)
21 - -
22 Inspired Inspired/Admirative/Amazed pokemon portrait (light yellow-yellow BG)
23 - -
24 Surprised Surprised/Shocked pokemon portrait (blue-light blue BG)
25 - -
26 Dizzy Dizzy/(Spiral-Eyed) pokemon portrait (green to yellowish green BG)
27 - -
28 - -
29 - -
30 - -
31 - -
32 Sigh Sigh/Embarassed/Relieved pokemon portrait (light yellow to yellow BG)
33 - -
34 Stunned Stunned/Disheartened/Unnerved pokemon portrait (dark blue to light blue BG)
35 - -
36 - Wigglytuff YOM-TAH !
37 - -
38 - -
39 - -


Credits

A big thanks to Zhorkenwho figured out the compression format, the emotion corresponding to each slots, and to what pokemon each blocks of 160 bytes in the ToC was associated to !