Skip to content

Commit

Permalink
first version
Browse files Browse the repository at this point in the history
  • Loading branch information
mmozeiko committed Sep 23, 2017
0 parents commit 0a7c295
Show file tree
Hide file tree
Showing 15 changed files with 1,556 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pkg2zip
pkg2zip.exe
*.d
*.o
*.obj
*.pdb

24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

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.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org>
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# pkg2zip

Utility that decrypts PlayStation Vita pkg file and creates zip package.

Optionally embedds [NoNpDrm](https://github.com/TheOfficialFloW/NoNpDrm) license into work.bin file. 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**, uses zero dynamic memory allocations and has no external library dependencies.
* **fast**, uses AESNI hardware accelerated AES decryption if supported by CPU (requires [AESNI](https://en.wikipedia.org/wiki/AES_instruction_set) and [SSSE3](https://en.wikipedia.org/wiki/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.

Limitations:
* currently works only for main application pkg files, no DLC.

# Usage

Execute `pkg2zip package.pkg` to create `title [id] [region].zip` file. Title, ID and region is automatically detected from pkg file.

If you have license key (32 hex characters) you can execute `pkg2zip package.pkg hexkey` to embed key into work.bin file.

# Download

Get latest Windows binaries [here](https://github.com/mmozeiko/pkg2zip/releases).

# Building

Execute `make` if you are on GNU/Linux or macOS.

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

# Alternatives

* https://github.com/RikuKH3/unpkg_vita
* https://github.com/St4rk/PkgDecrypt
* https://github.com/TheRadziu/PkgDecrypt

# License

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

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.
12 changes: 12 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@echo off

call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64

set CL=/nologo /errorReport:none /Gm- /GF /GS- /MT /W4
set LINK=/errorReport:none /INCREMENTAL:NO

set CL=%CL% /Ox
rem set CL=%CL% /Od /Zi
rem set LINK=%LINK% /DEBUG

cl.exe pkg2zip*.c /Fepkg2zip.exe
35 changes: 35 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
ifeq ($(OS),Windows_NT)
RM := del /q
EXE := .exe
else
EXE :=
endif

BIN=pkg2zip${EXE}
SRC=${wildcard pkg2zip*.c}
OBJ=${SRC:.c=.o}
DEP=${SRC:.c=.d}

CFLAGS=-pipe -fvisibility=hidden -Wall -Wextra -DNDEBUG -O2
LDFLAGS=-s

.PHONY: all clean

all: ${BIN}

clean:
@${RM} ${BIN} ${OBJ} ${DEP}

${BIN}: ${OBJ}
@echo [L] $@
@${CC} ${LDFLAGS} -o $@ $^

%_x86.o: %_x86.c
@echo [C] $<
@${CC} ${CFLAGS} -maes -mssse3 -MMD -c -o $@ $<

%.o: %.c
@echo [C] $<
@${CC} ${CFLAGS} -MMD -c -o $@ $<

-include ${DEP}
Loading

0 comments on commit 0a7c295

Please sign in to comment.