FF7/Field/Palette

From Final Fantasy Inside
< FF7‎ | Field
Revision as of 22:00, 20 March 2005 by my_wiki>Synergy Blades
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Section 4: Palette (Terrence Ferguson)

The following is an overview of the palette data.

Section 4 Format

Offset Size Description
0x00 2 bytes Length (Repeat of previous length header)
0x02 2 bytes Unknown
0x04 1 byte Unknown (often blank)
0x05 4 bytes Number of colors in palette
0x09 1 byte Unknown (often blank)
0x0A Varies Palette data

After the first length indicator comes another integer, also indicating length. Useless, but it's there. Then there's one more integer; unknown purpose. Then one byte; unknown (blank often). Then a word; number of colors in the palette plus one. No idea why. You can work numcolors out from the section length, but FF7 stores it anyway; why add one? Dunno. One more byte; unknown (blank often). Then the actual palette data.

Each palette entry is a 16-bit color. This is unusual - normally palettes store as high quality data as possible, usually 24/32 bit. However since FF7 only ever runs in 16 bit I guess there isn't much point storing any other kind of data. Actually, the data is 15-bit (5-bit Red, 5-bit Green, 5-bit Blue, and 1 mask bit).

Palette Data
Red Green Blue Mask
r r r r r g g g g g b b b b b m

Palettes generally contain a number of colors that's a multiple of 256. This is because the palette is split up into 256-color 'pages' internally. So the first color is page 0/color 0. Color 256 is page 1/color 0. Color 628 is page 2/color 116. You'll see why in the background section.