-
Notifications
You must be signed in to change notification settings - Fork 3
Description
these are pretty much identical to the ps3 format, their just encrypted with different keys
example code for this can be found here in SnowPME;
https://github.com/OpenPSS/SnowPME/tree/main/subprojects/LibShared/Package
specifically: https://github.com/OpenPSS/SnowPME/blob/62d41cc4937f51089ebf820a4906043bbf7646cb/subprojects/LibShared/Package/PackageExtractor.cpp#L92
or if you prefer in C, you can look here https://silica.codes/Li/real-package-installer/src/branch/main/app/pkg.c
or here .. https://github.com/st4rk/PkgDecrypt/blob/master/pkg_dec.c
another thing to note; in the case of PSP, actually some pkgs (mainly, MINIs and PSX games) have files encrypted with PS3 keys, and others are encrypted with the PSP keys; the key used is determined by the 'flags' set on PKG_ITEM_RECORD;
none of these examples handle this case other than maybe skipping it-
basically the condition is ((flags >> 0x1C)&7) == 1 if thats true, you use the PSP key to decrypt this item;
otherwise, you use the PS3 key.
the only thing i know that actually handles this properly is pkg2zip; see. https://github.com/mmozeiko/pkg2zip/blob/9222c4e00235dfe7914e9db0cc352da07e63d9f9/pkg2zip.c#L693 .. although i will be the first to admit its code is not the nicest.