Difference between revisions of "Pokémon Mystery Dungeon: Red Rescue Team:Pokémon Graphics:Overworld Animations"

From Data Crystal
Jump to navigation Jump to search
(Created page with "There are 423 SIRO files pointed to by the [http://datacrystal.romhacking.net/wiki/Pok%C3%A9mon_Mystery_Dungeon:_Red_Rescue_Team:Pok%C3%A9mon_Graphics:Pointer_Table graphics P...")
 
(figure out the unknown data)
 
(21 intermediate revisions by 3 users not shown)
Line 1: Line 1:
There are 423 SIRO files pointed to by the [http://datacrystal.romhacking.net/wiki/Pok%C3%A9mon_Mystery_Dungeon:_Red_Rescue_Team:Pok%C3%A9mon_Graphics:Pointer_Table graphics Pointer Table]. Each one represents a different Pokemon graphics file. The structure of these individual files is as follows.
+
{{subpage|game=Pokémon Mystery Dungeon: Red Rescue Team:ROM map}}
  
== Header ==
+
{{Infobox table|name=Pokémon Graphics: Overworld Animations
 +
|game=Pokémon Mystery Dungeon: Red Rescue Team
 +
|loc=ROM
 +
|start=0x0511F30
 +
|end=0x167FE77
 +
|numentries=423
 +
|entrylength=varies
 +
|totallength=18276168 bytes (0x116DF48)
 +
}}
 +
 
 +
There are 423 SIRO files pointed to by the [[Pokémon Mystery Dungeon: Red Rescue Team:Pokémon Graphics:Pointer Table|Pokémon Graphics Pointer Table]]. Each one represents a different Pokemon graphics file. The structure of these individual files is as follows.
 +
 
 +
==Header==
 
* Note - all pointers are stored in little-endian format.
 
* Note - all pointers are stored in little-endian format.
 
<pre>
 
<pre>
Line 11: Line 23:
  
 
==Animation Data Before Sprites==
 
==Animation Data Before Sprites==
 +
There are two sections before the sprites begin.
 +
===Animation Frame===
 
Comes in 0x14 byte increments which each represent a frame of the animation.
 
Comes in 0x14 byte increments which each represent a frame of the animation.
 +
 
<pre>
 
<pre>
 
Address  Size    Description
 
Address  Size    Description
 
--------  ----  ----------------
 
--------  ----  ----------------
0000      0004   The index of the sprite to be displayed.
+
0000      0002   The index of the sprite to be displayed.
0004      0001    Vertical Displacement Value
+
0002      0002    Does Palette Effects - Use unknown
0005      0001    Unknown
+
Obj Attribute 0 {
0006      0001   Horizontal Displacement
+
0004      0001    Vertical Displacement (Signed Short)
0007     0001    Unknown
+
0005      0001    Tile Byte - Tells data about the tile
0008      0002    Unknown
+
                      bit  8      : Rotation/Scaling Flag
000A      000A    Allows VRAM to be cleared.
+
                      bit  9      : When bit 8 set to 1: Double-Size Flag (0=Normal, 1=Double)
 +
                                    When bit 8 set to 0: OBJ Disable          (0=Normal, 1=Not displayed)
 +
                      bit  10 ~ 11 : OBJ Mode  (00=Normal, 01=Semi-Transparent, 10=OBJ Window, 11=Prohibited)
 +
                      bit  12      : Mosaic (0=Off, 1=On)
 +
                      bit  13      : Color Mode (0=16/16, 1=256/1)
 +
                      bit  14 ~ 15 : OBJ Shape (00=Square, 01=Horizontal, 10=Vertical, 11=Prohibited)
 +
}
 +
Obj Attribute 1 {
 +
0006      0002   bit  0 ~  8  : Y Coordinate
 +
                  When Object Attribute 0:Rotation/Scaling Flag Set
 +
                  bit  9 ~ 13  : Rotation Scaling Parameter Selection
 +
 
 +
                  When Object Attribute 0:Rotation/Scaling Flag NOT Set
 +
                  bit  9 ~ 11  : Unused
 +
                  bit  12      : Horizontal flip bit
 +
                  bit  13     : Vertical flip bit
 +
 
 +
                  bit  14 ~ 15 : OBJ Size (0..3, depends on OBJ Shape, see address 0005)
 +
                      Size Square Horizontal Vertical
 +
                      0 8x8 16x8         8x16
 +
                      1 16x16 32x8         8x32
 +
                      2 32x32 32x16         16x32
 +
                      3 64x64 64x32         32x64
 +
}
 +
Obj Attribute 2 {
 +
0008      0002    bit  0 ~  9 : Tile Number
 +
                  bit 10 ~ 11 : Priority Relative to BG (Usually 11)
 +
                  bit 12 ~ 15 : Palette number (May different than the Pokemon's palette number)
 +
}
 +
000A      000A    Allows VRAM to be cleared. Usually all FFs
 
</pre>
 
</pre>
  
The next section deals with animation timing.
+
Obj Attributes are documented at [http://problemkaputt.de/gbatek.htm#lcdobjoamattributes GBATek].
 +
 
 +
===Animation Timing===
 +
The next section deals with animation timing in the following format:
 +
<pre>
 +
Total Size: 0x0C
 +
 
 +
Address  Size    Description
 +
--------  ----  ----------------
 +
0000      0002  Number of frames to display sprite.
 +
0002      0002  Index of Animation Frame to be displayed.
 +
0004      0002  Horizontal Displacement    -Signed Short
 +
0006      0002  Vertical Displacement      -Signed Short
 +
0008      0002  Shadow Horizontal Displacement    -Signed Short
 +
000A      0002  Shadow Vertical Displacement      -Signed Short
 +
 
 +
</pre>
  
 
==Overworld Sprites==
 
==Overworld Sprites==
Line 31: Line 91:
 
The sprite data pointers in the data after the sprites point to each individual sprite's data.
 
The sprite data pointers in the data after the sprites point to each individual sprite's data.
  
The individual sprite data is in this format when it only points to one sub sprite:
+
When the sprite data pointer points at the individual sprite pointer, this is the format:
 
<pre>
 
<pre>
 
Address  Size    Description
 
Address  Size    Description
Line 38: Line 98:
 
0004      0002  Number of bytes to read (little endian)
 
0004      0002  Number of bytes to read (little endian)
 
</pre>
 
</pre>
Very frequently, the individual sprite data is split into sub sprites and is different. Possibly due to different tile alignment.
+
When the sprite pointer points at 4 bytes with the value 00, this is the format:
 
<pre>
 
<pre>
 
Address  Size    Description
 
Address  Size    Description
 
--------  ----  ----------------
 
--------  ----  ----------------
 
{
 
{
   0000      0004  Unknown - Possibly a flag to tell where to stop reading sub sprites.
+
   0000      0004  0x00
   0004     0004  Pointer to individual sprite
+
  0004      0004  Amount of blank space written before sub sprite.
   0008     0002   Number of bytes to read (little endian)
+
   0008     0004  Pointer to individual sprite
  000A      0006  Unknown (Nothing?)
+
   000C     0004   Number of bytes to be read (little endian)
 
}
 
}
 
Repeats until every sub sprite has been pointed to.
 
Repeats until every sub sprite has been pointed to.
 
</pre>
 
</pre>
 +
After every sub sprite has been pointed to, sometimes there is an additional blank space offset without a sprite attached:
 +
<pre>
 +
Address  Size    Description
 +
--------  ----  ----------------
 +
{
 +
  0000      0004  0x00
 +
  0004      0004  Amount of blank space written before sub sprite.
 +
  0008      0008  0x00
 +
}
 +
</pre>
 +
[[File:PMDGBAOffsetExplanation.png|thumb|center|300px|Visual representation of sprite layout.]]
  
 
==Data After Sprites==
 
==Data After Sprites==
 +
Following the sprites are six sections with different information:
 +
:# Table of pointers to the animation data.
 +
:# Body Animation Displacement
 +
:# Pointers to directional animation timing data.
 +
:# Pointers to (#3) each set of directional animations
 +
:# Pointers to Sprite Data
 +
:# The Footer
 +
 +
===Animation Frame Data Pointer Table===
 +
Points to animation frame data.
 +
 +
===Body Animation Displacement===
 +
Indicate each frame's Pokémon's head / left side / right side / body location, it's used by moves animation.
 +
<pre>
 +
Total Size: 0x08
 +
 +
Address  Size    Description
 +
--------  ----  ----------------
 +
0000      0001  Horizontal Displacement for Pokémon's head        -Signed Byte
 +
0001      0001  Vertical  Displacement for Pokémon's head        -Signed Byte
 +
0002      0001  Horizontal Displacement for Pokémon's left side?  -Signed Byte
 +
0003      0001  Vertical  Displacement for Pokémon's left side?  -Signed Byte
 +
0004      0001  Horizontal Displacement for Pokémon's right side?  -Signed Byte
 +
0005      0001  Vertical  Displacement for Pokémon's right side?  -Signed Byte
 +
0006      0001  Horizontal Displacement for Pokémon's body        -Signed Byte
 +
0007      0001  Vertical  Displacement for Pokémon's body        -Signed Byte
 +
 +
</pre>
 +
 +
===Directional Animation Timing Pointer Table===
 +
A repeating set of little-endian pointers that will point to an animation for any direction. For example: each direction of the walking animation would show up here.
 +
<pre>
 +
Index Direction Pointed to
 +
----- --------------------
 +
0x00:  S, SE, E, NE,
 +
0x10:  N, NW, W, SW
 +
</pre>
  
 +
===Pointer to Directional Table===
 +
Points to each set of pointers from the previous section.
  
 +
===Pointers to Sprite Data===
 +
Pointers to the data in between each sprite.
  
== Footer ==
+
===Footer===
 
The header points to another set of pointers starting here and ending at the next SIRO file.
 
The header points to another set of pointers starting here and ending at the next SIRO file.
 
<pre>
 
<pre>
 
Address  Size    Description
 
Address  Size    Description
 
--------  ----  ----------------
 
--------  ----  ----------------
0000      0004  Animation Timing?
+
0000      0004  Pointer to Animation Frame Table
0004      0004  Animation Data?
+
0004      0004  Pointer to Directional Animations - Different animations can be chosen based upon direction.
0008      0004  Unknown
+
0008      0004  Body Animation Displacement
000C      0004  Sprite Data Pointer
+
000C      0004  Sprite Data Pointers
 
0010      0004  Pointer to Unknown Data
 
0010      0004  Pointer to Unknown Data
 
0014      0004  SIRO Header of next Pokemon
 
0014      0004  SIRO Header of next Pokemon
 
</pre>
 
</pre>

Latest revision as of 01:04, 8 October 2016


Pokémon Graphics: Overworld Animations
Game Pokémon Mystery Dungeon: Red Rescue Team
Start Address 0x0511F30
End Address 0x167FE77
# of Entries 423
Entry Length varies
Total Length 18276168 bytes (0x116DF48)
Back to the ROM map

There are 423 SIRO files pointed to by the Pokémon Graphics Pointer Table. Each one represents a different Pokemon graphics file. The structure of these individual files is as follows.

Header

  • Note - all pointers are stored in little-endian format.
Address   Size     Description
--------  ----   ----------------
0000      0004    SIRO Header - Spells out SIRO and begins file.
0004      0004    Pointer to footer - Points to main data structure in each Pokemon

Animation Data Before Sprites

There are two sections before the sprites begin.

Animation Frame

Comes in 0x14 byte increments which each represent a frame of the animation.

Address   Size     Description
--------  ----   ----------------
0000      0002    The index of the sprite to be displayed.
0002      0002    Does Palette Effects - Use unknown
Obj Attribute 0 {
0004      0001    Vertical Displacement (Signed Short)
0005      0001    Tile Byte - Tells data about the tile
                      bit  8      : Rotation/Scaling Flag
                      bit  9      : When bit 8 set to 1: Double-Size Flag (0=Normal, 1=Double)
                                    When bit 8 set to 0: OBJ Disable          (0=Normal, 1=Not displayed)
                      bit  10 ~ 11 : OBJ Mode  (00=Normal, 01=Semi-Transparent, 10=OBJ Window, 11=Prohibited)
                      bit  12      : Mosaic (0=Off, 1=On)
                      bit  13      : Color Mode (0=16/16, 1=256/1)
                      bit  14 ~ 15 : OBJ Shape (00=Square, 01=Horizontal, 10=Vertical, 11=Prohibited)
}
Obj Attribute 1 {
0006      0002    bit  0 ~  8  : Y Coordinate
                  When Object Attribute 0:Rotation/Scaling Flag Set
                  bit  9 ~ 13  : Rotation Scaling Parameter Selection

                  When Object Attribute 0:Rotation/Scaling Flag NOT Set
                  bit  9 ~ 11  : Unused
                  bit  12      : Horizontal flip bit
                  bit  13      : Vertical flip bit

                  bit  14 ~ 15 : OBJ Size (0..3, depends on OBJ Shape, see address 0005)
                      Size 	Square 	Horizontal 	Vertical
                      0 	8x8 	16x8 	        8x16
                      1 	16x16 	32x8 	        8x32
                      2 	32x32 	32x16 	        16x32
                      3 	64x64 	64x32 	        32x64 
}
Obj Attribute 2 {
0008      0002    bit  0 ~  9 : Tile Number
                  bit 10 ~ 11 : Priority Relative to BG (Usually 11)
                  bit 12 ~ 15 : Palette number (May different than the Pokemon's palette number)
}
000A      000A    Allows VRAM to be cleared. Usually all FFs

Obj Attributes are documented at GBATek.

Animation Timing

The next section deals with animation timing in the following format:

Total Size: 0x0C

Address   Size     Description
--------  ----   ----------------
0000      0002   Number of frames to display sprite.
0002      0002   Index of Animation Frame to be displayed.
0004      0002   Horizontal Displacement    -Signed Short
0006      0002   Vertical Displacement      -Signed Short
0008      0002   Shadow Horizontal Displacement    -Signed Short
000A      0002   Shadow Vertical Displacement      -Signed Short

Overworld Sprites

Every Sprite has data associated with it.

The sprite data pointers in the data after the sprites point to each individual sprite's data.

When the sprite data pointer points at the individual sprite pointer, this is the format:

Address   Size     Description
--------  ----   ----------------
0000      0004   Pointer to individual sprite
0004      0002   Number of bytes to read (little endian)

When the sprite pointer points at 4 bytes with the value 00, this is the format:

Address   Size     Description
--------  ----   ----------------
{
  0000      0004   0x00
  0004      0004   Amount of blank space written before sub sprite.
  0008      0004   Pointer to individual sprite
  000C      0004   Number of bytes to be read (little endian)
}
Repeats until every sub sprite has been pointed to.

After every sub sprite has been pointed to, sometimes there is an additional blank space offset without a sprite attached:

Address   Size     Description
--------  ----   ----------------
{
  0000      0004   0x00
  0004      0004   Amount of blank space written before sub sprite.
  0008      0008   0x00
}
Visual representation of sprite layout.

Data After Sprites

Following the sprites are six sections with different information:

  1. Table of pointers to the animation data.
  2. Body Animation Displacement
  3. Pointers to directional animation timing data.
  4. Pointers to (#3) each set of directional animations
  5. Pointers to Sprite Data
  6. The Footer

Animation Frame Data Pointer Table

Points to animation frame data.

Body Animation Displacement

Indicate each frame's Pokémon's head / left side / right side / body location, it's used by moves animation.

Total Size: 0x08

Address   Size     Description
--------  ----   ----------------
0000      0001   Horizontal Displacement for Pokémon's head         -Signed Byte
0001      0001   Vertical   Displacement for Pokémon's head         -Signed Byte
0002      0001   Horizontal Displacement for Pokémon's left side?   -Signed Byte
0003      0001   Vertical   Displacement for Pokémon's left side?   -Signed Byte
0004      0001   Horizontal Displacement for Pokémon's right side?  -Signed Byte
0005      0001   Vertical   Displacement for Pokémon's right side?  -Signed Byte
0006      0001   Horizontal Displacement for Pokémon's body         -Signed Byte
0007      0001   Vertical   Displacement for Pokémon's body         -Signed Byte

Directional Animation Timing Pointer Table

A repeating set of little-endian pointers that will point to an animation for any direction. For example: each direction of the walking animation would show up here.

Index Direction Pointed to
----- --------------------
0x00:  S, SE, E, NE,
0x10:  N, NW, W, SW

Pointer to Directional Table

Points to each set of pointers from the previous section.

Pointers to Sprite Data

Pointers to the data in between each sprite.

Footer

The header points to another set of pointers starting here and ending at the next SIRO file.

Address   Size     Description
--------  ----   ----------------
0000      0004   Pointer to Animation Frame Table
0004      0004   Pointer to Directional Animations - Different animations can be chosen based upon direction.
0008      0004   Body Animation Displacement
000C      0004   Sprite Data Pointers
0010      0004   Pointer to Unknown Data
0014      0004   SIRO Header of next Pokemon