Page 2 of 20

Re: watch dogs 2 .dat .fat archive?

Posted: Thu Dec 08, 2016 7:40 pm
by Ekey
Well, i found LZ4. Seems there changed only dec32_table :

Original

Code: Select all

const unsigned dec32table[] = {0, 1, 2, 1, 4, 4, 4, 4};
const int dec64table[] = {0, 0, 0, -1, 0, 1, 2, 3};
UBI

//32 - {0, 3, 2, 3, 0, 0, 0, 0};

Code: Select all

  v46 = 0i64;
  v47 = 3i64;
  v48 = 2i64;
  v49 = 3i64;
  v50 = 0i64;
  v51 = 0i64;
  v52 = 0i64;
  v53 = 0i64;
and

//64 - {0, 0, 0, -1, 0, 1, 2, 3};

Code: Select all

  v54 = 0i64;
  v55 = 0i64;
  v56 = 0i64;
  v57 = -1i64;
  v58 = 0i64;
  v59 = 1i64;
  v60 = 2i64;
  v61 = 3i64;

Re: watch dogs 2 .dat .fat archive?

Posted: Thu Dec 08, 2016 7:47 pm
by Sir Kane
I already reverse engineered the LZ4 one, just need to get LZMA working.

Re: watch dogs 2 .dat .fat archive?

Posted: Thu Dec 08, 2016 8:46 pm
by daemon1
I don't see a single file in the whole 22GBs using lzma. I checked this specifically right now. How can you get it working when there's no files compressed with it?

Re: watch dogs 2 .dat .fat archive?

Posted: Thu Dec 08, 2016 8:51 pm
by Sir Kane
It's certainly being used.

Re: watch dogs 2 .dat .fat archive?

Posted: Thu Dec 08, 2016 8:55 pm
by daemon1
Ekey wrote:Well, i found LZ4. Seems there changed only dec32_table :

//32 - {0, 3, 2, 3, 0, 0, 0, 0};
//64 - {0, 0, 0, -1, 0, 1, 2, 3};
This game only runs on 64 bit. Both these tables are for 64-bit LZ4:

Code: Select all

        readonly sbyte[] m_DecArray = new sbyte[8] { 0, 3, 2, 3, 0, 0, 0, 0 };
        readonly sbyte[] m_Dec2table = new sbyte[8] { 0, 0, 0, -1, 0, 1, 2, 3 };

Re: watch dogs 2 .dat .fat archive?

Posted: Thu Dec 08, 2016 8:57 pm
by daemon1
Sir Kane wrote:It's certainly being used.
Maybe, but NOT on the fat/dat files. Maybe on some savegame data? Anyway, its not needed for unpacking game files.

Re: watch dogs 2 .dat .fat archive?

Posted: Thu Dec 08, 2016 9:04 pm
by Sir Kane
Some of the data in the .dat files is compressed with the modified LZMA, and the rest is compressed with the modified LZ4.

Re: watch dogs 2 .dat .fat archive?

Posted: Thu Dec 08, 2016 9:10 pm
by daemon1
Sir Kane wrote:Some of the data in the .dat files is compressed with the modified LZMA, and the rest is compressed with the modified LZ4.
ok if you say so, tell me at least one filename/offset compressed with lzma.

p.s. i'm talking about watch dogs 2, maybe you're looking into far cry?

Re: watch dogs 2 .dat .fat archive?

Posted: Thu Dec 08, 2016 9:22 pm
by Ekey
Here one decompressed XML file. One strange thing: in the end of file can be some trash bytes. :constipated:

Re: watch dogs 2 .dat .fat archive?

Posted: Thu Dec 08, 2016 10:37 pm
by daemon1
ok considering this all, it looks like we either have different versions of the game, or game protection makes some different obfuscation in different regions, or even every copy of the game. So it will be technically impossible to make a tool for this.

Re: watch dogs 2 .dat .fat archive?

Posted: Thu Dec 08, 2016 10:53 pm
by daemon1
if Sir Kane wants to prove its not true, I'm still waiting for a .dat file offset where lzma is used.

Re: watch dogs 2 .dat .fat archive?

Posted: Thu Dec 08, 2016 11:07 pm
by daemon1
nothing?

Re: watch dogs 2 .dat .fat archive?

Posted: Fri Dec 09, 2016 4:11 am
by Sir Kane

Re: watch dogs 2 .dat .fat archive?

Posted: Fri Dec 09, 2016 4:25 am
by mlleemiles
Sir Kane, may I ask how did you extract the file names from the data?

Re: watch dogs 2 .dat .fat archive?

Posted: Fri Dec 09, 2016 5:05 am
by Sir Kane
There's a function pointer the game calls with the string to hash if it's non-null, so I just set the function pointer to a function that dumps the passed in string into a file.