pkg-merge icon indicating copy to clipboard operation
pkg-merge copied to clipboard

Pieces may be omitted if it tried to use it as the root initially

Open shinji257 opened this issue 2 years ago • 3 comments

This may be dependent on how the files get ordered in the directed on the file table but it seems that when pkg-merge starts checking files it does so in the order they were added to the folder and if the file it checked was not the root it skips it but then doesn't bother to add it in as a possible part of the pkg later.

Example: 3 part update pkg. Attempts to use part 3 (2) as root but fails and skips it. Later only detects 1 additional part to the update which is wrong.

E:\>pkg-merge-x64 UP0082-CUSA12031_00-KINGDOMHEARTSX30-A0110-V0100
[warn] assumed root PKG file 'UP0082-CUSA12031_00-KINGDOMHEARTSX30-A0110-V0100_2.pkg' doesn't match PKG magic (is 6b6ff148, wants b35bea60). skipping...
[success] found root PKG file for UP0082-CUSA12031_00-KINGDOMHEARTSX30-A0110-V0100
[success] found piece 1 for PKG file UP0082-CUSA12031_00-KINGDOMHEARTSX30-A0110-V0100
[work] beginning to merge 1 piece for package UP0082-CUSA12031_00-KINGDOMHEARTSX30-A0110-V0100...
        [work] copying root package file to new file...done
        [work] merged 4294967296/4294967296 bytes (100%) for part 1...done

[success] completed

Example: Here I moved the last part out of the folder then put it back relocating it in the file table. Now a normal directory listing shows them in order by default...

E:\>pkg-merge-x64 UP0082-CUSA12031_00-KINGDOMHEARTSX30-A0110-V0100
[success] found root PKG file for UP0082-CUSA12031_00-KINGDOMHEARTSX30-A0110-V0100
[success] found piece 1 for PKG file UP0082-CUSA12031_00-KINGDOMHEARTSX30-A0110-V0100
[success] found piece 2 for PKG file UP0082-CUSA12031_00-KINGDOMHEARTSX30-A0110-V0100
[work] beginning to merge 2 pieces for package UP0082-CUSA12031_00-KINGDOMHEARTSX30-A0110-V0100...
        [work] copying root package file to new file...done
        [work] merged 4294967296/4294967296 bytes (100%) for part 1...done
        [work] merged 3679125504/3679125504 bytes (100%) for part 2...done

[success] completed

shinji257 avatar Dec 16 '21 04:12 shinji257

I got the same exact thing today. Many thanks for confirming this is indeed happening.

mbcrump avatar Jan 05 '22 00:01 mbcrump

I was pulling my hair as well. This has to do with filesystem::directory_iterator. It does not read files in alphabetical order, and there is no direct way to do this. I forked and updated the code. Also built binaries for MacOS.

Take a look. https://github.com/aldoblack/pkg-merge . I haven't tested much.

aldo-o avatar Jan 06 '22 19:01 aldo-o

It's been a long time since I wrote this code, so it's probably not very good. Now that I actually own a jailbroken PS4 I might re-write this in .NET so it will work properly on all platforms.

Tustin avatar Jan 10 '22 23:01 Tustin