Difference between revisions of "FF7/Field/Palette"

From Final Fantasy Inside
< FF7‎ | Field
Jump to navigation Jump to search
my_wiki>Myst6re
m (6 revisions imported)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
=== Section 4: Palette ([[User:Terence Fergusson|Terence Fergusson]] & [[User:Myst6re|myst6re]]) ===
+
=== Section 4: Palette ([[User:Terence_Fergusson|Terence Fergusson]] &amp; [[User:Myst6re|myst6re]]) ===
  
 
The following is an overview of the palette data.
 
The following is an overview of the palette data.
  
==== Section 4 Format ====
+
==== Section 4 Format ====
  
{| border="0" cellspacing="1" cellpadding="3" style="background: rgb(0,0,0)" align="center"
+
{| class="wikitable"
! style="background:rgb(204,204,204)" align="center" | Offset
+
! Offset
! style="background:rgb(204,204,204)" align="center" | Size
+
! Size
! style="background:rgb(204,204,204); width: 250px" align="center" | Description
+
! style="background: rgb(204,204,204); width: 250px" align="center" | Description
 
|-
 
|-
|style="background:rgb(255,255,255)" | 0x00
+
| 0x00
|style="background:rgb(255,255,255)" | 4 bytes
+
| 4 bytes
|style="background:rgb(255,255,255)" | Length (Repeat of previous length header)  
+
| Length (Repeat of previous length header)
 
|-
 
|-
|style="background:rgb(255,255,255)" | 0x04
+
| 0x04
|style="background:rgb(255,255,255)" | 2 bytes
+
| 2 bytes
|style="background:rgb(255,255,255)" | PalX
+
| PalX
 
|-
 
|-
|style="background:rgb(255,255,255)" | 0x06
+
| 0x06
|style="background:rgb(255,255,255)" | 2 bytes
+
| 2 bytes
|style="background:rgb(255,255,255)" | PalY
+
| PalY
 
|-
 
|-
|style="background:rgb(255,255,255)" | 0x08
+
| 0x08
|style="background:rgb(255,255,255)" | 2 bytes
+
| 2 bytes
|style="background:rgb(255,255,255)" | Number of colors in palette
+
| Number of colors in palette
 
|-
 
|-
|style="background:rgb(255,255,255)" | 0x0A
+
| 0x0A
|style="background:rgb(255,255,255)" | 2 bytes
+
| 2 bytes
|style="background:rgb(255,255,255)" | Number of palettes
+
| Number of palettes
 
|-
 
|-
|style="background:rgb(255,255,255)" | 0x0C
+
| 0x0C
|style="background:rgb(255,255,255)" | (Number of palettes) * (Number of colors in palette) * 2
+
| (Number of palettes) * (Number of colors in palette) * 2
|style="background:rgb(255,255,255)" | Palette data
+
| Palette data
 
|}
 
|}
  
After the first length indicator comes another integer, also indicating length. Useless, but it's there.<br />
+
After the first length indicator comes another integer, also indicating length. Useless, but it's there.<br /> Then two bytes; palX, useful for the PS version only (always 0).<br /> Then two bytes again; palY, useful for the PS version only (always 480).<br /> Then two bytes; number of colors in the palette (always 256).<br /> Then two bytes; number of palettes.<br /> Then the actual palette data.
Then two bytes; palX, useful for the PS version only (always 0).<br />
 
Then two bytes again; palY, useful for the PS version only (always 480).<br />
 
Then two bytes; number of colors in the palette (always 256).<br />
 
Then two bytes; number of palettes.<br />
 
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 Blue, 5-bit Green and 5-bit Red).
 
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 Blue, 5-bit Green and 5-bit Red).
  
{| border="0" cellspacing="1" cellpadding="3" style="background: rgb(0,0,0)" align="center"
+
{| class="wikitable"
! style="background:rgb(204,204,204)" align="center" colspan="16" | Palette Data
+
! style="background: rgb(204,204,204)" colspan="16" align="center" | Palette Data
 
|-
 
|-
|style="background:rgb(255,255,255)" colspan="1" | Mask
+
| style="background: rgb(255,255,255)" colspan="1" | Mask
|style="background:rgb(255,255,255)" colspan="5" | Blue
+
| style="background: rgb(255,255,255)" colspan="5" | Blue
|style="background:rgb(255,255,255)" colspan="5" | Green
+
| style="background: rgb(255,255,255)" colspan="5" | Green
|style="background:rgb(255,255,255)" colspan="5" | Red (LSB)
+
| style="background: rgb(255,255,255)" colspan="5" | Red (LSB)
 
|-
 
|-
|style="background:rgb(255,255,255)" align="center" | m
+
| style="background: rgb(255,255,255)" align="center" | m
|style="background:rgb(255,255,255);color:blue" | b
+
| <font color="blue"> b </font>
|style="background:rgb(255,255,255);color:blue" | b
+
| <font color="blue"> b </font>
|style="background:rgb(255,255,255);color:blue" | b
+
| <font color="blue"> b </font>
|style="background:rgb(255,255,255);color:blue" | b
+
| <font color="blue"> b </font>
|style="background:rgb(255,255,255);color:blue" | b
+
| <font color="blue"> b </font>
|style="background:rgb(255,255,255);color:green" | g
+
| <font color="green"> g </font>
|style="background:rgb(255,255,255);color:green" | g
+
| <font color="green"> g </font>
|style="background:rgb(255,255,255);color:green" | g
+
| <font color="green"> g </font>
|style="background:rgb(255,255,255);color:green" | g
+
| <font color="green"> g </font>
|style="background:rgb(255,255,255);color:green" | g
+
| <font color="green"> g </font>
|style="background:rgb(255,255,255);color:red" | r
+
| <font color="red"> r </font>
|style="background:rgb(255,255,255);color:red" | r
+
| <font color="red"> r </font>
|style="background:rgb(255,255,255);color:red" | r
+
| <font color="red"> r </font>
|style="background:rgb(255,255,255);color:red" | r
+
| <font color="red"> r </font>
|style="background:rgb(255,255,255);color:red" | r
+
| <font color="red"> r </font>
 
|}
 
|}
  
 
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.
 
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.

Latest revision as of 05:14, 23 May 2019

Section 4: Palette (Terence Fergusson & myst6re)

The following is an overview of the palette data.

Section 4 Format

Offset Size Description
0x00 4 bytes Length (Repeat of previous length header)
0x04 2 bytes PalX
0x06 2 bytes PalY
0x08 2 bytes Number of colors in palette
0x0A 2 bytes Number of palettes
0x0C (Number of palettes) * (Number of colors in palette) * 2 Palette data

After the first length indicator comes another integer, also indicating length. Useless, but it's there.
Then two bytes; palX, useful for the PS version only (always 0).
Then two bytes again; palY, useful for the PS version only (always 480).
Then two bytes; number of colors in the palette (always 256).
Then two bytes; 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 Blue, 5-bit Green and 5-bit Red).

Palette Data
Mask Blue Green Red (LSB)
m b b b b b g g g g g r r r r 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 background section.