The Forum is up for sale: XeNTaX Forum looking for new owner
Helldorado
- aluigi
- VVIP member

- Posts: 1916
- Joined: Thu Dec 08, 2005 12:26 pm
- Location: www.ZENHAX.com
- Has thanked: 4 times
- Been thanked: 661 times
- Contact:
Re: Helldorado
extracting the files is ok, the only problem is retrieving their names.
I have made only a quick external analysis of the archives but I guess that if the names are really stored in them they are located in the bytes between the offset/size table and the first file in a compressed form.
the following is the quickbms script for extracting the files without names:
I have made only a quick external analysis of the archives but I guess that if the names are really stored in them they are located in the bytes between the offset/size table and the first file in a compressed form.
the following is the quickbms script for extracting the files without names:
Code: Select all
idstring "SBPAK V 1.0\r\n\0\0\0"
get DUMMY long # ever the same
get DUMMY long # ever the same
filexor 0x08
get DUMMY long
get DUMMY long
get DUMMY long
get FILES long
get DUMMY long
get BASE_OFFSET long
get TOTAL_SIZE long
for i = 0 < FILES
get SIZE long
get OFFSET long
get DUMMY long
get DUMMY long
math OFFSET += BASE_OFFSET
log "" OFFSET SIZE
next i- asmxtx
- veteran
- Posts: 127
- Joined: Sun Jun 08, 2008 10:32 pm
- Location: Developers Country
- Has thanked: 1 time
- Been thanked: 30 times
Re: Helldorado
Yes, the only - and biggest - problem is to retrieve the filenames. They seem to be encrypted in a special way.
Also, the whole file seems to be XORed with 0b6h - but according to a flag somewhere. I haven't been able to analyze this further...
Also, the whole file seems to be XORed with 0b6h - but according to a flag somewhere. I haven't been able to analyze this further...
- aluigi
- VVIP member

- Posts: 1916
- Joined: Thu Dec 08, 2005 12:26 pm
- Location: www.ZENHAX.com
- Has thanked: 4 times
- Been thanked: 661 times
- Contact:
Re: Helldorado
an idea for catching the right XOR byte can be the reading of the byte at offset 0x18 which is 0xff in clear mode so it's enough to xor it with 0xff to get the right xor value.
the only problem is that now the Filexor command uses a fixed number/string as argument while in the past it used a variable so now I need to re-introduce that old argument type for allowing the usage of dynamic xor values
*edit* I have figured the filenames encryption
the only problem is that now the Filexor command uses a fixed number/string as argument while in the past it used a variable so now I need to re-introduce that old argument type for allowing the usage of dynamic xor values
*edit* I have figured the filenames encryption
- aluigi
- VVIP member

- Posts: 1916
- Joined: Thu Dec 08, 2005 12:26 pm
- Location: www.ZENHAX.com
- Has thanked: 4 times
- Been thanked: 661 times
- Contact:
Re: Helldorado
sure and indeed I have already written the script yesterday but the dynamic xor value has been re-introduced in the new version that I will release tomorrow.
so you need only to wait some hours :)
so you need only to wait some hours :)
- aluigi
- VVIP member

- Posts: 1916
- Joined: Thu Dec 08, 2005 12:26 pm
- Location: www.ZENHAX.com
- Has thanked: 4 times
- Been thanked: 661 times
- Contact:
- asmxtx
- veteran
- Posts: 127
- Joined: Sun Jun 08, 2008 10:32 pm
- Location: Developers Country
- Has thanked: 1 time
- Been thanked: 30 times
Re: Helldorado
@bugtest:
I was using your BMS-script and it is able to recover the file structure properly. Evaluating it I found out that lines 7...9 are not necessary, because the XOR-value is 0xB6 in any case (it is EXE-hard-coded).
But that's not the problem.
The actual problem is that not the whole PAK-file is XORed. Certain files are stored in their original form (like BIK-videos, WAV-sounds and maybe other files which format I don't know.)
I tried to analyze the PAK-structure but I am overextended to find a solution.
There must be a XOR-flag somewhere...
I was using your BMS-script and it is able to recover the file structure properly. Evaluating it I found out that lines 7...9 are not necessary, because the XOR-value is 0xB6 in any case (it is EXE-hard-coded).
But that's not the problem.
The actual problem is that not the whole PAK-file is XORed. Certain files are stored in their original form (like BIK-videos, WAV-sounds and maybe other files which format I don't know.)
I tried to analyze the PAK-structure but I am overextended to find a solution.
There must be a XOR-flag somewhere...
- aluigi
- VVIP member

- Posts: 1916
- Joined: Thu Dec 08, 2005 12:26 pm
- Location: www.ZENHAX.com
- Has thanked: 4 times
- Been thanked: 661 times
- Contact:
Re: Helldorado
from what I have understood (I don't have all the files or the full game) and verified with the demo only some types of files are not xored, like BIKs.
so seems extension-based because the other fields (like the 2 DUMMYs in the table) have a content which is not constant also for the bik files.
so, resuming, here after having checked the content of data.pak of the demo I have seen only the bik files which don't use the xor obfuscation while all the other files are correct.
have you verified if there all the wav files don't use xor or only some of them?
so seems extension-based because the other fields (like the 2 DUMMYs in the table) have a content which is not constant also for the bik files.
so, resuming, here after having checked the content of data.pak of the demo I have seen only the bik files which don't use the xor obfuscation while all the other files are correct.
have you verified if there all the wav files don't use xor or only some of them?
- asmxtx
- veteran
- Posts: 127
- Joined: Sun Jun 08, 2008 10:32 pm
- Location: Developers Country
- Has thanked: 1 time
- Been thanked: 30 times
Re: Helldorado
After investigating extracted files I can confirm that only BIK-files seem to be stored without XORing (maybe for performance reasons).
Comparing with the extension ".BIK" to make a XOR-decision might be sufficient, I think.
Comparing with the extension ".BIK" to make a XOR-decision might be sufficient, I think.
- aluigi
- VVIP member

- Posts: 1916
- Joined: Thu Dec 08, 2005 12:26 pm
- Location: www.ZENHAX.com
- Has thanked: 4 times
- Been thanked: 661 times
- Contact:
Re: Helldorado
well finally we know when it's used the additional xoring I saw in the code :)
redownload my script and go down until you see the message "# uncomment the following 5 lines if you get wrong filenames!" and remove the # char in the lines which follow it:
now you can extract the files from zh.pak without problems.
indeed 0x6e and 0x65 are the "en" string so I guess that in other country based paks will be needed to change it.
for example in the german demo that value was set to "de" (0x65 0x64) but as far as I know it wasn't used while in an hypothetic italian version it will be 0x74 0x69
at the moment I have not found a way to implement this check automatically at runtime in the script, so the manual editing of the script is necessary
redownload my script and go down until you see the message "# uncomment the following 5 lines if you get wrong filenames!" and remove the # char in the lines which follow it:
Code: Select all
if XBYTE & 1
math BYTE ^= 0x6e
else
math BYTE ^= 0x65
endifindeed 0x6e and 0x65 are the "en" string so I guess that in other country based paks will be needed to change it.
for example in the german demo that value was set to "de" (0x65 0x64) but as far as I know it wasn't used while in an hypothetic italian version it will be 0x74 0x69
at the moment I have not found a way to implement this check automatically at runtime in the script, so the manual editing of the script is necessary
-
Alek Sander
- n00b
- Posts: 10
- Joined: Sat Sep 04, 2010 1:37 pm
Re: Helldorado
Hey guys! I used the script posted here. In misc.pak file there is a small program packed inside called "sbpacker.exe", which can create, list and unpack pak-files for the game. It extracts all the data including folders.
It's the official tool, I guess...
You do not have the required permissions to view the files attached to this post.
