Elex

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
Lord Vaako
Posts: 26
Joined: Tue Oct 17, 2017 7:36 pm

Elex

Post by Lord Vaako »

Is anyone going to create Elex *.pak files extractor? :-)

Code: Select all

17.10.2017  21:08                84 c_0_en.pak
17.10.2017  20:53                84 c_0_na.pak
17.10.2017  20:21     3˙094˙840˙069 c_1_en.pak
17.10.2017  20:21    24˙153˙842˙686 c_1_na.pak
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Elex

Post by aluigi »

Please download the filecutter script:
http://aluigi.org/bms/filecutter.bms

Open it with a text editor.
Near the beginning you can see a math "MEGABYTES = 2", replace 2 with 10 (or more if you prefer).
Now launch the script on "c_1_en.pak" and upload the two files it generates.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Elex

Post by aluigi »

Ah maybe in the meantime try also the tools and script made for the first Risen/Gothic3, just in case the format is the same.
For example this is the script I made some years ago:
http://aluigi.org/bms/risen.bms
Lord Vaako
Posts: 26
Joined: Tue Oct 17, 2017 7:36 pm

Re: Elex

Post by Lord Vaako »

it looks like risen.bms works :-)
it extracted a lot of *.rom files and *.db file
all files (rom and db) start with GAR5

Code: Select all

- 31510 files found in 110 seconds
  coverage file 0   100%   3094840069 3094840069 . offset 00000000b8778305


btw, when I try to extract c_1_na.pak (24GB):

error in src\extra\xalloc.c line 618: xdbg_malloc()
Error: memory allocation problem
...

I use 0.8.1 (64bit test) 4GB+ version
I have 16GB only, will more RAM fix this problem? :-)))))
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Elex

Post by aluigi »

Good for c_1_en.pak.
Instead for c_1_na.pak I need the samples generated with filecutter as I said in my previous post so I can "tune" the script
ponaromixxx
Posts: 176
Joined: Tue Sep 30, 2014 5:59 pm

Re: Elex

Post by ponaromixxx »

This for a large archive is suitable!

risenaut.7z
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Elex

Post by aluigi »

Ah right the 64bit fields.
Wow I guess that quickbms didn't even have support for longlong when I wrote that script years ago :D
Script 0.2.2 should work perfectly
Lord Vaako
Posts: 26
Joined: Tue Oct 17, 2017 7:36 pm

Re: Elex

Post by Lord Vaako »

2 x 4MB only - upload limit :/
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Elex

Post by aluigi »

You can use any external file hosting and put the link here.
Have you tried the new version of the script?
Lord_Vaako
Posts: 2
Joined: Sun Dec 25, 2016 7:17 pm

Re: Elex

Post by Lord_Vaako »

It works wery well now :-)

Code: Select all

- 124496 files found in 543 seconds
  coverage file 0   100%   24153842686 24153842686 . offset 000000059fae63fe


Now I'm looking for a tool to convert /documents/*.hdr files -> text file :-)
ponaromixxx
Posts: 176
Joined: Tue Sep 30, 2014 5:59 pm

Re: Elex

Post by ponaromixxx »

Just drag your .hdr file to r3resman and get .hdrdoc, open it through a text editor, you can also convert it back to .hdr

r3resman.zip
NicoDE
Posts: 10
Joined: Fri Oct 20, 2017 9:53 am

Re: Elex

Post by NicoDE »

ponaromixxx wrote:This for a large archive is suitable!

Nope, it doesn't even support compression mode 1 ('auto' for Risen 1 and Risen 2, 'zlib' for Risen 3 and ELEX). Well, and LFS (Large File Support) is broken.
Use the updated QuickBMS script or this:
elexebra.zip
(source)
NicoDE
Posts: 10
Joined: Fri Oct 20, 2017 9:53 am

Re: Elex

Post by NicoDE »

The GOG patch includes a data/packed/c_1_na.p00:

Code: Select all

head {
   char8_t  magic[4];     // "PAK "
   char8_t  version[4];   // "V001"
   uint64_t unknown;      // 0
   uint64_t info_offset;  // relative to head
   uint64_t info_size;    // uint32_t, 0
}
data {
}
info {
   root {
      char8_t  magic[4];     // "VOL "
      uint32_t unknown;      // 1
      uint32_t name_offset;  // relative to info
      uint32_t name_size;
      uint32_t file_offset;  // relative to info
      uint32_t file_count;
      uint32_t jour_offset;  // relative to info
      uint32_t jour_count;
   }
   jour[info.root.jour_count] {
      char8_t  magic[4];  // "JOUR"
      uint32_t unknown[3];
   }
   uint32_t sort[info.root.file_count];
   file[info.root.file_count] {
      char8_t  magic[4];      // "FILE"
      uint32_t unknown1;      // 0
      uint32_t name_offset;   // relative to info.file[*] (into info.name)
      uint32_t path_offset;   // relative to info.file[*] (into info.name)
      uint64_t data_offset;   // relative to head (into data)
      uint32_t file_attrib;
      uint32_t unknown2;      // 0
      uint64_t file_ctime;
      uint64_t file_mtime;
      uint32_t file_size;
      uint32_t data_size;
      char8_t  data_comp[4];  // "\0\0\0\0" (uncompressed), "ZLIB"
      uint32_t unknown3[3];   // 0, 0, 0
   }
   char8_t name[info.root.name_size];
}
Pure guesswork based on looking at the file with a hex-editor. Format is neither supported by Risenaut, nor Elexebra (it's unlikely that I will add support for it - so you might create a QuickBMS script...).
hhrhhr
Posts: 36
Joined: Sun Jan 18, 2015 11:22 pm

Re: Elex

Post by hhrhhr »

question: is this file contains whole updated files or only patches of in-game resources?
NicoDE
Posts: 10
Joined: Fri Oct 20, 2017 9:53 am

Re: Elex

Post by NicoDE »

hhrhhr wrote:question: is this file contains whole updated files or only patches of in-game resources?

It seems to contain the complete files with the new revision, that replace/override the entries in the original PAK (no incremental updates, would have been needlessly complex).

ps: note that name/path_offset are relative to the current file entry, not the file table
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Elex

Post by aluigi »

Can someone provide the data/packed/c_1_na.p00 file?
If it's very big go with the filecutter script.
I need it to be 100% sure of the script I'm writing.
hhrhhr
Posts: 36
Joined: Sun Jan 18, 2015 11:22 pm

Re: Elex

Post by hhrhhr »

aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Elex

Post by aluigi »

Thanks, script 0.2.3:
http://aluigi.org/bms/risen.bms

I have implemented this "PAK " format in the same risen script because, as far as I know after a google search, only the risen-like games on GOG use this format (search: gog patch "p00").
Lord Vaako
Posts: 26
Joined: Tue Oct 17, 2017 7:36 pm

Re: Elex

Post by Lord Vaako »

Just drag your .hdr file to r3resman and get .hdrdoc, open it through a text editor, you can also convert it back to .hdr

Thnx for info! I also wrote my own script to extract the needed data in the format I need :-)

I have one more question, maybe someone knows the answer :-)
I'm looking for "a connection" between "entity internal name" and its localized name, for example:

It_Misc_BartoxHead_Arx (found inside w_quests.hdr)
and
0xb430f5ac > Bartox's Head (english text from w_strings.bin)

does anybody know where I can find it?
NicoDE
Posts: 10
Joined: Fri Oct 20, 2017 9:53 am

Re: Elex

Post by NicoDE »

Lord Vaako wrote:does anybody know where I can find it?

In the previous games it was done by naming convention:
  • b430f5ac|focus:FO_It_Misc_BartoxHead_Arx
  • 574926c6|item:ITEM_It_Misc_BartoxHead_Arx
  • 9affe4a5|item:ITEMDESC_It_Misc_BartoxHead_Arx
Identifier hashes are case-insensitive ('A'..'Z' lowercase) and the table prefix (including the ':') is excluded.

Code: Select all

ID|German_Text|English_Text|French_Text|Italian_Text|Spanish_Text|Polish_Text|Russian_Text|Czech_Text|German_StageDir|English_StageDir|French_StageDir|Italian_StageDir|Spanish_StageDir|Polish_StageDir|Russian_StageDir|Czech_StageDir
b430f5ac|Bartox Schädel|Bartox's Head|Tête de Bartox|Testa di Bartox|Cabeza de Bartox|Głowa Bartoxa|Голова Бартокса|Bartoxova hlava||||||||
9affe4a5|Er wurde post mortem abgetrennt.|Bartox's head, removed post mortem.|La tête de Bartox, prélevée post mortem.|La testa di Bartox, rimossa dopo la morte.|La cabeza de Bartox, se la cortaron tras su muerte.|Głowa Bartoxa, usunięta po jego śmierci.|Голова Бартокса, отделенная от тела уже после смерти.|Bartoxova hlava, odejmutá post mortem.||||||||