PAL - danvratil/jhgpc98decomp GitHub Wiki
Describes format of palette files (.PAL).
There are also .PAL (e.g. palette.pal
) files that contain raw indirect palette data. Those do not have any
magic bytes at the beginning and their entire content is a palette data. They are always exactly 64Kb in size.
Byte | 0 | 1 | 2 | 3 |
---|---|---|---|---|
Hex | 0x50 | 0x41 | 0x4c | 0x21 |
ASCII | P | A | L | ! |
Value | Description |
---|---|
0x02 | Contains palette data |
0x04 | Contains remap table |
Offset | Length | Description |
---|---|---|
0 | 4 | Magic bytes (PAL! ) |
4 | 2 | Flags (described above) |
6 | 768 | Palette data (flags & 0x02 ) |
774 | 8192 | Remap tables (32 tables) (flags & 0x04 ) |
Palette data are decoded with the following loop:
// size of data is 768 (256*3)
for (int pos = 0; pos < 256; pos += 3) {
data[pos] = (data[pos] >> 3) & 0x1f;
data[pos + 1] = (data[pos + 1] >> 3) & 0x3f;
data[pos + 2] = (data[pos + 2] >> 3) & 0x1f;
}
Meaning of those values TBD.
32 remap tables, each 256 bytes.
Exact structure TBD