ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Tue Jun 19, 2018 12:31 pm

All times are UTC




Post new topic  Reply to topic  [ 47 posts ]  Go to page Previous 1 2 3 Next
Author Message
PostPosted: Sat Dec 02, 2017 3:30 pm 

Joined: Fri Mar 18, 2016 3:32 pm
Posts: 10
repack ?


Top
   
PostPosted: Sun Dec 03, 2017 7:38 pm 

Joined: Sat Oct 14, 2017 11:08 am
Posts: 4
Any progress with repack? thx


Top
   
PostPosted: Fri Apr 20, 2018 4:03 am 

Joined: Mon Oct 06, 2014 3:30 am
Posts: 178
Anyone can explain more about structures's files for write a program can unpack and repack. Thanks.


Top
   
PostPosted: Thu May 24, 2018 10:26 am 
User avatar

Joined: Tue Oct 13, 2015 1:26 pm
Posts: 218
aluigi wrote:
I guess it's caused by the weird deflate
Sorry to bother you with this subject again but I don't think that problem is with deflate, because I made a test: repacking only the PTR file and keeping the original PKR file, the game works normally.
I think that unknown 8 bytes from PTR are some checksum of the PKR file.
If you have some time and desire, please check this again.
Game executable and file sample: http://www.mediafire.com/file/aytstj7a7sjmboi/The_Evil_Within_2.7z/file

_________________
Tribo Gamer Brasil


Top
   
PostPosted: Sat May 26, 2018 6:54 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 8291
Eh I don't think I'm going to return on this mainly because there is nothing else to do from my side (reimport mode can't calculate crc in any case).
If that 64bit field at offset 8 after VER "may" be a crc (2 32 or a 64) of pkr, then the game should refuse to load it even if you change of the bytes from offset 4 to 0xf of pkr.


Top
   
PostPosted: Mon May 28, 2018 12:23 pm 
User avatar

Joined: Wed Jul 19, 2017 5:04 am
Posts: 60
i edited sounds and mesh files with this script, but i found two english localization file in two dfferent side, where is the main text?

_________________
Be Good, Even in distressing or defamation and chill, Even Everyone's Called You a Bad Guy Or Lier and Mad


Top
   
PostPosted: Tue May 29, 2018 10:08 am 
User avatar

Joined: Wed Jul 19, 2017 5:04 am
Posts: 60
i found something... this script has a problem and can not work on loc_.ptr files... for edit this files, we need to edit both .ptr and .pkr, but this script just can support on pkr in import, thats why game crashing in start...

_________________
Be Good, Even in distressing or defamation and chill, Even Everyone's Called You a Bad Guy Or Lier and Mad


Top
   
PostPosted: Wed May 30, 2018 2:37 pm 
User avatar

Joined: Wed Jul 19, 2017 5:04 am
Posts: 60
PTR just has Name Files,
the_evil_within_2.bms Can Extract all Files successfully in PKR, but Cant import file's
Because This script change the compression type in Reimport mode and game can't read this Compression type in Reimported file with this QuivkBMS script

this is not deflate, actually it's Zlib, and This is not like other compression method

For Example:
if i extract a PKR and Reimport Again Without any edit or Change in File's, and when i Compare this reimported file with original file In Hex-Editor, this two file must be same data, but its not same data, because QuickBMS change This Compression Type in Reimport and game can't read This Compression Type (That is Why Game Will Crash In Start)
Problem is Compression Type and We Must Find Right Compression type

_________________
Be Good, Even in distressing or defamation and chill, Even Everyone's Called You a Bad Guy Or Lier and Mad


Top
   
PostPosted: Wed May 30, 2018 10:26 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 8291
It's not zlib (2-bytes header + deflate + crc), it's just raw deflate (not even deflatex, just deflate).
If it was zlib first of all you would have found results with offzip (-z 15) and then OFFSET points exactly to the beginning of the compressed stream (if it was zlib then deflate would have worked from OFFSET + 2).
Recompressed data doesn't have the same bytes even if you don't change it because the implementations, settings and versions of the compression algorithms are ever different.
Files reimported and reextracted are identical in case that's what you meant (tested with loc_01.pkr/ptr).

From my side I have really nothing else to add, the work I did is complete and the script correctly extract all the files, so I hope you understand if I start to ignore this topic for not wasting other time on it.


Top
   
PostPosted: Fri Jun 01, 2018 6:19 am 
User avatar

Joined: Wed Jul 19, 2017 5:04 am
Posts: 60
aluigi... finally i found it...

quickbms using ( inflate version:1.2.11)
but this game using inflate version: 1.2.3

you nust update your quickBMS.exe, becuasu we need to inflate_noerror to repack
i tested in game and works fine with inflate_noerror

_________________
Be Good, Even in distressing or defamation and chill, Even Everyone's Called You a Bad Guy Or Lier and Mad


Top
   
PostPosted: Sat Jun 02, 2018 8:49 am 
User avatar

Joined: Fri Oct 24, 2014 2:55 pm
Posts: 111
*.PTR
Code:
UINT32 - XORed by 0xFADC4688 decompressed PTR size
UINT32 - version
UINT32 - splited to 4 parts and XORed first 32768 bytes (32 KB) PKR MD5
UINT32 - splited to 4 parts and XORed decompressed PTR MD5


You should compress PTR file. It's work fine with C# DeflateStream. And you don't need compress PKR data.

_________________
Ekzordium - Ukrainian Localize Team.


Top
   
PostPosted: Sat Jun 02, 2018 1:37 pm 
User avatar

Joined: Wed Jul 19, 2017 5:04 am
Posts: 60
Final information

ptr: it's just name files and hash table
pkr: main Data and base files,

first of first, its a deflate compression (1998 - 2005 v1.2.3)
for extract file: quickBMS can support deflate and we must ust deflate_noerror cause this is a noerror mode and The_Evil_Within_2.bms can extract this file verry well (with right algoritm)...

for repack: as i know, we have a flate... so, in two mode with de&in (de[b]flate_noerror and in[/b]flate_noerror), quickBMS can support deflate with noerror... but quikBMS can't support inflate with noerror
end of word: We need inflate_noerror for import files in .pkr

_________________
Be Good, Even in distressing or defamation and chill, Even Everyone's Called You a Bad Guy Or Lier and Mad


Top
   
PostPosted: Sat Jun 02, 2018 2:36 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 8291
I would like to clarify something about the "_noerror" in "deflate_noerror".

In the script deflate_noerror is used for the following 2 reasons:
- the first time because the decompressed size of the TOC wasn't known (InKviZ is right about the xor but it's not necessary for the decompression, maybe other games will change the xor)
- the second time because there is probably a missing terminator bit in the compressed files or something similar and so the zlib library (and any other library) will return an error

Now "deflate_noerror" is EXACTLY THE SAME of "deflate", same algorithm and same code, with the following improvements:
- it doesn't care about the decompressed size because it will continue to decompress the input data and increase the output buffer until zlib says that there is stuff to decompress (just like comtype unzip_dynamic)
- if the algorithm returns an error, deflate_noerror will return the data decompressed till that moment instead of breaking the extraction and returning an error. for some types of errors it may return the original compressed data

Therefore DOES NOT EXISTS an inflate_noerror because deflate and deflate_noerror are the same.

Just in case you are asking what is comtype unzip_dynamic, well it's a zlib_noerror that switches to deflate_noerror in case of errors and switches to no compression if that fails too.

I know, it's technical stuff that people usually can't know, but I'm happy to provide these info if something is not clear.

Basically what you would need in this case, if you are 100% sure that it's not something related to a checksum/hash used in the archive that avoid the files to be loaded, would be to know what's the small customization that the game uses in its deflate implementation but even in that case after all the work are you going to write a rebuilder with a custom zlib from scratch?


Top
   
PostPosted: Sat Jun 02, 2018 2:44 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 8291
And yes I confirm that indeed is the "bfinal" bit which is never set to 1 like instead it should be.
You are going crazy if you check the zlib source code while with tinflate.c it's very simple:
Code:
   do {
      ...
      /* read final block flag */
      bfinal = tinf_getbit(&d);
      ...
   } while (!bfinal);


Top
   
PostPosted: Sat Jun 02, 2018 9:27 pm 
User avatar

Joined: Fri Oct 24, 2014 2:55 pm
Posts: 111
common.ptr and common.pkr as example.
On the first image we skip header (0x10 bytes), select next 0x8000 bytes and calculate MD5 and get AAA643D74BB3433E09F662006A05EDB8

Image

Then (img2) we split this hash to 4 parts and XOR it.
Code:
0xAAA643D7 ^ 0x4BB3433E ^ 0x09F66200 ^ 0x6A05EDB8 = 0x82E68F51

Image

As i promise Zotya0330. I'll share tool source when return to home, monday-tuesday.

_________________
Ekzordium - Ukrainian Localize Team.


Top
   
PostPosted: Sun Jun 03, 2018 12:20 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 8291
@InKviZ
That's the TOC while users are interested in importing the files.
The topic is already confusing by itself, let's try to stay focused on one matter at time :)


Top
   
PostPosted: Sun Jun 03, 2018 7:25 pm 
User avatar

Joined: Tue Oct 13, 2015 1:26 pm
Posts: 218
The Evil Within 2 PKR Tool
By Delutto
See Readme.txt for instructions.
Attachment:
The_Evil_Within_2_PKR_Tool_By_Delutto.7z [744.3 KiB]
Downloaded 6 times
Notes:
- Based on aluigi research: http://aluigi.org/bms/the_evil_within_2.bms and file verification research by ripper: http://forum.xentax.com/viewtopic.php?f=35&p=141001.

Updates:
Code:
06/08/2018
  - Add support for PS4 files(Experimental).
  - Text bugfix.

06/03/2018
  - Add support to Import Mode, thanks ripper: http://forum.xentax.com/viewtopic.php?f=35&t=17407
  - Automatic convertion of LANB files (localizations files).

Image

_________________
Tribo Gamer Brasil


Last edited by Delutto on Sat Jun 09, 2018 10:09 pm, edited 2 times in total.

Top
   
PostPosted: Mon Jun 04, 2018 1:57 pm 

Joined: Mon Oct 06, 2014 3:30 am
Posts: 178
Delutto wrote:
The Evil Within 2 PKR Tool
By Delutto
See Readme.txt for instructions.The_Evil_Within_2_PKR_Tool_By_Delutto.7z
Notes:
- Based on aluigi research: http://aluigi.org/bms/the_evil_within_2.bms and file verification research by ripper: http://forum.xentax.com/viewtopic.php?f=35&p=141001.
- Moding p1_loc_01.pkr/ptr, I could see that the game stop of recognize the unicode fonts. I don't know why, could be a problem related to uncompressed files, or something related to game patch system or a problem in my import algo. I'm working on that.
Anyway, ripper will release a tool.

Image

Thanks! You're my hero. Hope that tool will support PS4 file in the furture. I tested it with PS4 file: https://1drv.ms/u/s!AqHXyzDaH_sGiUoSOw9It4jZpiX6
PC files working flamless. Thank you very much.


Top
   
PostPosted: Mon Jun 04, 2018 6:13 pm 
User avatar

Joined: Tue Oct 13, 2015 1:26 pm
Posts: 218
shadow_lonely wrote:
Hope that tool will support PS4 file in the furture. I tested it with PS4 file: https://1drv.ms/u/s!AqHXyzDaH_sGiUoSOw9It4jZpiX6.
Try this mod file and let me know what happen.
Attachment:
PS4_loc_01.7z [1.72 MiB]
Downloaded 32 times

_________________
Tribo Gamer Brasil


Top
   
PostPosted: Tue Jun 05, 2018 3:17 am 
User avatar

Joined: Wed Jul 19, 2017 5:04 am
Posts: 60
thanks... But Text's are UTF-8 in .lanb, but tool Export/Import text in ANSI... Can you fix that?
your jobs is Great and thank to you for all of this :)

_________________
Be Good, Even in distressing or defamation and chill, Even Everyone's Called You a Bad Guy Or Lier and Mad


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 47 posts ]  Go to page Previous 1 2 3 Next

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited