I'm trying to read in an archive file that contains directories and file entries. I've managed to read out the header of the file and get the info.
You can find info about the format here
now the file contains a Table of contents module starting after 2048 bytes from the origin of the file.
What i know is is that the TOC can contain 2 things :
A directory entry that follows the following structure:
- 4bytes :int32 : Name offset of where the entry name is stored
- 4bytes : int32 : Information flags , each bit of the 4 bytes contain info about something
- 4bytes : Uint32 : Content entry index
- 4bytes : uint32 : Content entry count
The fileentry follows this structure:
- 4bytes : int32 : Name offset
- 4bytes : int32 : File Size
- 3bytes : Uint24 : Offset of where the file is stored
- 1byte : Uchar8 : Resource type
- 4byte : uint32 : Information flags
Now this is for every directory entry or file entry the same.
The problem is i don't know what is first in the toc or what the order is from every entry , it's unkown.
What i do know is from the file header , is the entry count so how many entries there are and the table of contents size.
Is there anyway to find out with the binary reader in what form i need to read every entry in or to find out what specific type of entry it is ?
I will use a for loop for this since i know the entry count from the header.
Any help is apreciated