Editing PKG files

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
See also {{talk}} page, [https://wiki.henkaku.xyz/vita/Packages PS Vita PKG files on henkaku wiki], [https://www.psdevwiki.com/ps5/PKG_files PS4 PKG files], [https://www.psdevwiki.com/ps5/PKG_files PS5 PKG files], [[PKG_DIGEST.DAT]], [https://psdevwiki.com/vita/index.php?title=System_File_Object_(SFO)_(PSF)].
See also {{talk}} page, [http://www.psdevwiki.com/ps4/PKG_files PS4 PKG], [[PKG_DIGEST.DAT]], [https://playstationdev.wiki/psvitadevwiki/index.php?title=System_File_Object_(SFO)_(PSF)].


There are two kinds of SCE package files (.pkg):
There are two kinds of SCE package files (.pkg):
* System Software Update Packages (.pkg), which are [[Certified File]]s containing patch files for some hardware or software components of the console,
* System Software Update Packages (.pkg)
* NPDRM Packages (.pkg), which can be either release or debug, that contain files for a specific game or application.
* NPDRM Packages (.pkg)


= System Software Update Packages =
= System Software Update Packages =
Line 280: Line 280:
! Identifier !! PKG type !! Category name !! Possible size !! Possible values
! Identifier !! PKG type !! Category name !! Possible size !! Possible values
|-
|-
|0x1 || All || [[NPDRM#DRM_Type|DRMType]] || 4 || See [[NPDRM#DRM_Type|DRMType]].
|0x1 || All || DRM Type || 4 || 0/5/6/7/8/9/0xA/0xB/0xC (unknown), 0x1 (network), 0x2 (local), 0x3 (DRMfree no license), 0x4 (PSP), 0xD (DRMfree with license), 0xE (PSM)
|-
|-
|0x2 || All || [[PKG_files#ContentType|ContentType]] || 4 || 00 00 00 07
|0x2 || All || [[PKG_files#ContentType|ContentType]] || 4 || 00 00 00 07
Line 292: Line 292:
|0x6 || PSP || Version + App Version / [[TitleID]] (on size 0xC) || 0xC || "NPEG00005\0\0\0"
|0x6 || PSP || Version + App Version / [[TitleID]] (on size 0xC) || 0xC || "NPEG00005\0\0\0"
|-
|-
|0x7 || PSP, PS3 and PS Vita before rev 1949 || QA Digest (described as "This is a digest of packaged files and attributes.") || 0x18 || 00 00 00 00 00 00 00 00 B5 76 E1 D9 00 EE 9B BC 8E 24 17 91 5D BC 5A CB
|0x7 || PSP and PS3 || QA Digest (described as "This is a digest of packaged files and attributes.")|| 0x18 || 00 00 00 00 00 00 00 00 B5 76 E1 D9 00 EE 9B BC 8E 24 17 91 5D BC 5A CB
|-
|-
|0x8 || All || unk (1 byte) + PS3/PSP/PSP2 System Version (3 bytes) + Package Version (2 bytes) + App Version (2 bytes) || 8 || 00 00 00 00 00 00 00 00, 00 00 00 00 01 00 01 00, 44 01 70 00 01 01 00 00, 81 01 90 00 01 00 01 00, 81 04 75 00 01 02 01 00 (4.7500, 1.02, 1.00) --> unk: 44 maybe PSP and 02/80/81 PS3
|0x8 || All || unk (1 byte) + PS3/PSP/PSP2 System Version (3 bytes) + Package Version (2 bytes) + App Version (2 bytes) || 8 || 00 00 00 00 00 00 00 00, 00 00 00 00 01 00 01 00, 44 01 70 00 01 01 00 00, 81 01 90 00 01 00 01 00, 81 04 75 00 01 02 01 00 (4.7500, 1.02, 1.00) --> unk: 44 maybe PSP and 02/80/81 PS3
Line 331: Line 331:
|0x3 ||  || ||  ||
|0x3 ||  || ||  ||
|-
|-
|0x4 || GameData || /dev_hdd0/game/ || || Also concerns game patches.
|0x4 || GameData (also patches) || /dev_hdd0/game/ || ||
|-
|-
|0x5 || GameExec || /dev_hdd0/game/ || ||
|0x5 || GameExec || /dev_hdd0/game/ || ||
Line 337: Line 337:
|0x6 || PS1emu || /dev_hdd0/game/ || ux0:pspemu/PSP/GAME/ ||
|0x6 || PS1emu || /dev_hdd0/game/ || ux0:pspemu/PSP/GAME/ ||
|-
|-
|0x7 || PSP || /dev_hdd0/game/ || ux0:pspemu/PSP/GAME/ || Also concerns PCEngine.
|0x7 || PSP & PCEngine || /dev_hdd0/game/ || ?ux0:pspemu/PSP/GAME/? ||
|-
|-
|0x8 ||  || ||  ||
|0x8 ||  || ||  ||
Line 353: Line 353:
|0xE || PSPgo || /dev_hdd0/game/ || || Displayed as Unknown Album: Corrupted Data
|0xE || PSPgo || /dev_hdd0/game/ || || Displayed as Unknown Album: Corrupted Data
|-
|-
|0xF || minis || /dev_hdd0/game/ || ux0:pspemu/PSP/GAME/ ||
|0xF || Minis || /dev_hdd0/game/ || ux0:pspemu/PSP/GAME/ ||
|-
|-
|0x10 || NEOGEO || /dev_hdd0/game/ || ux0:pspemu/PSP/GAME/ ||
|0x10 || NEOGEO || /dev_hdd0/game/ || ux0:pspemu/PSP/GAME/ ||
Line 369: Line 369:
|0x16 || PSP2AC (PS Vita Additional Content) || || ux0:addcont/ ||
|0x16 || PSP2AC (PS Vita Additional Content) || || ux0:addcont/ ||
|-
|-
|0x17 || PSP2LA (PS Vita LiveArea) || || ux0:appmeta/ ||
|0x17 || PSP2LA (PS Vita LiveArea) || || ?ux0:livearea/? ||
|-
|-
|0x18 || PSM (PS Vita PSM) || || ux0:psm/ || [https://www.playstation.com/en-ca/explore/playstation-mobile/ PlayStation Mobile]
|0x18 || ?PSM? (PS Vita PSM) || || ux0:psm/ || [https://www.playstation.com/en-ca/explore/playstation-mobile/ PlayStation Mobile]
|-
|-
|0x19 || WT || /dev_hdd0/game/ || || Probably Web TV.
|0x19 || WT (?Web TV?) || /dev_hdd0/game/ || ||
|-
|-
|0x1D || PSM for Unity (PS Vita PSM) || ux0:psm/ || contains 'runtime/' folder. ||
|0x1D || ?PSM? (PS Vita PSM) || || ||
|-
|-
|0x1F || PSP2Theme (PS Vita Theme) || || ux0:theme/ ||
|0x1F || PSP2Theme (PS Vita Theme) || || ux0:theme/ ||
Line 385: Line 385:
! Identifier !! type name !! usage !! notes
! Identifier !! type name !! usage !! notes
|-
|-
| 0x10 || Patch || for PSP game updates, to use with CumulativePatch, IncrementalPatch, HybridPatch ||
| 4th byte, bit: xxx1 xxxx, ex: 00 00 00 1E (+CumulativePatch), 00 00 20 1E (+VC-MC+CumulativePatch) || Patch || for PSP game updates, to use with CumulativePatch, IncrementalPatch, HybridPatch ||
|-
|-
| DiscBinded + Game + Patch || DiscGamePatch || for PS3 BD games ||
| ex: 00 00 08 5A (+RenameDirectory) || DiscGamePatch || for PS3 BD games ||
|-
|-
| Game + Patch || HDDGamePatch || for PS3 HDD games (NPDRM) ||
| 4th byte, bit: xxx1 xxxx, ex: 00 00 00 5E (+Finalized+RenameDirectory) || HDDGamePatch || for PS3 HDD games (NPDRM) ||
|-
|-
| ?when 2 is not set? || NoEBOOTBIN ||  ||
| unk || NoEBOOTBIN ||  ||
|-
|-
| ex: 00 00 00 0A || Demo ||  ||
| 4th byte, bit: xxxx 1x1x, ex: 00 00 00 4A (+RenameDirectory) || Demo ||  ||
|-
|-
| ex: 00 00 00 0C || Key ||  ||
| 4th byte, bit: xxxx 11xx, ex: 00 00 00 0C || Key ||  ||
|-
|-
| ? || Upgradable ||  ||
| ex: 00 00 30 1E (+VC-MC+CumulativePatch+Patch) || Upgradable ||  ||
|}
|}
To class in PackageType or PackageFlag : DiscBinded


=== PackageFlag ===
=== PackageFlag ===


{| class="wikitable"
{| class="wikitable"
! Flag !! Name !! Usage !! Notes
! Identifier !! type name !! usage !! notes
|-
| 0 || NO FLAGS ||  || It exists e.g. in IP9100-NPIA00001_00-PS2HDDSYSDAT0001 built with revision 960 (very old)!
or even in UP0700-NPUJ00213_00-0000000000000002 (so old that it does not embed make_package_npdrm revision).
|-
| 0x2 || ?EBOOT? ||  || Minis have it.
|-
| 0x4 || ?Require License? ||  ||
|-
|-
| 0x8 || ?HDD/MC? ||  || NON Finalized flagged PS3 package (DLC)
| ex: 00 00 00 00 || NO FLAGS ||  || yes it exists, it was found in IP9100-NPIA00001_00-PS2HDDSYSDAT0001 that was builded with revision 960 (very old) !!!
or even UP0700-NPUJ00213_00-0000000000000002 (so old that it does not embed make_package_npdrm revision)
|-
|-
| 0x10 || CumulativePatch || Embeds the previous patches || To use with Patch PackageType.
| 4rd byte, bit: x1xx xxxx, ex: 00 00 00 4E, 00 00 00 5E || RenameDirectory || ||
|-
|-
| ? || IncrementalPatch || Requires the previous patches to be installed first || To use with Patch PackageType.
| when RenameDirectory flag is not set (default), ex: 00 00 00 0E || NoRenameDirectory || ||
|-
|-
| ? || HybridPatch ||  || To use with Patch PackageType.
| 4rd byte, bit: xxxx x11x, ex: 00 00 00 0E, 00 00 00 1E, 00 00 00 4E, 00 00 00 5E, warning: do not mistake with the finalized flag in main header || Finalized ||  || PS1 and PSP games have not this flag: 00 00 02 0C, PS3 game that has not this flag : 00 00 00 08
|-
|-
| 0x40 || RenameDirectory ||  ||
| ex: 00 00 00 08 || NON Finalized flaged PS3 package (DLC) ||  ||
|-
|-
| When 0x40 is not set (default) || NoRenameDirectory ||  ||
| ex: 00 00 02 0C, 00 00 02 1C (+Patch) || NON Finalized flaged package (all PS1 and PSP packages) ||  ||
|-
|-
| 0x80 || ?EDAT? || || Theme (.p3t.edat) / License package (.edat)
| ex: 00 00 02 4E (+RenameDirectory) || NON Finalized flaged minis package  || ||
|-
|-
| 0x200 || ?Emulator? || || All PS1 and PSP packages, minis.
| ex: 00 00 04 8C || Theme (.p3t.edat) / License package (.edat) || -> ????noEBOOOT?????? ||
|-
|-
| 0x400 || VSH Module ||  || PS3 only.
| ex: 00 00 04 0C || VSH Module package (PS3 only) ||  ||
|-
|-
| 0x800 || DiscBinded || || PS3 only.
| 4rd byte, bit: xxxx ?111x?, ex: 00 00 20 1E, 00 00 00 1E || CumulativePatch || Embeds the previous patches || To use with Patch PackageType.
|-
|-
| 0x1000 || ? || ||  
| unk || IncrementalPatch || Requires the previous patches to be installed first || To use with Patch PackageType.
|-
|-
| 0x2000 || See Storage Type. ||  ||  
| unk || HybridPatch ||  || To use with Patch PackageType.
|-
|-
| 0x4000 || NonGame || Used for most PS Vita NPDRM apps ||
| 3rd byte, bit: x1xx xxxx, ex: 00 00 40 0E || NonGame || Used for most of PS Vita NPDRM apps ||
|}
|}


Line 444: Line 440:


{| class="wikitable"
{| class="wikitable"
! Flag !! Name !! Usage !! Notes
! Identifier !! type name !! usage !! notes
|-
|-
| 8 / 4 / 2 || MC || This application can be distributed by network and installed onto memory card(MC). ||  
| 3rd byte, bit: xx1x xxxx, ex: 00 00 20 0E, 00 00 20 1E || VC-MC ||  
[VC-MC]
This application is distributed by PS Vita card(VC).
This application may be distributed by network and installed onto memory card(MC).
 
[In case of VC distribution]
The VC does NOT have rewritable(R/W) area, and Patches/Additional Contents/Save Data are stored on MC.
MC is REQUIRED to run this application.
|| There exists 2 variants : 2GB VC and 4GB VC (it is still unknown how to recognize this difference)
|-
|-
| 0x2000 || VC || This application can be distributed by PS Vita card(VC). ||
| default (when VC-MC flag is not set), ex: 00 00 00 0E, 00 00 00 1E || VC-VC || [No VC/MC-MC]
This application is NOT distributed by PS Vita card(VC).
This application is distributed by network and installed onto memory card(MC).
||
|}
|}


Line 709: Line 716:
| data_size || 0x10 || u64 ||
| data_size || 0x10 || u64 ||
|-
|-
| flags || 0x18 || u32 || The file type. Item_key_type = (flags >> 0x1C)&7 (key type 0 - ps3-aes-key, key type 1 - psp-aes-key)
| flags || 0x18 || u32 || The file type
|-
|-
| padding || 0x1C || u32 || zero
| padding || 0x1C || u32 || zero
Line 733: Line 740:


==== package.conf (PSP/PS3/PS Vita) ====
==== package.conf (PSP/PS3/PS Vita) ====
Note that for convenience and backward compatibility with NPDRM.CONF, the package.conf parser (make_package_npdrm) is not case-sensitive and in some cases considers underscore as dash.


{| class="wikitable"
{| class="wikitable"
! Configuration name !! Usage !! Expected value !! Example !! Notes
! Configuration name !! Usage !! Expected value !! Example !! Notes
|-
|-
| ContentID || needed || XXYYYY-XXXXYYYYY_00-XXXXXXXXXXXXXXXX || EP4153-NPEZ00314_00-0000111122223333 ||
| Content_ID || needed || XXYYYY-XXXXYYYYY_00-XXXXXXXXXXXXXXXX || EP4153-NPEZ00314_00-0000111122223333 ||
|-
|-
| Klicensee || needed on PS3 (can be set to 0x00000...) || 0x00000000000000000000000000000000 || 0x0123456789ABCDEF0123456789ABCDEF ||
| K_licensee (PS3) || needed (can be set to 0x00000...) || 0x00000000000000000000000000000000 || 0x0123456789ABCDEF0123456789ABCDEF ||
|-
|-
| DRMType || needed || Network / Free / Local / DiscBind || Free ||
| DRMType || needed || Network / Free / Local || Free ||
|-
|-
| ContentType || needed || See [[PKG_files#ContentType]] || minis ||
| ContentType || needed || See [[PKG_files#ContentType]] || minis ||
|-
|-
| PackageVersion || needed || xx.yy || 01.02 ||
| PackageVersion || needed || XX.XX || 01.02 ||
|-
|-
| PackageType || || See [[PKG_files#PackageType]] || DiscGamePatch ||
| PackageType || || See [[PKG_files#PackageType]] || DiscGamePatch ||
Line 764: Line 769:
|-
|-
| ForcedInstallTo || Allows installing packages to any HDD directory (and even flash memory if it is mounted RW). ||  || ||
| ForcedInstallTo || Allows installing packages to any HDD directory (and even flash memory if it is mounted RW). ||  || ||
|-
| APP_VER || If the APP_VER value in PARAM.SFO is to be updated, set the new value in the format "xx.yy" (2 integer digits and 2 decimal digits). ||  || ||
|-
| PS3_SYSTEM_VER || If the PS3_SYSTEM_VER value in PARAM.SFO is to be updated with a patch package, set the new value in the format "xx.yyyy" (2 integer digits and 4 decimal digits). ||  || ||
|}
|}


Line 840: Line 841:
==== PSP SDK official tool: make_package_npdrm (2006-2014) ====
==== PSP SDK official tool: make_package_npdrm (2006-2014) ====


* latest version: rev 1642 in 6.60 PSP SDK
* latest version: rev 1642 from 6.60 PSP SDK
 
==== PS Vita SDK official tool: make_pkg.exe (2011-2014) ====
 
* latest version: make_pkg.exe rev 1972 (2014-06-29) from PublishingTools version 2.31.0.1669 in 3.55/3.57 PS Vita SDK.


==== PS3 SDK official tool: make_package_npdrm (2006-2014) ====
==== PS3 SDK official tool: make_package_npdrm (2006-2017) ====


* oldest known version: rev 1061 in ?.?? PS3 SDK
* oldest known version: rev 1061 in ?.?? PS3 SDK
Line 849: Line 854:
* most famous version: rev 1732 in 3.40 PS3 SDK (also found under unofficial patched form)
* most famous version: rev 1732 in 3.40 PS3 SDK (also found under unofficial patched form)
* rev 1754 in 3.60 PS3 SDK
* rev 1754 in 3.60 PS3 SDK
* rev 1962 in 4.00 PS3 SDK
* latest known version: rev 1972 in 4.75 PS3 SDK
* rev 1966 in 4.?? PS3 SDK (seen in TrueAncestor tools)
* latest version: rev 1972 in 4.75 PS3 SDK
 
<pre>
make_package_npdrm.exe --informal-help
 
usage: [revision 1972]
 
    THIS IS INFORMAL HELP. ONLY FOR INTERNAL USE! NEVER USE FOR RELEASING!
 
    make_package_npdrm [options] config-file target-directory
        -v | --verbose          increases verbose messages.
        -f | --nofindlimit      no limitation to file find.
        -o | --output DIR      output package to DIR.
        -C | --directory DIR    change to DIR before doing anything.
        --find-path PATH        set find command path to file find.
        --content-id STRING    set ContentID.
        --k-licensee HEX        set KLicensee.
        --drm-type STRING      set DRMType.
        --content-type STRING  set ContentType.
        --package-version NUM  set PackageVersion.
        --patch-for-discgame    generate patch package for DiscGame.
        --patch-for-hddgame    generate patch package for HDDGame.
        --patch-for-psstore    generate patch package for PSSTORE (pay patch).
        --force-info            overwrite content information files.
        --weak-info            no overwrite content information files.
        --force-user            overwrite user directory files.
        --weak-user            no overwrite user directory files.
 
    make_package_npdrm [options] target-directory
        generate package with 'target-directory/package.conf'.
        [options]              same as the above.
 
    make_package_npdrm [options] npdrm-package [target]
        [default]              print package informations.
        -c | --check            check package format.
        -l | --list            print [target] files/dirs information.
        -x | --extract          extract [target] files/dirs.
        --extract-tropdir      extract trophy files.
        --extract-rootdir      extract system files.
        --no-entitlement        generate debuging package.
 
    make_package_npdrm [options]
        --version              print revision.
        --help                  print help message.
        --informal-help        print this message.
</pre>
 
==== PS Vita SDK official tool: make_package_npdrm.exe (2011) ====
 
* oldest known version: make_package_npdrm.exe rev 1840 (2011-04-05) from PublishingTools version 0.16.0.283 in ?0.945? PS Vita SDK.
* make_package_npdrm.exe rev 1949 (2011-07-22) from PublishingTools version 0.50.0.585 in 0.996 PS Vita SDK.
* make_package_npdrm.exe rev 1957 (2011-09-14) from PublishingTools version 1.41.0.958 in ?1.00? PS Vita SDK.
* make_package_npdrm.exe rev 1962 (2011-12-02) from PublishingTools version 1.41.0.958 in ?1.50? PS Vita SDK.
* make_package_npdrm.exe rev 1963 (2011-12-26) from PublishingTools version 1.50.0.1026 in ?1.60? PS Vita SDK.
 
==== PS Vita SDK official tool: make_pkg.exe (2014) ====
 
At some point, SCE renamed make_package_npdrm to make_pkg. The reason is certainly that on PS Vita, .pkg are used for many types of contents not just NPDRM protected contents.
 
* latest version: make_pkg.exe rev 1972 (2014-06-29) from PublishingTools version 2.31.0.1669 in 3.55/3.57 PS Vita SDK.
 
<pre>
make_pkg.exe --help
 
usage: [revision 1972]
 
    make_package_npdrm [options] config-file target-directory
        -v | --verbose          increases verbose messages.
        -f | --nofindlimit      no limitation to file find.
        -o | --output DIR      output package to DIR.
        -C | --directory DIR    change to DIR before doing anything.
        --find-path PATH        set find command path to file find.
        --content-id STRING    set ContentID.
        --k-licensee HEX        set KLicensee.
        --drm-type STRING      set DRMType.
        --content-type STRING  set ContentType.
        --package-version NUM  set PackageVersion.
</pre>


==== Make Package Npdrm Patcher (revision 1732) by SubZero Dezigns (2012) ====
==== Make Package Npdrm Patcher (revision 1732) by SubZero Dezigns (2012) ====
Line 1,025: Line 951:


[https://github.com/st4rk/PkgDecrypt Source code]
[https://github.com/st4rk/PkgDecrypt Source code]
==== unpkg_vita by RikuKH3 (2017) ====
[https://github.com/RikuKH3/unpkg_vita Source code]


==== PKGrip by qwikrazor87 (2018) ====
==== PKGrip by qwikrazor87 (2018) ====
Please note that all contributions to PS3 Developer wiki are considered to be released under the GNU Free Documentation License 1.2 (see PS3 Developer wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:

Cancel Editing help (opens in new window)