LBX file format

Details about file formats, structure and contents in the original Master of Magic
Post Reply
User avatar
Implode
Site Admin
Posts: 433
Joined: Fri Feb 24, 2006 3:35 am
Location: Newfoundland, Canada
Contact:

LBX file format

Post by Implode »

The LBX files in the original game are archives containing, similar to ZIP files except that there's no compression. The format of each LBX file is:
  • First 2 bytes indicate the number of subfiles within the LBX file
    Next 4 bytes are the fixed value hex FEAD (i.e. the actual order of bytes in the file is AD FE 00 00)
    Next 2 bytes are a version number - never found a use for this
    Next there are [number of subfiles] sets of 4 byte offsets - these indicate the start position in the LBX file of each subfile
    These are ended by another 4 byte offset indicating the end of the last subfile (i.e. these 4 bytes = the size of the LBX file)
The format of each individual subfile varies with each LBX file - some are graphics, some are sound, some are music, some are data. Other posts I'll put up in this forum will describe the format of the subfiles that I know about.

You can find the program I wrote to extract from the LBX files on the downloads page.

Implode.
Winter
Posts: 1
Joined: Wed Aug 20, 2008 12:15 pm

Re: LBX file format

Post by Winter »

First of all, I've think you're doing a great job! A noble and just cause.
I'm really looking forward to see this project finished and be able to play this game with my friends over internet.

I've got a question regarding the image file format. Is it possible to use the LBX-extractor to create a different kind of image format. The BMP format isn't capable of using transparancy and I would like to use these images on my future website.
(as you did on your frontpage with the drakes).
Is it possible to extract them to be either GIF or preferrably PNG files?
I know of some batch converters (like IRFanview) which convert all the BMP's to PNG's, but I think there will be some dataloss if I would use them and I still would have to define the transparant pixel color for each seperate file.....
User avatar
Implode
Site Admin
Posts: 433
Joined: Fri Feb 24, 2006 3:35 am
Location: Newfoundland, Canada
Contact:

Re: LBX file format

Post by Implode »

The Delphi version, no. Delphi can only handle .BMPs and that's about it. However I've written a Java ImageIO reader for the LBX format, you could write something which used that and converted to PNGs easily enough. I don't have the time to do it right now, but will get around to it eventually ;)
Winter wrote:The BMP format isn't capable of using transparancy
I always use #FF00FF to represent transparency in .BMPs, so all I did with the Drakes on my page was to then load the .BMPs from the extractor into Paint Shop Pro, convert them down to 256 colours, then save as .GIF marking colour #FF00FF as transparent.
Post Reply