File pkg2zip.1 of Package pkg2zip

.TH pkg2zip
.PP
\[la]https://github.com/lusid1/pkg2zip/blob/master/LICENSE\[ra]

.PP
Utility that decrypts PlayStation Vita pkg file and creates zip package. Supported pkg files \- main application, DLC, patch, theme and PSM files. Also supports PSX and PSP pkg files for use with Adrenaline
\[la]https://github.com/TheOfficialFloW/Adrenaline\[ra]\&.

.PP
Optionally writes NoNpDrm
\[la]https://github.com/TheOfficialFloW/NoNpDrm\[ra] or NoPsmDrm
\[la]https://github.com/frangarcj/NoPsmDrm\[ra] fake license file from zRIF string. You must provide license key.


.SH Requirements.IP \(bu 2
Henkaku
\[la]https://henkaku.xyz/\[ra] / Enso
\[la]https://enso.henkaku.xyz/\[ra]
.IP \(bu 2
Enso
\[la]https://enso.henkaku.xyz/\[ra] for Vita Theme installation via bgdl.
.IP \(bu 2
NoNpDrm
\[la]https://github.com/TheOfficialFloW/NoNpDrm\[ra]
.IP \(bu 2
NoPsmDrm
\[la]https://github.com/frangarcj/NoPsmDrm\[ra] for PSM titles
.IP \(bu 2
VitaShell
\[la]https://github.com/TheOfficialFloW/VitaShell\[ra] \fBv1.76\fP or newer required for DLC installation
.IP \(bu 2
Adrenaline
\[la]https://github.com/TheOfficialFloW/Adrenaline\[ra] for PSX or PSP titles
.IP \(bu 2
npdrm\_free
\[la]https://github.com/qwikrazor87/npdrm_free\[ra] for PSP titles in eboot format.


.SH Features.IP \(bu 2
\fBportable\fP, written in cross\-platform C code, runs on Windows, GNU/Linux, macOS (system dependent functionality is isolated in sys.c file).
.IP \(bu 2
\fBsmall\fP, has no external library dependencies and uses very minimal dynamic memory allocations.
.IP \(bu 2
\fBfast\fP, uses AESNI hardware accelerated AES decryption if supported by CPU (requires AESNI
\[la]https://en.wikipedia.org/wiki/AES_instruction_set\[ra] and SSSE3
\[la]https://en.wikipedia.org/wiki/SSSE3\[ra] instructions).
.IP \(bu 2
\fBsimple\fP, 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.
.IP \(bu 2
\fBVita DLC\fP, \fBVita PATCH\fP and \fBPSM\fP pkg unpacking.
.IP \(bu 2
\fBPSX\fP, \fBPSP\fP, \fBPSP Updates\fP, \fBPSP DLC\fP, and \fBPSP THEME\fP pkg unpacking.

.PP
Limitations:
.IP \(bu 2
no actual title name is extracted for PSM pkg files.


.SH Usage
.PP
If you have zRIF fake license, then execute:

.PP
.RS

.nf
pkg2zip package.pkg zRIF\_STRING

.fi
.RE

.PP
This will create \fB\fCtitle [id] [region].zip\fR file. Title, ID and region is automatically detected from pkg file. It will include work.bin file.

.PP
If you don't have zRIF fake license, but just want to unpack files, then omit last argument:

.PP
.RS

.nf
pkg2zip package.pkg

.fi
.RE

.PP
Resulting zip file will not include work.bin. This is useful for patch pkg files.

.PP
To get output file name of the zip, use \fB\fC\-l\fR (must come before pkg file and cannot be used with \fB\fC\-x\fR):

.PP
.RS

.nf
pkg2zip \-l package.pkg

.fi
.RE

.PP
To avoid zipping process and create individual files, use \fB\fC\-x\fR argument (must come before pkg file):

.PP
.RS

.nf
pkg2zip \-x package.pkg [zRIF\_STRING]

.fi
.RE

.PP
To disable bgdl output for VITA Theme extraction, use the '\-b' argument.

.PP
.RS

.nf
pkg2zip \-b \-x package.pkg zRIF\_STRING

.fi
.RE

.PP
PSX or PSP pkg files do not require zRIF argument. It will be ignored.

.PP
For PSP files pkg2zip by default will create a .ISO file. To create a compressed .CSO file pass \-cN argument where N is compression factor. For example, for fastest compression use:

.PP
.RS

.nf
pkg2zip \-c1 package.pkg

.fi
.RE

.PP
To create smaller cso file (more compression will require more time) use \-c9, or anything inbetween:

.PP
.RS

.nf
pkg2zip \-c9 package.pkg

.fi
.RE

.PP
You can combine \-cN argument together with \-x:

.PP
.RS

.nf
pkg2zip \-x \-c9 package.pkg

.fi
.RE

.PP
To extract PSP files in their original EBOOT.PBP format use the '\-p' argument:

.PP
.RS

.nf
pkg2zip \-p package.pkg

.fi
.RE

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


.SH Generating zRIF string
.PP
If you have working NoNpDrm license file (work.bin or 6488b73b912a753a492e2714e9b38bc7.rif) you can create zRIF string with \fB\fCrif2zrif.py\fR python script:

.PP
.RS

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

.fi
.RE

.PP
It will print zRIF string to stdout.

.PP
To generate work.bin from zRIF string use \fB\fCzrif2rif.py\fR script:

.PP
.RS

.nf
$ python zrif2rif.py zRIF work.bin

.fi
.RE

.PP
Last argument is optional, it specifies where to save file and defaults to work.bin name.


.SH Download
.PP
Get latest Windows binaries here
\[la]https://github.com/lusid1/pkg2zip/releases\[ra]\&.

.PP
ArchLinux users can build binary with pkg2zip
\[la]https://aur.archlinux.org/packages/pkg2zip/\[ra] package in AUR repository. For example, with pacaur:

.PP
.RS

.nf
$ pacaur \-S pkg2zip

.fi
.RE

.PP
openSUSE users can download the package from the Packman
\[la]http://packman.links2linux.de/package/pkg2zip\[ra] repository.
If this repository is enabled, just install pkg2zip with zypper.

.PP
.RS

.nf
# zypper install pkg2zip

.fi
.RE


.SH Building
.PP
Execute \fB\fCmake\fR if you are on GNU/Linux or macOS (gcc comiler required)
To install the resulting file use \fB\fCmake "install\fR as root

.PP
On Windows you can build either with MinGW (get MinGW\-w64
\[la]http://www.msys2.org/\[ra]) or Visual Studio 2017 Community Edition
\[la]https://www.visualstudio.com/vs/community/\[ra]\&.
* for MinGW make sure you have make installed, and then execute \fB\fCmingw32\-make\fR
* for Visual Studio run \fB\fCbuild.cmd\fR


.SH Alternatives.IP \(bu 2

\[la]https://github.com/RikuKH3/unpkg_vita\[ra]
.IP \(bu 2

\[la]https://github.com/St4rk/PkgDecrypt\[ra]
.IP \(bu 2

\[la]https://github.com/weaknespase/PkgDecrypt\[ra]


.SH License
.PP
This is free and unencumbered software released into the public domain.

.PP
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non\-commercial, and by any means.