Page 1 of 12

The Witcher 2

Posted: Tue May 17, 2011 5:44 pm
by CMihai
The contents of this post was deleted because of possible forum rules violation.

Re: The Witcher 2

Posted: Tue May 17, 2011 9:37 pm
by chrrox
I doubt this format will be supported they seem to have ripped off unreal engine's format without actually using the unreal engine.

Re: The Witcher 2

Posted: Wed May 18, 2011 12:08 am
by voltagex
Smaller sample at http://filevo.com/dnvemmwnixa7.html

The retail/GOG/Steam releases all seem to be set up differently in the way the files are laid out in the game directory.

The folder CookedPC would point to Unreal though - but I thought this engine was custom?

Re: The Witcher 2

Posted: Wed May 18, 2011 7:15 am
by Rick
chrrox wrote:I doubt this format will be supported they seem to have ripped off unreal engine's format without actually using the unreal engine.
What? their archive format looks nothing like unreal packages.

Re: The Witcher 2

Posted: Wed May 18, 2011 11:43 am
by chrrox
you got an extractor working?

Re: The Witcher 2

Posted: Wed May 18, 2011 12:29 pm
by destiny7
The contents of this post was deleted because of possible forum rules violation.

Re: The Witcher 2

Posted: Wed May 18, 2011 4:26 pm
by zeeh
en0.w2strings seems to have an encrypted/xored block.

Re: The Witcher 2

Posted: Wed May 18, 2011 9:29 pm
by Rick
chrrox wrote:you got an extractor working?
Yes, I have not committed my code to my repository yet though.

Re: The Witcher 2

Posted: Wed May 18, 2011 9:51 pm
by zeeh
Rick wrote:
chrrox wrote:you got an extractor working?
Yes, I have not committed my code to my repository yet though.
Good news :) I wish it works with *.w2strings files too.

Re: The Witcher 2

Posted: Wed May 18, 2011 9:52 pm
by Rick
It won't, w2strings files are another beast entirely, not an archive file.

Re: The Witcher 2

Posted: Thu May 19, 2011 1:37 am
by voltagex
Rick wrote:
chrrox wrote:you got an extractor working?
Yes, I have not committed my code to my repository yet though.

Is it GitHub or something so I can subscribe to your commits?

Re: The Witcher 2

Posted: Thu May 19, 2011 2:14 am
by Rick
voltagex wrote:Is it GitHub or something so I can subscribe to your commits?
http://cia.vc/stats/project/red
http://svn.gib.me/public/red

Re: The Witcher 2

Posted: Thu May 19, 2011 2:16 am
by Rick
I'll probably commit my unpacking code soon; today I've been working on the w2scripts file (got most of it read -- need to write disassembler :)).

Re: The Witcher 2

Posted: Thu May 19, 2011 12:11 pm
by chrrox
ok here is a basic bms its not done yet.
but you re right the file format is not that bad.

Code: Select all

idstring DZIP
get unk01 long
get files long
get unk02 long
get tableoff long
goto tableoff
for i = 0 < files
get nsize short
getdstring name nsize
get unk03 long
get unk04 long
get size long
get null01 long
get offset long
get null02 long
get zsize long
get null03 long
log name offset zsize
next i
Can you help me understand this

Code: Select all

while (i < input.Length)
            {
                var op = input[i++];
                var control = (op >> 5) & 0x07;
                
                if (control == 0)
                {
                    // uncompressed blob
                    int length = 1 + (op & 0x1F);
                    Array.Copy(input, i, output, o, length);
                    i += length;
                    o += length;
                }
                else
                {
                    int length;

                    if (control == 7)
                    {
                        length = 6 + input[i++];
                    }
                    else
                    {
                        length = control - 1;
                    }
                    length += 3;

                    int offset = (op & 0x1F) << 8;
                    offset |= input[i++];

                    offset = o - 1 - offset;

                    if (offset + length > o)
                    {
                        while (length > 0)
                        {
                            output[o++] = output[offset++];
                            length--;
                        }
                    }
                    else
                    {
                        Array.Copy(output, offset, output, o, length);
                        o += length;
                    }
                }
            }

also the bit about the cd key needed for dlc packages.

Re: The Witcher 2

Posted: Thu May 19, 2011 7:18 pm
by Rick
That's the compression scheme Witcher 2 uses in its archive files. As for the CDKey -- file names are obfuscated in DLC DZIPs using the CDKey.