Subsections
General Description
FS2 files are image container files that can store up to 65536 images (called "shapes") that are
256x256 pixels in dimension. This particular file format was designed to replace the default graphics in FSH
files more effectively when it comes to dreams with custom patches.
Say you would like to edit one single picture in the default item.fsh file (which contains 305 images and is
nearly a whole megabyte in size). With the early FSH format, you would have to upload the entire file! Even
with compression, it is quite wasteful. That's where the FS2 files come into the game.
Among the normal FSH features, this format is a little different, has a format description in the beginning of
the file and each image now has a replacement number. This number represents the original frame number that the
current image in the FS2 file will be replacing. This way, you can modify one image in the default patch and
upload just it in an FS2 file. Even though that this image will have the frame number 0, Furcadia will know
exactly which frame is supposed to be replaced by it.
Header Format - 16 bytes
The header is the first 16 bytes in the FS2 file. This is the information you can get from it:
Offset |
Size (B) |
Type |
Description |
0x00 | 8 | char[8] | File format/version: FSH2.002 |
0x08 | 2 | ushort | Image quantity (Note: 2A 01 == 012A) |
0x0A | 2 | ? | Unknown (reserved?) |
0x0C | 1 | byte | Encryption state (00 = OFF / 01 = ON) |
0x0D | 3 | ? | Unknown (reserved?) |
|
|
Image (Frame) Format - 6+(W*H) bytes
Immediately after the 16 header bytes, there are images following one another. Every such image has 6 bytes of
their own header and the rest is an image of specific dimensions. Every pixel in an image is an 8-bit number
that represents the color in Furcadia's color palette. The image format is as follows:
Offset |
Size (B) |
Type |
Description |
+0x00 | 1 | ubyte | Image width |
+0x01 | 1 | ubyte | Image height |
+0x02 | 1 | sbyte | X Offset |
+0x03 | 1 | sbyte | Y Offset |
+0x04 | 2 | ushort | Object ID this one replaces (Note: 2A 01 == 012A) |
+0x05 | ? | char[?] | Image itself (Size == Width*Height) |
|
|
Note that the images are vertically flipped/reflected! That means that the first row in the image data is the
last row in the picture itself. Check the grid above for a better idea on how is the image being read as you
read through the data inside the file. Green squares represent the header. The
brightest squares are the most recently read data - this is to indicate the direction of the read.
Dealing With Corruption
With the format documentation to tell you how things should work, you should be careful about the following
undesired cases:
- The header might claim that it has more images than the file itself actually has
- The last image might either be too long or too short
In cases like these, it's a good idea to watch your program so it won't read more data than necessary and be
ready to receive less images than expected along with the possibility that the last image might not be
complete.
Encryption
This section is here somewhere, but it's hidden. Finish the URL in order to show it...
|