Long time no post, I am back to work and will edit this post with some progress info.
HashTable consisting of its own header, followed by hash records that are 16 bytes long.
- I think these hash records indicate the beginning of the file in the data stream, inside the .LPQ file, as well as its size and possibly something else (possibly the decoding key, since all data streams are encoded.)
Also, half of the file .BHL occupies a BlockTable...
- this may be some data related to files Packed in LPQ.
Perhaps these are keys for decoding the data streams of the files themselves, or the file names are encoded there.
I watched the debugger how Loader KOK3 works:
the Loader opens the .BHL file, and copies the BlockTable and HashTable to the allocated large buffer in memory.
Moreover, it swaps them!
First copies the BlockTable and then inserts the HashTable before it.
Then, in front of him, puts the file header .BHL without the first signature.
The .LPQ file is also loaded into memory.
And then, some magic begins that I couldn't understand...
the Algorithm swaps a lot of different data that I couldn't track.
I only found in memory, already unpacked some KOK3 files...
Then the process waits for you to log in to the game, and everything starts too fast. I couldn't freeze it and look at it.
- - - Updated - - -
BHL UserData - This is a hash table consisting of its own header, followed by hash records that are 16 bytes long.
- I think these hash records indicate the beginning of the file in the data stream, inside the .LPQ file, as well as its size and possibly something else (possibly the decoding key, since all data streams are encoded.)
Also, half of the file .BHL occupies a BlockTable...
- this may be some data related to files Packed in LPQ.
Perhaps these are keys for decoding the data streams of the files themselves, or the file names are encoded there.
I watched the debugger how Loader KOK3 works:
the Loader opens the .BHL file, and copies the BlockTable and HashTable to the allocated large buffer in memory.
Moreover, it swaps them!
First copies the BlockTable and then inserts the HashTable before it.
Then, in front of him, puts the file header .BHL without the first signature.
The .LPQ file is also loaded into memory.
And then, some magic begins that I couldn't understand...
the Algorithm swaps a lot of different data that I couldn't track.
I only found in memory, already unpacked some KOK3 files...
Then the process waits for you to log in to the game, and everything starts too fast. I couldn't freeze it and look at it.
- - - Updated - - -
The program for easy highlighting and the study of file structures: Hexinator
Below you can download my grammars by clicking this program.
These grammars contain the KOK3 file structures that I recognized:
Last edited by Mimi Neko; 10-18-2020 at 09:14 AM.
Long time no post, I am back to work and will edit this post with some progress info.
Check out my official King of Kings III reverse engineering project thread!
https://www.mpgh.net/forum/showthread.php?t=1367141