Files
ppsspp/docs/dnas-patches.md
T
Henrik RydgårdandClaude Opus 5.5 edef36d97e Load game patches installed on a PSP, given its Fuse ID
- Fixes #12343

Killzone: Liberation's Chapter 5 DLC is an installer that the PSP turns
into ms0:/PSP/GAME/<id>/KZL.PRX, which the game loads with
sceKernelLoadModuleDNAS. That file is a PGD around a type 3 PRX (decrypt
mode 18), both keyed to the console that installed it. Its Fuse ID
gives everything needed:

- libkirk: the per-console key derivation, and KIRK commands 3, 5 and 8
  built on it (KIRK ROM per uofw, key mesh per psdevwiki).
- PrxDecrypter: type 3, which is type 5 with the first step through
  KIRK command 3 (JPCSP's PRX.java), and the DNAS PGD unwrap.
- sceKernelLoadModuleDNAS uses the new FuseID setting (or --fuse-id).
  Without one, or with the wrong one, the game falls back to its stock
  module and an OSD message says why.
- Headless --re-decrypt takes --re-decrypt-key and --fuse-id, to decrypt
  such a file offline.

Verified with a patch installed on a real PSP: the v1.20 module loads,
starts and reads CHAPTER5.BIN. Type 5 output is unchanged (an NPJH50521
PBOOT.PBP decrypts byte-identically). How to install one over PSPLink is
in docs/dnas-patches.md.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-14 18:10:08 +02:00

3.7 KiB

Game patches installed on a PSP (DNAS)

Some early games shipped their updates and DLC as an "installer" package that the PSP's install utility turns into a module only that PSP can load. Killzone: Liberation's Chapter 5 DLC is the known case (issues #12343, #12344). PPSSPP can load such a patch once it has been installed on a real PSP, given that PSP's Fuse ID. It can't install one itself.

What the download is

PSP/GAME/UCES00279/ (UCUS98646 for the US game) gets two files:

  • EBOOT.PBP, 8.5 MB, CATEGORY=MG, BOOTABLE=0, title "Killzone: Liberation Installer". Its DATA.PSP is the encrypted package the install utility unpacks. The XMB refuses to start it.
  • CHAPTER5.BIN, 68 MB, the chapter's data. The patched game module reads it as it is.

Installing it on a PSP

The install is done by the game's own boot program (disc0:/PSP_GAME/SYSDIR/EBOOT.BIN), which imports sceUtilityInstall*. It only installs when started with the argument -i, and then only if ms0:/PSP/GAME/UCES00279/EBOOT.PBP is larger than 1 MB. The game passes -i itself, after the online download in its menus (from kzl.killzone.com, long gone), so there's no way to trigger it from inside the game today.

Starting the boot program with -i from PSPLink works. modexec doesn't (the LoadExec is refused), but a tiny kernel-mode PRX calling the CFW's sctrlKernelLoadExecVSHDisc (SystemCtrlForKernel, NID 0x577AF198) with key = "game" and the argument block "disc0:/PSP_GAME/SYSDIR/EBOOT.BIN\0-i\0" brings up the system's install screen. Afterwards the folder holds KZL.PRX (8.6 MB, the patch), and the 8.5 MB EBOOT.PBP has been replaced by a 10 KB one for the XMB.

The Fuse ID is the two words at 0xBC100090 and 0xBC100094, which only kernel code can read. PSP tools show it as 12 hex digits, the 0x94 word first.

Loading it

The boot program calls sceKernelLoadModuleDNAS(path, secureId, 0, 0) with a 16-byte secure install ID from its data (81A19A6F0FA9CFBAE378F73FFD504C7F for UCES00279), and treats any negative result as "no patch", falling back to disc0:/PSP_GAME/USRDIR/KZL.PRX. Two layers:

  1. A PGD (key index 1, DRM type 0), opened by amctrl with the secure install ID and the "flag 1" DNAS key. Its MAC and cipher use KIRK commands 5 and 8, which are AES under the per-console key with seed 1.
  2. A type 3 PRX, decrypt mode 18, tag 0x89742B04. This is type 5 with the first step done by KIRK command 3 instead of 7: a small command 3 block whose header is at 0xEC and whose 0x50-byte body is the usual kirk header + SHA1 pieces, XORed with the tag's key and the secure install ID. The install produced that block with KIRK command 2, re-encrypting under the per-console key with seed 0. Command 2's own key (AES keyslot 3) isn't known, which is why the download can't be installed here.

The per-console keys come from the Fuse ID: the key mesh on psdevwiki's Kirk page, and the final step from the KIRK ROM's aes_set_perconsole_key (uofw src/kirk/kirk-rom.c). The type 3 layout is JPCSP's crypto/PRX.java. The tag's key and XOR are in its KeyVault.java, and uofw's mesgled.h documents the decrypt mode.

In PPSSPP:

  • kirk_individual_key(), kirk_CMD3/5/8 in ext/libkirk/kirk_engine.c.
  • pspDecryptType3() and pspUnwrapDNASPGD() in Core/ELF/PrxDecrypter.cpp.
  • sceKernelLoadModuleDNAS() in Core/HLE/sceKernelModule.cpp takes the Fuse ID from the FuseID setting ([SystemParam] in ppsspp.ini) or --fuse-id.

A wrong Fuse ID fails the PGD's MAC, so the game just runs unpatched.

To decrypt one offline:

PPSSPPHeadless --re-decrypt KZL.PRX --re-decrypt-out KZL.elf \
    --re-decrypt-key 81a19a6f0fa9cfbae378f73ffd504c7f --fuse-id <12 hex digits>