VGFM Screen Format

From ModdingWiki
Jump to navigation Jump to search
VGFM Screen Format
VGFM Screen Format.png
Format typeImage
HardwareVGA
Colour depth8-bit (VGA)
Minimum size (pixels)320×200
Maximum size (pixels)320×200
PaletteExternal
Plane count4
Transparent pixels?No
Hitmap pixels?No
Games

The VGFM Screen Format is used by Vinyl Goddess From Mars to store full-screen images, primarily for the user-interface.

Signature

There is no signature. Files will always be 64000 bytes, which causes confusion with identically sized raw VGA images.

File format

The file consists of 64000 bytes of data. Each byte is one pixel, however the data is arranged in planes. See Planar VGA for details on the pixel arrangement.

The following formula can be used to calculate target coordinates from a file offset:

 width = 320
 planeWidth = width / 4
 srcX = offset % planeWidth
 srcY = offset / planeWidth
 destX = srcX * 4 + srcY / height
 destY = srcY % height;
 image(destX, destY) = file[offset]

Alternatively, assuming the target is a 320×200 byte array in standard VGA layout, this simpler algorithm can be used:

 width = 320
 height = 200
 planeWidth = width / 4;
 planeSize = planeWidth * height;
 output[i % planeSize * 4 + i / planeSize] = input[i];

Credits

This file format was reverse engineered by Malvineous. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)