Skip to content

Field File Section 4: Palette

Niema Moshiri edited this page May 28, 2019 · 2 revisions

The Palette contains color data. This wiki is a useful reference for the Palette section.

4 bytes: Section Length

  • This is a 4-byte unsigned integer denoting the total length (in bytes) of this section

Section Header

4 bytes: Section Length

  • The exact same section length (not sure why it's included again in the Section 4 Header)

2 bytes: PalX

  • This is a 2-byte unsigned integer that is always exactly 0
  • It's useful for the PlayStation version, but not the PC/Switch versions

2 bytes: PalY

  • This is a 2-byte unsigned integer that is always exactly 480
  • It's useful for the PlayStation version, but not the PC/Switch versions

2 bytes: Number of Colors per Page

  • This is a 2-byte unsigned integer denoting the number of colors on each page of the palette (always 256)

2 bytes: Number of Pages

  • This is a 2-byte unsigned integer denoting the number of pages in this palette

Color Data

  • There are "Number of Pages" * "Number of Colors per Page" colors, each represented using 2 bytes
  • From leftmost bit to rightmost bit:
    • The first bit is a mask (alpha?)
    • The next 5 bits are an unsigned integer for Blue
    • The next 5 bits are an unsigned integer for Green
    • The next 5 bits are an unsigned integer for Red
    • In other words: ABBBBBGG GGGRRRRR (A = Mask, B = Blue, G = Green, R = Red)