ParManager icon indicating copy to clipboard operation
ParManager copied to clipboard

Extended offset not being read correctly

Open mosamadeeb opened this issue 2 years ago • 2 comments

chara.par from Lost Judgment PC is 5.33 GB, so the extended offset field is being used.

However, the field is either 0, 1, or 0x01000001. Shifting the value left by 32 bits results in the proper extended offset in the case of the first two, but for the last one, the leftmost 0x01 needs to be omitted, otherwise this exception will occur:

image

Here are the ParFile structs for the three possible values. 1 is only used once, in the file right in between the last file with 0 and the first file with 0x01000001. The Data struct is correct for all 3 files.

image

image

image

Would ignoring the last byte be a proper solution?

mosamadeeb avatar Sep 15 '22 16:09 mosamadeeb

So, if I'm understanding well, the correct 64bit offset of each file is:

c_am_rk_car_face_tn.dds => 0x00000000FFEB2000 c_am_rk_car_face_tn_l.dds => 0x0000000100007800 c_am_rk_car_pants_di.dds => 0x000000010055D000

Am I right?

I think there would be no problem if we do a offset &= 0x00FFFFFFFFFFFFFF; when reading, as we would be limiting the file size to about 64 Petabytes 😂

But I'm thinking how it would work when rebuilding. If that byte is garbage and the game doesn't read it, there would be no problem. But, what happens if it is some kind of "flag" and they use it?

Kaplas80 avatar Sep 15 '22 16:09 Kaplas80

Am I right?

Yeah, those are the correct offsets.

As for rebuilding, apparently the game does check for that byte/flag, as the repacked par does not work in the game. Someone managed to mod it by adding with compression, instead of repacking the whole par.

I will try setting that byte on every file with an extended offset, and see how the game reacts.

mosamadeeb avatar Sep 17 '22 15:09 mosamadeeb

Fixed in v1.3.4

Kaplas80 avatar Oct 28 '23 18:10 Kaplas80