Page 2 of 3

Re: Quake Champions .PAK (Saber Engine)

Posted: Fri Sep 14, 2018 5:36 pm
by Curtain
aluigi recently posted this on ZenHAX:
aluigi wrote:I have just updated the script in case someone wants to test it:
http://aluigi.org/bms/quake_champions.bms

The only sample file I have here uses an older constant so I didn't test it.
https://zenhax.com/viewtopic.php?f=9&t= ... 4&start=20

Re: Quake Champions .PAK (Saber Engine)

Posted: Sat Sep 15, 2018 9:56 pm
by Curtain
For some strange reason, I can't register on the ZenHax forum.

I will post my results here.
This is my first time using QuickBMS, so let me know if I'm doing something incorrectly.

I pointed QuickBMS to the shared.pak file (using the Steam version of Quake Champions).
[ steamapps\common\quakechampions\client\preload\paks\shared.pak ]
After selecting the output, my console output shows this:

Code: Select all

insert the constant number for NrRandom initialization, it depends by the version of the game like 0x412e2206 and 0x631A2028

- please insert the content for the variable SEED2:
What do I do?

-EDIT-
Someone please report this to aluigi.

Re: Quake Champions .PAK (Saber Engine)

Posted: Tue Oct 02, 2018 4:56 am
by Curtain
Thank you OXOTHuK for reporting on my behalf.

A user, z65536, from the ZenHax forum, replied with an updated script for QuickBMS.
[color=#0080FF][b]z65536[/b][/color] wrote:My script that can extract shared.pak is here.

Code: Select all

# Quake Champions
# script for QuickBMS http://quickbms.aluigi.org

quickbmsver "0.8.0"
set MEMORY_FILE10 string "
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned long long ulong;

    // Numerical Recipes 3rd edition
    static ulong u, v, w;

    ulong NextUInt64()
    {
      u = u * 2862933555777941757ULL + 7046029254386353087ULL;
      v ^= v >> 17; v ^= v << 31; v ^= v >> 8;
      w = 4294957665U * (w & 0xffffffff) + (w >> 32);
      ulong x = u ^ (u << 21); x ^= x >> 35; x ^= x << 4;
      return (x + v) ^ w;
    }

    void NrRandom(ulong seed)
    {
      v = 4101842887655102017ULL;
      w = 1;

      u = v ^ seed ^ 0x631A2028; NextUInt64();
      v = u;                     NextUInt64();
      w = v;                     NextUInt64();
    }

// Quake Champions
static ulong    qc_seed = 0;
static uchar    qc_ivec[32] = {0};
static ushort   qc_seed_idx = 0;
static ushort   qc_ivec_idx = 0;

void quake_decrypt_init(uchar *key) {
   int     i;
   for(i = 0; i < sizeof(qc_ivec); i++) {
      qc_ivec[i] = key[i];
   }
   qc_seed = *(ulong *)key;
   qc_seed_idx = 0;
   qc_ivec_idx = 0;
   NrRandom(qc_seed);
}

int quake_decrypt(unsigned char *data, int size) {
    int     i;
    for(i = 0; i < size; i++) {
        uchar old = qc_ivec[qc_ivec_idx];
        qc_ivec[qc_ivec_idx] = data[i] ;
        data[i] ^= (qc_seed_idx == 0 ? qc_seed :0) ^ old ;
        qc_ivec_idx = (qc_ivec_idx + 1) & 0x1f;
        if(++qc_seed_idx == 8) {
            qc_seed = NextUInt64();
            qc_seed_idx = 0;
        }
    }
    return size;
}
"

goto -40
getdstring KEY 40
calldll MEMORY_FILE10 "quake_decrypt_init" "tcc" RET KEY
findloc OFFSET binary "PK\x06\x06" 0 "" 0
goto OFFSET
idstring "PK\x06\x06"
   get ZERO byte
   get central_entries longlong
   get central_size longlong
   get central_offset longlong
   get DUMMY_offset longlong

goto central_offset
for i = 0 < central_entries

    savepos TMP
    log MEMORY_FILE TMP 0x2e
    calldll MEMORY_FILE10 "quake_decrypt" "tcc" RET MEMORY_FILE 0x2e
    goto 0x2e 0 SEEK_CUR

    goto 0 MEMORY_FILE
    idstring MEMORY_FILE "PK\x01\x02"
        get ver_made        short MEMORY_FILE
        get ver_need        short MEMORY_FILE
        get flag            short MEMORY_FILE
        get method          short MEMORY_FILE
        get modtime         short MEMORY_FILE
        get moddate         short MEMORY_FILE
        get zip_crc         long MEMORY_FILE
        get comp_size       long MEMORY_FILE
        get uncomp_size     long MEMORY_FILE
        get name_len        short MEMORY_FILE
        get extra_len       short MEMORY_FILE
        get comm_len        short MEMORY_FILE
        get disknum         short MEMORY_FILE
        get int_attr        short MEMORY_FILE
        get ext_attr        long MEMORY_FILE
        get rel_offset      long MEMORY_FILE

    savepos TMP
    log MEMORY_FILE TMP name_len
    calldll MEMORY_FILE10 "quake_decrypt" "tcc" RET MEMORY_FILE name_len
    goto name_len 0 SEEK_CUR

    goto 0 MEMORY_FILE
        getdstring name     name_len MEMORY_FILE

        # not encrypted
        getdstring extra    extra_len
        getdstring comment  comm_len

      if extra_len >= 12
         getvarchr extra_id extra 0 short
         if extra_id == 0x0001
            if rel_offset == 0xffffffff
               getvarchr rel_offset extra 4 longlong
            endif
         endif
      endif
      
    math offset = 0x1e
    math offset + rel_offset

        if method == 0
            Log name offset uncomp_size # same as comp_size
            #Log name offset comp_size   # was uncomp_size before AES
        else
            if method == 8
                ComType deflate
            else
                print "unsupported compression method %method%"
                cleanexit
            endif
            CLog name offset comp_size uncomp_size
        endif
next i
https://zenhax.com/viewtopic.php?f=9&t= ... =20#p38930

I was able to use the new script with QuickBMS on the shared.pak(12.1 GB).
The extracted folders:
[database] (10.9 MB)
[hkx] (7.30 MB)
[sound] (446 MB)
[textures] (14.6 GB)
[tpl] (1.10 GB)
[video] (727 MB)

I'm looking for the character meshes, and I think they are in the [tpl] folder.
The [tpl] folder contains 803 files with the following file formats:
TPL
TPL_DATA
CDT


This is my first time doing this, and I'm not familiar with the TPL or CDT formats.
How do I proceed with locating the meshes and then import them into Blender?

Re: Quake Champions .PAK (Saber Engine)

Posted: Tue Oct 02, 2018 11:16 am
by rev3n4nt
Curtain, how exactly did you used new script on shared.pak? Is your version of Quake Champions latest? I'm using latest version of QC on Steam, and Quick BMS responds with:

Code: Select all

insert the constant number for NrRandom initialization, it depends by the version of the game like 0x412e2206 and 0x631A2028
- please insert the content for the variable SEED2:
Did you had such thing? And if you did, how you managed to proceed?

Re: Quake Champions .PAK (Saber Engine)

Posted: Tue Oct 02, 2018 12:13 pm
by Curtain
rev3n4nt wrote:Curtain, how exactly did you used new script on shared.pak? Is your version of Quake Champions latest? I'm using latest version of QC on Steam, and Quick BMS responds with:

Code: Select all

insert the constant number for NrRandom initialization, it depends by the version of the game like 0x412e2206 and 0x631A2028
- please insert the content for the variable SEED2:
Did you had such thing? And if you did, how you managed to proceed?
The error you had was the same 1 I had when using the script from aluigi's post.
I used the new script from z65536's recent post.

-EDIT- Forgot to mention, I am using steam and have the latest version of Quake Champions.

Re: Quake Champions .PAK (Saber Engine)

Posted: Tue Oct 02, 2018 10:06 pm
by rev3n4nt
I used the new script from z65536's recent post.
Thanks for checking out Curtain. I used all scripts on that page. I deleted all QC files and downloaded it again - extracts fine.
You mentioned [textures] in previous post, did you managed to extract PCT files? I tried from moddb "QCPCT_v02", but it gives noisy image.

Re: Quake Champions .PAK (Saber Engine)

Posted: Tue Oct 02, 2018 11:44 pm
by Curtain
rev3n4nt wrote:
I used the new script from z65536's recent post.
Thanks for checking out Curtain. I used all scripts on that page. I deleted all QC files and downloaded it again - extracts fine.
You mentioned [textures] in previous post, did you managed to extract PCT files? I tried from moddb "QCPCT_v02", but it gives noisy image.
I haven't tried using any of the available extraction tools for textures yet. I figured I would focus on getting the meshes first and then use Ninja Ripper to rip the textures in case the other texture tools don't work.
Have you managed to locate and extract the character meshes?

Re: Quake Champions .PAK (Saber Engine)

Posted: Sat Oct 06, 2018 5:39 am
by Curtain
Did anyone locate the character meshes?

I believe the game assets in the Steam version are located here:
steamapps\common\quakechampions\client\preload\paks
- awoken.pak (163 MB)
- basic_training_map.pak (267 MB)
- blood_covenant.pak (541 MB)
- bloodrun.pak (243 MB)
- burial_chamber.pak (494 MB)
- cache.pak (172 MB)
- church.pak (447 MB)
- corrupted_keep.pak (150 MB)
- fortress_of_the_deep.pak (218 MB)
- initial.pak (625 MB)
- lighthouse.pak (381 MB)
- lockbox.pak (274 MB)
- longestyard.pak (117 MB)
- main_menu.pak (46.4 MB)
- ruins_of_sarnath.pak (318 MB)
- shared.pak (12.1 GB)
- vale_of_pnath.pak (112 MB)

The shared.pak(12.1 GB) has the following folders:
[database] (10.9 MB)
[hkx] (7.30 MB)
[sound] (446 MB)
[textures] (14.6 GB)
[tpl] (1.10 GB)
[video] (727 MB)

The [tpl] folder (803 files) doesn't appear to have any recognizable 3d mesh formats:
- .TPL
- .TPL_DATA
- .CDT


Anyone know what .CDT and .TPL_DATA are?
Am I looking in the wrong place?

In Aug 26th 2017, a forum member suggested the possibility of the meshes being included in the .PCT files:
[b][color=#FF4000]Matsilagi[/color][/b] wrote:After checking out the (kinda recent) Quake Champions PAK explorer, i found PCT files, in which it says its textures, however, i think the models may be stored here aswell.
iOrange replied with a release of QCPCT for extracting textures but he didn't mention anything about character meshes.
viewtopic.php?f=16&t=16927&hilit=Quake+Champion

Re: Quake Champions .PAK (Saber Engine)

Posted: Sat Oct 06, 2018 6:24 pm
by GRiNDERKILLER
Curtain wrote:In Aug 26th 2017, a forum member suggested the possibility of the meshes being included in the .PCT files:
[b][color=#FF4000]Matsilagi[/color][/b] wrote:After checking out the (kinda recent) Quake Champions PAK explorer, i found PCT files, in which it says its textures, however, i think the models may be stored here aswell.
PCT are only textures. TCIP header means PICTURE. Btw textures are easily convertable by Rawtex. You must just set start offset of raw data + sometimes guess compression. But mostly they are BC7 - RGB/sRGB
About TPL files they have a string S3DRESOURCE means SABER 3D RESOURCE. MESH maybe?... I tried H2O but no luck. Since i still don't know where starts VTBlock and which size has.

Re: Quake Champions .PAK (Saber Engine)

Posted: Sun Oct 07, 2018 1:40 am
by Curtain
GRiNDERKILLER wrote:PCT are only textures. TCIP header means PICTURE. Btw textures are easily convertable by Rawtex. You must just set start offset of raw data + sometimes guess compression. But mostly they are BC7 - RGB/sRGB
Thank you for clarifying.
For the textures, I may just use Ninja Ripper, since I'm not familiar with Rawtex.
GRiNDERKILLER wrote:About TPL files they have a string S3DRESOURCE means SABER 3D RESOURCE. MESH maybe?... I tried H2O but no luck. Since i still don't know where starts VTBlock and which size has.
Thank you again.
Is this something aluigi or other ZenHax members know more about?
I'm having some difficulty registering on the ZenHax site. I was hoping to share your post with them: https://zenhax.com/viewtopic.php?f=9&t= ... 8&start=20
-EDIT- Not sure if they need a sample TPL file.

Re: Quake Champions .PAK (Saber Engine)

Posted: Sun Oct 14, 2018 8:26 pm
by rev3n4nt
So I posted in zenhax forum:
https://zenhax.com/viewtopic.php?f=9&t= ... 9&start=20
Added model & texture files : ripped "Eradicator" Railgun, and same model extracted from PAK packages.
Maybe it might be helpful :)

Re: Quake Champions .PAK (Saber Engine)

Posted: Sat Nov 03, 2018 10:33 pm
by srcs34k
[quote="Curtain"][/quote]

thank you for script, i extract shared.pak\[sound], but what tool to convert "bank" files to wav or mp3?

Re: Quake Champions .PAK (Saber Engine)

Posted: Wed Jan 09, 2019 3:33 pm
by henriksen
Can someone please share sound.pak? Seems like they always changing encryption and there's no proper script to unpack .pak file.

Re: Quake Champions .PAK (Saber Engine)

Posted: Tue Mar 26, 2019 7:48 pm
by srcs34k
henriksen wrote: Wed Jan 09, 2019 3:33 pm Can someone please share sound.pak?
shared.pak@CRCB11CE12F@[sound]
https://mega.nz/#!V1tAHAIQ!rzksQrxvrIzF ... JnYHS4VFVU

i try novasoft extractor and Ravioli Explorer dont work, if u have tool share plz

Re: Quake Champions .PAK (Saber Engine)

Posted: Thu May 02, 2019 3:23 am
by Curtain
Hi, sorry for the inactivity.
I received a few private messages while I was gone, and to be clear, I'm not the author of any of these scripts.
I came across these scripts while exploring the ZenHax forum.
I don't know if they still work or not.

When Quake Champions finally leaves Early Access, I will make another attempt to extract.
Hopefully, by then, someone will have an updated script/program tool.