Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

The Evil Within 2 .ptr .pkr

Featured Replies

  • Author
  • Localization

aluigi, posted Sat May 26, 2018 6:54 pm (35287)


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.
  • Replies 54
  • Views 17
  • Created
  • Last Reply

Top Posters In This Topic

  • Author
  • Localization

GHOST DEAD, posted Mon May 28, 2018 12:23 pm (35349)


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?
  • Author
  • Localization

GHOST DEAD, posted Tue May 29, 2018 10:08 am (35383)


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...
  • Author
  • Localization

GHOST DEAD, posted Wed May 30, 2018 2:37 pm (35408)


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
  • Author
  • Localization

aluigi, posted Wed May 30, 2018 10:26 pm (35428)


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.
  • Author
  • Localization

GHOST DEAD, posted Fri Jun 01, 2018 6:19 am (35480)


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
  • Author
  • Localization

InKviZ, posted Sat Jun 02, 2018 8:49 am (35500)


*.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.
  • Author
  • Localization

GHOST DEAD, posted Sat Jun 02, 2018 1:37 pm (35513)


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
  • Author
  • Localization

aluigi, posted Sat Jun 02, 2018 2:36 pm (35516)


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?
  • Author
  • Localization

aluigi, posted Sat Jun 02, 2018 2:44 pm (35517)


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);
  • Author
  • Localization

InKviZ, posted Sat Jun 02, 2018 9:27 pm (35522)


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.
  • Author
  • Localization

aluigi, posted Sun Jun 03, 2018 12:20 pm (35540)


@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 :)
  • Author
  • Localization

Delutto, posted Sun Jun 03, 2018 7:25 pm (35555)


The Evil Within 2 PKR Tool
By Delutto
See Readme.txt for instructions.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:
07/08/2018
  - Add support to BIMAGE files.(Experimental)

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

The_Evil_Within_2_PKR_Tool_By_Delutto.7z

  • Author
  • Localization

shadow_lonely, posted Mon Jun 04, 2018 1:57 pm (35580)


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.
  • Author
  • Localization

GHOST DEAD, posted Tue Jun 05, 2018 3:17 am (35595)


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 :)
  • Author
  • Localization

shadow_lonely, posted Tue Jun 05, 2018 4:12 am (35597)


Delutto wrote:
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.PS4_loc_01.7z


Thanks, i will test when I go to home and let you know result, I am working at company.
  • Author
  • Localization

GHOST DEAD, posted Tue Jun 05, 2018 6:46 am (35599)


shadow_lonely wrote:
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.


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 :)
  • Author
  • Localization

shadow_lonely, posted Tue Jun 05, 2018 10:43 am (35606)


It was worked. And I saw your text "should work" :D
Thanks!
  • Author
  • Localization

Delutto, posted Tue Jun 05, 2018 3:29 pm (35618)


shadow_lonely wrote:
It was worked. And I saw your text "should work" :D
Thanks!
Updated tool with PS4 support and *.bimage conversion soon.
  • Author
  • Localization

GHOST DEAD, posted Tue Jun 05, 2018 4:36 pm (35624)


Delutto wrote:
shadow_lonely wrote:
It was worked. And I saw your text "should work" :D
Thanks!
Updated tool with PS4 support and *.bimage conversion soon.


and Don't forgot to set Text in UTF-8!
Thank You! You Are One of Best! :D
  • Author
  • Localization

shadow_lonely, posted Tue Jun 05, 2018 4:49 pm (35630)


Delutto wrote:
shadow_lonely wrote:
It was worked. And I saw your text "should work" :D
Thanks!
Updated tool with PS4 support and *.bimage conversion soon.

That's great! Thanks!
  • Author
  • Localization

Delutto, posted Tue Jun 05, 2018 4:50 pm (35631)


Updated version on my previous post.
*.bimage not implemented yet, need more tests.
  • Author
  • Localization

Delutto, posted Mon Jul 09, 2018 4:33 am (36602)


Updated version on my previous post.
Experimental BIMAGE conversion.
  • Author
  • Localization

Sajjad_Rahim, posted Sat Jul 21, 2018 7:26 pm (36917)


Delutto wrote:
Updated version on my previous post.
Experimental BIMAGE conversion.


thanks for amazing tool, i have problem with texture in ps4 i changed texture size (image size) for fonts to added my own characters.. texture looks damage when i repack pkr

i used your first release for pc and everything fine (change texture size and added my own characters, and convert BIMAGE by hex.) and work for pc
but in latest release you convert BIMAGE to dds automatic and, so can you upload your previous release (06/08/2018)


thanks
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.