Anonymous

Changes

From Final Fantasy Inside

FF7/Field/Palette

182 bytes added, 14:16, 27 May 2010
Many corrections
=== Section 4: Palette ([[User:Terence Fergusson|Terence Fergusson]] & [[User:Myst6re|myst6re]]) ===
The following is an overview of the palette data.
|-
|style="background:rgb(255,255,255)" | 0x00
|style="background:rgb(255,255,255)" | 2 4 bytes
|style="background:rgb(255,255,255)" | Length (Repeat of previous length header)
|-
|style="background:rgb(255,255,204)" | 0x020x04
|style="background:rgb(255,255,204)" | 2 bytes
|style="background:rgb(255,255,204)" | Unknown
|-
|style="background:rgb(255,255,204)" | 0x04
|style="background:rgb(255,255,204)" | 1 byte
|style="background:rgb(255,255,204)" | Unknown (often blank)
|-
|style="background:rgb(255,255,255204)" | 0x050x06|style="background:rgb(255,255,255204)" | 4 2 bytes|style="background:rgb(255,255,255204)" | Number of colors in palette Unknown
|-
|style="background:rgb(255,255,204255)" | 0x090x08|style="background:rgb(255,255,204255)" | 1 byte2 bytes|style="background:rgb(255,255,204255)" | Unknown (often blank) Number of colors in palette
|-
|style="background:rgb(255,255,255)" | 0x0A
|style="background:rgb(255,255,255)" | Varies2 bytes|style="background:rgb(255,255,255)" | Number of palettes|-|style="background:rgb(255,255,255)" | 0x0C|style="background:rgb(255,255,255)" | (Number of palettes) * (Number of colors in palette) * 2
|style="background:rgb(255,255,255)" | 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 bytetwo bytes; unknown (blank often).Then a wordtwo bytes again; unknown (always 480).Then two bytes; 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(always 256).One more byteThen two bytes; unknown (blank often)number of palettes.
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 (1 mask bit, 5-bit RedBlue, 5-bit Green, and 5-bit Blue, and 1 mask bitRed).
{| border="0" cellspacing="1" cellpadding="3" style="background: rgb(0,0,0)" align="center"
! style="background:rgb(204,204,204)" align="center" colspan="16" | Palette Data
|-
|style="background:rgb(255,255,255)" colspan="1" | Mask|style="background:rgb(255,255,255)" colspan="5" | RedBlue
|style="background:rgb(255,255,255)" colspan="5" | Green
|style="background:rgb(255,255,255)" colspan="5" | Blue |style="background:rgbRed (255,255,255LSB)" colspan="1" | Mask
|-
|style="background:rgb(255,255,255)" | r
|style="background:rgb(255,255,255)" | r
|style="background:rgb(255,255,255)" | r
|style="background:rgb(255,255,255)" | r
|style="background:rgb(255,255,255)" | r
|style="background:rgb(255,255,255)" | g
|style="background:rgb(255,255,255)" | g
|style="background:rgb(255,255,255)" | g
|style="background:rgb(255,255,255)" | g
|style="background:rgb(255,255,255)" | g
|style="background:rgb(255,255,255)" | b
|style="background:rgb(255,255,255)" | b
|style="background:rgb(255,255,255)" | b
|style="background:rgb(255,255,255)" | b
|style="background:rgb(255,255,255)" | b
|style="background:rgb(255,255,255)" align="center" | m
|style="background:rgb(255,255,255);color:blue" | b
|style="background:rgb(255,255,255);color:blue" | b
|style="background:rgb(255,255,255);color:blue" | b
|style="background:rgb(255,255,255);color:blue" | b
|style="background:rgb(255,255,255);color:blue" | b
|style="background:rgb(255,255,255);color:green" | g
|style="background:rgb(255,255,255);color:green" | g
|style="background:rgb(255,255,255);color:green" | g
|style="background:rgb(255,255,255);color:green" | g
|style="background:rgb(255,255,255);color:green" | g
|style="background:rgb(255,255,255);color:red" | r
|style="background:rgb(255,255,255);color:red" | r
|style="background:rgb(255,255,255);color:red" | r
|style="background:rgb(255,255,255);color:red" | r
|style="background:rgb(255,255,255);color:red" | r
|}
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 [[FF7/Field/Background|background]] section.
Anonymous user