FRM File Format

Base Description:

FRM files are unpaletted 256-color image files containing either one or several images in one file. The palette used for FRM files come in the form of external palette files.

All values within the FRM file are stored in Big-Endian (Motorola) format as opposed to Little-Endian (Intel) format. For those who don't know what the difference is, Big-Endian stores the most-significant (largest digit place) digits closest to the number's starting address, whereas Little-Endian stores values with the least-significant digits closest to the starting address. Ex:

With hex number 3F:2B:

Big-Endian: 3F:2B

Little-Endian: 2B:3F

 

FRM Header:

Before the image data comes the header holding necessary information about the file:

Offset Length
Description
0x00 4 Bytes
ID
0x04 2 Bytes
Number of Frame pointers
0x06 4 Bytes
Number of Frames (from now known as "F")
0x0A 2 Bytes for each frame
Unknown
0x0A + (2*F) 4 bytes for each frame
Array of 4-byte (32-bit) pointers each frames
     
Total Size: 0x0A + (2*F) + (4*F)

 

FRM Data:

After the header comes the frame data in the following format:

Offset Length
Description
0x00 2 Bytes
Size X (Width)
0x02 2 Bytes
Size Y (Height)
0x04 4 Bytes
Multiplied picture size (essentially X*Y)
0x08 2 Bytes
X offset from previous frame
0x0A 2 Bytes
Y offset from previous frame
0x0C X*Y Bytes
Frame data
Total Size: 0x0C + (X*Y)

Frame data comes in the form of byte color indexes to a 256-color palette. Hence a byte with the number 137 would correspond to color 137 in the palette.

Palette Information:

PAL palette files are simply an array of 256 BGR (not RGB) structures. For those who don't know, the BGR color triplet represents the Blue, Green, and Red component of a color. Each component uses a single byte and ranges from 0 to 255 in brightness. This allows for over a 24-bit color scale, over 16 million colors, enough to cover a 4000x4000 monitor with a different color each pixel and not use them all.

There appears to be more than one palette per PAL file probably representing different lighting levels. Which is which is unknown. The first palette in color.pal is a standard palette but needs to be gamma corrected by a factor of four (multiply brightness by four).

Additional information would be appreciated.


Originally created by Andrey and Iceman
Slightly rewritten by Serge, R&D Group Leader, TeamX
Translated by Dr.W95

Additional information, translation revision and HTML formatting by Xotor (xotor@hotmail.com)