Pkg2zip Vita

From GameBrew
pkg2zip
Pkg2zipvita2.png
General
AuthorYoti, mmozeiko, lusid1
TypePC Utilities
Version2.5
LicensePublic Domain
Last Updated2023/07/07
Links
Download
Website
Source

Pkg2zip, an utility that decrypts PlayStation Vita pkg file and creates zip package.

Supported pkg files - main application, DLC, patch, theme and PSM files. Also supported PKG, PSX and PSP PKG files for use with Adrenaline.

Optionally writes NoNpDrm or NoPsmDrm fake license file from zRIF string. You must provide license key.

Features

  • Portable, written in cross-platform C code, runs on Windows, GNU/Linux, macOS (system dependent functionality is isolated in sys.c file).
  • Small, has no external library dependencies and uses very minimal dynamic memory allocations.
  • Fast, uses AESNI hardware accelerated AES decryption if supported by CPU (requires AESNI and SSSE3 instructions).
  • Simple, creates zip package with same folder structure that Vita expects (just drag & drop all file from zip archive to ux0:). Zip file is created directly from pkg without any intermediate temporary files.
  • Vita DLC, Vita PATCH and PSM pkg unpacking.
  • PSX, PSP, PSP Updates, PSP DLC, and PSP THEME pkg unpacking.

User guide

Requirements

How to use

Use the following command if you have zRIF fake license.
This will create title [id] [region].zip file. Title, ID and region is automatically detected from pkg file. It will include work.bin file. Example:

pkg2zip package.pkg zRIF_STRING

Omit last argument if you don't have zRIF fake license, but just want to unpack files.
Resulting zip file will not include work.bin. This is useful for patch pkg files. Example:

pkg2zip package.pkg

Use -l to get output file name of the zip (must come before pkg file and cannot be used with -x). Example:

pkg2zip -l package.pkg

Use -x argument to avoid zipping process and create individual files (must come before pkg file).
PSX or PSP pkg files do not require zRIF argument. It will be ignored. Example:

pkg2zip -x package.pkg [zRIF_STRING]

For PSP files pkg2zip by default will create .ISO file.
To create compressed .CSO file pass -cN argument where N is compression factor (1 for the fastest compression). Example:

pkg2zip -c1 package.pkg

Use -c9, or anything inbetween to create smaller cso file (more compression will require more time). Example:

pkg2zip -c9 package.pkg

You can combine -cN argument together with -x. Example:

pkg2zip -x -c9 package.pkg

Use the -p argument to extract PSP files in their original EBOOT.PBP format. Example:

pkg2zip -p package.pkg

Note: On PSP hardware titles with DLC should be kept in ISO/CSO format due to limitations on the CFW NoDRM Engine.

Generating zRIF string

If you have working NoNpDrm license file (work.bin or 6488b73b912a753a492e2714e9b38bc7.rif) you can create zRIF string with rif2zrif.py python script.
Example (it will print zRIF string to stdout):

$ python rif2zrif.py path/to/work.bin

To generate work.bin from zRIF string use zrif2rif.py script.
Example (last argument is optional, it specifies where to save file and defaults to work.bin name):

$ python zrif2rif.py zRIF work.bin

Limitations

No actual title name is extracted for PSM pkg files.

Alternatives

Screenshots

pkg2zipvita3.png

Changelog

v2.5 (by Yoti)

  • Added support for more regions

v2.4 (by Yoti)

  • Added support to decrypt/extract PKG type 1
  • Added support for KEYS.BIN for PKG type 1
  • Added region detection for PS1 games
  • Fixed some messages here and there

v2.3 (by lusid1)

  • Only decrypt PSP EDAT files in ISO mode.
  • Fixes PCEngine extraction in PBP mode (-p).
  • Fixes DLC compatibility in PBP mode (-p).
  • Added -d switch to force EDAT decryption
  • Merged cli improvements and other fixes from sigmaboy

v2.2 (by lusid1)

  • PSP Theme names are now used for zip file names.

v2.1 (by lusid1)

  • PSX pkg unpacking now includes keys.bin

v2.0 (by lusid1)

  • Added support for VITA Theme pkg.
  • Added support for PSP Theme pkg.
  • Added support for PSP DLC pkg.
  • Added support for pocketstation pkg.
  • Added option to unpack PSP pkg to EBOOT.PBP.
  • Fixed CSO compression.
  • Fixed psm dev kit cert.bin extraction.

v1.8 (by mmozeiko/Mārtiņš Možeiko)

  • Support PSP pkg file unpacking, including NeoGeo, Mini, Go, PC Engine pkg files.
  • Unpack PSP pkg files to ISO or CSO.
  • Better output with UTF-8 encoding on Windows for title names.
  • Show unpacking progress in percents.

v1.7

  • Fix issue with patch file unpacking in -x mode.

v1.6

  • Much faster zip file creation - depending on CPU and disk speed it is now ~2 to 3 times faster.
  • Add -x argument which makes unpacking files in extracted form - with same layout as ux0.
  • Unpacking PSM pkg files for use with NoPsmDrm.
  • Unpacking PSX pkg files for use with Adrenaline.
  • Unpacking PSP pkg files. Result is not yet directly usable on Vita - it produces EBOOT.PBP which requires to be unpacked further with different 3rd party tool.

v1.5

  • Adjust size of tail.bin - now it uses all remaining data after encrypted blob.

v1.4

  • Add support for DLC and PATCH pkg file unpacking.
  • Supports unlimited amount of files inside zip file.
  • Fix for zip files larger than 4GB.
  • Drop support for dummy work.bin generation (without key inside).
  • Drop support for hexkey argument to try generate work.bin.

v1.3

  • Fix a bug when wrong title id was put in work.bin when generating it from raw key.
  • Display minimum required firmware version to run the game.
  • Verify integrity of zRIF before starting to unpack pkg file, and display error if it is not correct zRIF.
  • Allow utf-8 characters in automatic zip filename, useful for non-english game names.
  • Increase limit of max allowed files in zip file.

v1.2

  • Support zRIF strings for generating work.bin file.
  • Add rif2zrif python script to create zRIF string.
  • Identify PCSD prefix as JPN region.

v1.1

  • Fixes wrong head.bin when it is larger than 64KB.

v1.0

  • First Release..

External links

Advertising: