The Last Express BG: Difference between revisions
Jump to navigation
Jump to search
imported>Dinoguy1000 (some cleanup) |
imported>Ikskoks No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 59: | Line 59: | ||
{{DEFAULTSORT:{{PAGENAME}}}} | {{DEFAULTSORT:{{PAGENAME}}}} | ||
[[Category:PC formats]] | [[Category:PC formats]] | ||
[[Category:File Format]] | |||
Latest revision as of 21:14, 21 January 2021
Back to index | Edit this page
BG
- Format type: Image
- Endianness: Little-endian
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
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
Links
None