We just moved to a different server. Please be patient until all files and pages are restored and the MediaWiki software has been updated. Thank you


From REWiki
Jump to: navigation, search

DemonStar is a vertical scrolling shooter from Mountain King Studios Inc. All the game data is stored in the .GLB files, namely:

  • Game.glb
  • game1.glb
  • Game3.glb
  • music.glb
  • sounds.glb


GLB File

The *.GLB file layout is as follows:

  • Header
  • Resource Descriptors
  • Resources
Magic 8 bytes CHAR [8] 0x47 0x4c 0x42 0x32 0x2e 0x30 0x00 0x00
Number of Resource Descriptors 4 bytes UINT32

After the Header we have the block of the Resource Descriptors. The format of each resource descriptor is:

Resource Descriptor
Unknown 4 bytes UINT32 Always zero
Offset 4 bytes UINT32 Offset to that resource from the start of the .GLB file
Size 4 bytes UINT32 Size of that resource in bytes
Name 16 bytes CHAR [16] Zero padded name of the resource

There are special Resource Descriptors which are identified by zero size and offset. These Descriptor describes section names or namespaces. For example, "STARTMAPS:" and "ENDMAPS:". Every resources that are between "STARTMAPS:" and "ENDMAPS:" are considered to be belong to the MAPS namespace.

Resources Description

There are several types of the in-game resources:

  • RAW
  • FONT


RAW resources are mere images. Each RAW resource starts with 12 bytes header which is followed by the raw data.

RAW Header
Width 4 bytes INT32 The width of the image
Height 4 bytes INT32 The height of the image
Code 4 bytes UIN32 Always 1

After the header we have a Width*Height bytes of the image data, 1 byte per pixel. If either Width or Height is less or equals to zero, this resource is considered to invalid.


Palette is stored as continious sequence of 256 RGB triplets, 1 byte per each color component. Thus the size of the palette bulk is 768 bytes.


Packed resources describes sprites. Each sprite is stored by scanlines. Each scanline is defined by its starting coordinates relative to the sprite, and the length of the scanline. Basically the PACKED resource layout is :

  • Header
  • List of offsets to scanlines
  • Scanlines data
  • Stop marker
Width 4 bytes INT32 The width of the image
Height 4 bytes INT32 The height of the image
Code 4 bytes UIN32 Always 0

After the header we have a block offsets. This block consists of Height times UINT32, thus its size is 4*Height bytes. Each UINT32 is the offset to the corresponding scanline, where offsets are taken relative to the end of the offsets block. For example, the offset of the first scanline is allways 0.

After the offset block, we have a bulk of the scanlines. Each scanline starts with the header

Scanline Header
X 4 bytes INT32 X position of the scanline
Y 4 bytes INT32 The scanline number
Width 4 bytes UIN32 The number of pixels in this scanline

Clearly, we have 0 <= X < Sprite Width. Each scanline header is followed by the Width bytes of the pixels data.

If X is 32768 and Y is -1, this considered to be a stop marker. Note: The decoding routine, should always read X and Y first from the scanline header. If X and Y are not the stop markers, then Width field should be red. The routine should exit otherwise.

Personal tools