The Witcher 3 Wild Hunt(*.cache*.bundle)

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
happyend
Posts: 157
Joined: Sun Aug 24, 2014 8:54 am

The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by happyend »

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

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by aluigi »

happyend
Posts: 157
Joined: Sun Aug 24, 2014 8:54 am

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by happyend »

very cool,great job,aluigi!!!
darkking647
Posts: 8
Joined: Thu Apr 16, 2015 8:14 am

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by darkking647 »

aluigi wrote:http://aluigi.org/papers/bms/others/witcher3.bms


Thanks !! works for .bundle file, any support for .cache files too ?
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by aluigi »

The script works also with cache file, I tested it against the provided soundspc.cache
Skykila
Posts: 7
Joined: Fri Aug 08, 2014 8:24 am

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by Skykila »

darkking647
Posts: 8
Joined: Thu Apr 16, 2015 8:14 am

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by darkking647 »

aluigi wrote:The script works also with cache file, I tested it against the provided soundspc.cache


Yes but it doesn't works with texture.cache file, pls check the sample given by user above.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by aluigi »

The texture one had a different format.
To do things quickly I have updated the script to dump all the data sequentially even if there is a sort of file table at the end (without information about how to find it like an offset or size).
Anyway the data is just headerless image so it's ok as is.
Zaxnator
Posts: 4
Joined: Tue May 19, 2015 2:29 pm

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by Zaxnator »

Wow, that was fast. Now just a way to import changed files back to .bundle
EDIT: I did something wrong when i tried to reimport for the first time, now it worked.
Last edited by Zaxnator on Wed May 20, 2015 6:53 am, edited 1 time in total.
SLaYeR983
Posts: 13
Joined: Tue May 19, 2015 8:20 pm

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by SLaYeR983 »

Help for w3strings files. Because we want to add new language to this game.

thanks a lot aluigi, for .cache and .bundle file format. We waiting for w3strings...
hhrhhr
Posts: 36
Joined: Sun Jan 18, 2015 11:22 pm

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by hhrhhr »

Code: Select all

char magic[4];      // "RTSW"
int version;        // 162
unsigned short key1;

uint6 count1;       // count of string
{
    int str_id;     // ^key, unique
    int offset;     // relative to start of utf[], must be multiple by 2
    int strlen;     // number of UTF16 chars, without ending zeroes
} // * count1

uint6 count2;       
{
    char unk[4]     // global id? crc? hash?
    int str_id      // ^key, same with first block
} // * count2

uint6 count3;       // count of UTF16 chars (2 byte)
{
    utf[count3 * 2] // \x00\x00 ended UTF16LE strings
}

unsigned short key2;    // key = key1 << 16 | key2


uint6 — this is a strange type (for me):
examples:

Code: Select all

80 (128) => 0 (zero)
2E (46) => 46
71 1D (113 29) => 1905

5B DC 0A (91 220 10) => 87835

             01 011011  91 -> 27    6 bit (1)
       1 1011100|||||| 220 -> 92    7 bit (2)
00 001010|||||||||||||  10 -> 10    6 bit (3)
   |||||||||||||||||||
   0010101011100011011  = 87835

           (1)          (1) (2)         (1) (2) (3)
27 | (92 << 6) | (10 << (6 + 7)) | 0 << (6 + 7 + 6)= 87835 :)

read function in Lua:

Code: Select all

local function bit6()
    local result, shift, b = 0, 0, 0
    repeat
        b = r:uint8()  -- return one byte from stream
        if b == 80 then return 0 end
        local s = 6
        local mask = 255
        if b > 127 then
            mask = 127
            s = 7
        elseif b > 63 then
            mask = 63
        end
        result = result | ((b & mask) << shift)
        shift = shift + s
    until b < 64
    return result
end


if key1, key2 == 0, then all the strings are represented in "the nude", see (ar|br|esMX).w3strings. if they are not zero, then all strings "encrypted", but not compressed. encription algo is same as in the Witcher 2.
Last edited by hhrhhr on Mon May 25, 2015 12:18 pm, edited 5 times in total.
Zaxnator
Posts: 4
Joined: Tue May 19, 2015 2:29 pm

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by Zaxnator »

I'm getting this error with patch.bundle file https://mega.co.nz/#!eQ0FjKrb!T6WmBWyoC ... IdagaaQYJE

Code: Select all

unsupported compression flag 4 at offset 0x08ff6000 <1317033->3510657>

Can anyone help out with this?
hhrhhr
Posts: 36
Joined: Sun Jan 18, 2015 11:22 pm

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by hhrhhr »

"flag 4" also means LZ4, try update .bms file with this:
add this:

Code: Select all

...
        elif ZIP == 4
            comtype lz4
            clog NAME OFFSET ZSIZE SIZE
...
Zaxnator
Posts: 4
Joined: Tue May 19, 2015 2:29 pm

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by Zaxnator »

hhrhhr wrote:"flag 4" also means LZ4, try update .bms file with this:
add this:

Code: Select all

...
        elif ZIP == 4
            comtype lz4
            clog NAME OFFSET ZSIZE SIZE
...


Thank you! Works perfectly now.
ak2005828
Posts: 2
Joined: Wed May 20, 2015 11:28 pm

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by ak2005828 »

I can unpack the bundle,but have problem reimport it,the file size is the same,don't know where got it wrong.

here is the MSG:

- REIMPORT mode enabled!
- open input file E:\quickbms\patch.bundle
- open script E:\quickbms\witcher3.bms
- set output folder E:\quickbms\gameplay\abilities

offset filesize filename
--------------------------------------

- 0 files reimported in 0 seconds
coverage file 0 1% 2405460 221183826

Press RETURN to quit
Zaxnator
Posts: 4
Joined: Tue May 19, 2015 2:29 pm

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by Zaxnator »

ak2005828 wrote:I can unpack the bundle,but have problem reimport it,the file size is the same,don't know where got it wrong.

here is the MSG:

- REIMPORT mode enabled!
- open input file E:\quickbms\patch.bundle
- open script E:\quickbms\witcher3.bms
- set output folder E:\quickbms\gameplay\abilities

offset filesize filename
--------------------------------------

- 0 files reimported in 0 seconds
coverage file 0 1% 2405460 221183826

Press RETURN to quit

In output folder select quickbms folder instead of abilities folder.
ak2005828
Posts: 2
Joined: Wed May 20, 2015 11:28 pm

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by ak2005828 »

thanks very much,got it,now it works.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by aluigi »

I updated the script by using an AND to check the compression.
wimbeam1337
Posts: 1
Joined: Mon Jun 01, 2015 4:41 pm

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by wimbeam1337 »

Well, I started to write a c# library that is able to open .bundle files.
It's a bit buggy but at least you can:

+ Handle directories
+ Delete/Move/Create/Overwrite files (no matter which size)
+ Compression/Decompression (use ICompression to handle your own compression)

You can find the source code here:

https://github.com/ngoedde/The-Witcher-3-XBundle

Have fun!

PS: feel free to create a pull request or PM me.
Fig8man
Posts: 5
Joined: Sat Jun 27, 2015 4:43 am

Re: The Witcher 3 Wild Hunt(*.cache*.bundle)

Post by Fig8man »

i get this error when extracting texture.cache

Error: the compressed zlib/deflate input is wrong or incomplete (-3)
Info: algorithm 1
offset 2cf5f008
input size 0x00461500 4592896
output size 0x00800000 8388608
result 0xffffffff -1

Error: the uncompressed data (-1) is bigger than the allocated buffer (8388608)

Last script line before the error or that produced the error:
82 clog "" OFFSET ZSIZE SIZE


all i want to do is see if the gwent card textures are in this file because they aren't in gwint_game.redswf
and gwint_game.redswf seems to be calling .dds files from somewhere.


EDIT: welp seems i was using an older version of quickbms so i got 0.6.4 and then got a different error

Error: incomplete input file 0: C:\Users\Ben\Desktop\New folder (3)\witcher 3 bu
ndles\cache files\texture.cache
Can't read 4 bytes from offset dbe576b6.
Anyway don't worry, it's possible that the BMS script has been written
to exit in this way if it's reached the end of the archive so check it
or contact its author or verify that all the files have been extracted.
Please check the following coverage information to know if it's ok.

coverage file 0 0% 89469 3473798781

Last script line before the error or that produced the error:
74 get ZSIZE long

Press RETURN to quit