User:Zarevak/GLM
From TaRapedia
Contents |
[edit] Overview
GLM files are base data source files for Tabula Rasa. All textures (and icons), sounds, music, models, ... are stored in these files.
[edit] File Format
[edit] Basic structure
The GLM files consists of 4 parts
- data
- filenames table
- file allocation table (FAT)
- DWORD (4byte) pointer to FAT
[edit] FAT structure
- 8-bytes long "CHNKBLXX" string - ID of the FAT?
- DWORD pointer to filenames table
- DWORD size (in bytes) of the filenames table
- DWORD count of the items in the filenames table
- records for each file in the GLM file:
- DWORD pointer to beginning of the file
- DWORD size of the file in GLM file
- DWORD uncompressed? size of the file
- DWORD offset to the filenames table, where the filename string for this file begins (ends with NULL character)
- SHORT (2bytes) flags?:
- 0 - uncompressed data
- 1 - compressed data? - only found in effects.glm file
- DWORD unix timestamp - count of seconds from 00:00:00 UTC on January 1, 1970
[edit] Decoding
- Start by reading the last 4 bytes of the GLM file and move to the location it represents (offset from beginning of the file) = beginning FAT table
- read FAT header (ID, pointer to Filenames table, size of filenames table, filecount)
- read the whole filenames table into memory
- for each file (count from the FAT header):
- read the next file information from FAT
- extract the filename from filename table - beginning is known from FAT, ends with NULL character
- extract the file data