FileForums

FileForums (https://fileforums.com/index.php)
-   Conversion Tutorials (https://fileforums.com/forumdisplay.php?f=55)
-   -   PKGRec precompressor (https://fileforums.com/showthread.php?t=107389)

sajmon83 14-11-2026 14:46

PKGRec precompressor
 
1 Attachment(s)
PKGRec

A bit-exact PS3 PKG precompressor for FreeArc and DiskSpan GUI!
PS3 .pkg files are AES encrypted, so every compressor sees them as random noise. PKGRec removes the PKG encryption on the fly.

KEY FEATURES
Bit-Exact Rebuild — Decode re-encrypts the data and gives back the original PKG 1:1, signature included. Every PKG is checked with CRC32 and so is the whole stream.
No Keys, No Repacking — Retail (AES-128-CTR) and debug PKGs are decrypted from the PKG header alone. Nothing is extracted or repacked.
Fast — Around 700 MB/s for both packing and unpacking (AES-NI, multithreaded).
PKG Info in the Console — For each PKG found it prints the content type, DRM, title (from PARAM.SFO), the number of files and folders, and progress.
Standalone — A single EXE with no DLLs. It talks to Arc over stdin/stdout, like any other external compressor.

INTEGRATION WITH DISKSPAN GUI
Put pkgrec.exe in Resources\Win64\PRE\PKGRec\ and add this to the Arc config (DSG_Arc.ini):
Code:

[External compressor:pkgrec]
header    = 0
default  = -t100p
packcmd  = "PRE\PKGRec\pkgrec.exe" precomp {options} - - <stdin> <stdout>
unpackcmd = "PRE\PKGRec\pkgrec.exe" decode -t100p - - <stdin> <stdout>

For the installer side, use the same entry with the path inside the setup: unpackcmd = "PKGRec\pkgrec.exe" decode -t100p - - <stdin> <stdout>
PKGRec must come first in the chain, before XTool:
Code:

pkgrec+xtool:mzlib+srep+LOLZ_NORMAL
RESULTS
The Last of Us patch 1.11 (EP9000-BCES01585_00-LASTOFUSPATCH111, 284,415,088 bytes, retail). Every archive was extracted and checked with SHA-1, and all of them matched the original bit for bit:
Code:

method                              archive size    ratio
zstd                                  284,421,852  100.0%
xtool:mzlib+zstd (no PKGRec)          284,422,430  100.0%
pkgrec+zstd                          274,021,711    96.3%
pkgrec+xtool:mzlib+zstd              222,233,501    78.1%
pkgrec+xtool:mzlib:mpreflate+zstd    218,703,805    76.9%

CONSOLE OUTPUT
Code:

pkgrec: found PKG #1 at 0x0: EP9000-BCES01585_00-LASTOFUSPATCH111 (retail)
pkgrec:  type: Game Data (GD, e.g. patch/DLC), DRM: free (no license), package version 01.00, 18 items, PKG 271.2 MB
pkgrec:  contents: 15 files + 3 dirs, 271.2 MB; still encrypted inside (not decrypted by pkgrec): 1 SELF 19.4 MB
pkgrec:  folders: USRDIR/ 2 files 260.3 MB | TROPDIR/ 1 file 7.1 MB | (root) 12 files 3.9 MB
pkgrec:  PARAM.SFO: "The Last of Us 1.11", BCES01585, category GD, APP_VER 01.11, VERSION 01.00, firmware 04.4000
pkgrec precomp: done, 1 PKG(s) found (18 items inside), 271.2 MB total, 0.38 s, 719 MB/s

COMMAND LINE
pkgrec precomp [-tN|-tNp] [-cNmb] [-v|-q] <in|-> <out|-> — decrypt the PKGs found in the stream
pkgrec decode [-tN|-tNp] [-v|-q] <in|-> <out|-> — rebuild the original stream 1:1
pkgrec info [-l] <file.pkg> — header, content summary, PKG SHA-1 check (-l = full file list)
pkgrec selftest — AES / AES-CTR / SHA-1 / CRC32 known-answer tests
-t threads (-t100p = all cores) · -c chunk size (default 16 MB) · -v more detail · -q quiet

CHANGES LOG
2026-11-14 — v1.1.0
- First public release.


All times are GMT -7. The time now is 15:52.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
FileForums @ https://fileforums.com