The Last Express BG

From XentaxWiki
Jump to: navigation, search

Back to index | Edit this page

BG

Format Specifications

uint32 {4}   - position on screen?

uint32 {4}   - position on screen?
uint32 {4}   - image width
uint32 {4}   - image height
uint32 {4}   - red colour channel data size
uint32 {4}   - blue colour channel data size
uint32 {4}   - green colour channel data size
byte {x}     - red colour channel data
byte {x}     - green colour channel data

byte {x}     - blue colour channel data

Notes and Comments

BG files usually contain the game's background images. The three single colour channels (red, green and blue; also note the switched order of the header size values) have been compressed separately by a custom scheme. To decompress such a channel, the following method may be used:

while InPos < InSize do
begin
  if InBuffer[InPos] < 0x80 then
  begin
    // direct decompression
    Len := InBuffer[InPos] shr 5 + 1;
    Data := InBuffer[InPos] shl 3;
    InPos++;
    Copy Data byte Len times into OutBuffer while increasing OutPos.
  end
  else
  begin
    // buffer back reference, 4096 byte window
    take InBuffer[InPos] and the following value as a big endian uint16 OfsLen
    while zeroing the first bit
    Len := OfsLen shr 12 + 3;
    HisPos := OutPos - 4096 + (OfsLen and 0x0fff);
    InPos += 2;
    copy Len many bytes from HisPos onwards to OutPos, increasing both
  end
end;

MultiEx BMS Script

None written yet.

Supported by Programs

BG2BMP

Links

None

Games

Navigation

Jump to a listing by...
All Formats - Common Formats - Standard Formats - Malformed Pages
Platforms
Microsoft:
Xbox
Xbox 360
Nintendo:
GameCube
DS
Desktop:
PC
Sega:
Dreamcast
Sony:
PlayStation
PlayStation 2
PlayStation 3
PlayStation Portable
Type
Animation - Archive - Audio - Image - Mesh - Miscellaneous - Model - Video
Endianness
Little-endian - Big-endian
BMS Scripts
Pages Without a BMS Script

All Pages with Scripts:
Recently Added Scripts

Program Support
No Known Support

MultiEx Commander - Game Extractor

Format Specification Completion
Work in Progress - Almost Done - Completed
Compression and Encryption
No Compression or Encryption Used - Unknown Compression or Encryption Used

One or Both Used:
Compression Used - Both Compression and Encryption Used