----------------------
The lbx archive format
----------------------

the lbx archive is a very simple archive format used in some old games for containing many small files
or data pieces, as there is no filename information. I'll call them 'data pieces' for this reason.
The lbx archive file begins with a header followed by the data section.

The description of the format follows. Here are the used conventions:

OFFSET: the offset from the start of the file in hex
BYTES: each "xx" string represents one byte, whose value is not pre-defined.
       If the value IS defined, the corresponding hex digit are present.
       Values are presented AS THEY ARE in the file (for byte ordering issues)
       (xx)* means zero or more bytes, while (xx)+ means one or more bytes

                             

  OFFSET        BYTES                     VALUE                  MEANING

 0x00000        xx xx                     n                      number of data pieces in the archive
 0x00002        AD FE 00 00               magic_number           marks the file as a valid lbx archive
--------------------------------------------------------------------------------------------------------------------------
 0x00006        00 00                     garbage                ?? seems to be always 0, and maybe just used for alignment
--------------------------------------------------------------------------------------------------------------------------
 0x00008        xx xx xx xx               data0_offset           the offset marking the start of the first data piece
 0x0000C        xx xx xx xx               data1_offset           the offset marking the start of the second data piece
  ...               ...                       ...                               ...
 0x00008 + 4*i  xx xx xx xx               datai_offset           the offset marking the start of the i-th data piece
  ...               ...                       ...                               ...
 0x00008 + 4*n  xx xx xx xx               end_last               the offset marking the end of the last (n - 1) data piece
--------------------------------------------------------------------------------------------------------------------------

                (xx)*                     garbage                some space between header and data 

--------------------------------------------------------------------------------------------------------------------------
 data0_offset   (xx)+                     data                   first data piece
 data1_offset   (xx)+                     data                   second data piece
  ...               ...                       ...                               ...
 datai_offset   (xx)+                     data                   i-th data piece
  ...               ...                       ...                               ...
 end_last                                 the end of data        this position marks the end of data.
                                                                 end_last should mark the end of the file too, but if
                                                                 there is anything after end_last it must be garbage
--------------------------------------------------------------------------------------------------------------------------

