Editing Packages (.PKG)

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:
#REDIRECT [https://www.psdevwiki.com/ps3/PKG_files]
[[Category:Software]]
[http://www.psdevwiki.com/ps3/PKG_files PS3 PKG] / [http://www.psdevwiki.com/ps4/PKG_files PS4 PKG]
 
 
There are two kinds of PS VITA package files (.pkg):
 
1. PS VITA Game Packages (.pkg)
 
2. PS VITA System Packages (.pkg)
 
== Game Packages ==
 
Debug and Retail v1.0 (not the actual ones) PS VITA Game Package files (.pkg) can be decrypted & extracted using the "[http://www.vitadevwiki.com/index.php?title=Tools PS VITA .pkg xTractor]"
 
A picture showing the unpacked game .pkg structure:
[[File:PKGdirstruct.png]]
 
See also: [[System_File_Object_(SFO)_(PSF)]], [[Keys]] and [[Template:PKG_Types|PKG type]]
 
<pre>
typedef struct{
u32  magic;
u32  pkg_type;
u32  pkg_info_offset;
u32  pkg_info_size;
u32  header_size;
u32  item_count;
u64  total_size;
u64  data_offset;
u64  data_size;
char contentid[0x30];
u8  digest[0x10];
u8  k_licensee[0x10];
u8  sha1_hash[0x40]; //header hash
} PKG_Header;
 
typedef struct{
u32  magic;                      // 0x7f657874 ".ext"
u32  unknown_01;                // static = 1
u32  header_size;                // header size (0x00000040)
u32  data_size;                  // data size  (0x00000180)
u32  data_offset;                // data start offset (0x00000100)
u32  data_type;                  //  = 0x00000360, Beta = 0x00000390, Retail 0x00000490
u64  pkg_data_size (or offset?); // 0x20 of data at the end used for an SHA-1 of the PKG
                                                        (size is always 0x1a0 on retail and beta pkg?).
u32  padding1;                  // 0x00000000
u32  data_type2;                // Beta = 0x00000001, Retail 0xc0000002
u32  unknown_02;                // on Retail = 0x00000930, Beta 0x00000000
u32  padding2;                  // 0x00000000
u64  padding3;                  // 0x0000000000000000
u64  padding3;                  // 0x0000000000000000
} Unknown_Header;
</pre>
 
...
 
<pre>
        u32 data_offset_param.sfo        // at offset 0x318 (retail)
        u32 data_size_param.sfo          // at offset 0x31C (retail)
</pre>
 
== Firmware Packages ==
 
PS VITA Firmware Package files (.pkg) are inside PS VITA Update Files (.pup).
 
Those packages can not be decrypted, yet.
 
== PSN ==
 
=== Game Update ===
It is a bit upgraded but basicly the same as on PS3. Once a game tab is opened, the VITA downloads a PKG for this game tab. This includes update information, such as if an update if available. If thats the case, the game tab will show you a yellow arrow on the top of the screen which gives you information about the update available.
This information is stored in XML's which are gathered via URL's like this example one:
 
<pre> http://gs.ww.np.dl.playstation.net/ppkg/np/PCSG00001/PCSG00001_T1/0101/c653f481544f8b19/changeinfo.xml</pre>
this is the content:
<pre>
<?xml version="1.0" encoding="UTF-8"?>
<changeinfo titleid="PCSG00001">
  <changes app_ver="01.01">
    <![CDATA[
オンライン仕様に関わる動作の安定性を向上しました
    ]]>
  </changes>
</changeinfo>
 
</pre>
 
This is the original update PKG.
 
<pre> http://gs.ww.np.dl.playstation.net/ppkg/np/PCSG00001/PCSG00001_T1/c653f481544f8b19/JP0700-PCSG00001_00-RIDGERACERPSVITA-A0101-V0100-fd9baf01343b2db6df0d434b17ef822a9699c6da-PE.pkg </pre>
 
[http://streetskaterfu.blogspot.com/2012/01/ps-vita-game-updates.html original link(SKFU BLOG)]
 
the update is stored with the XML.
 
<pre> http://gs.ww.np.dl.playstation.net/ppkg/np/[TITLE_ID]/[TITLE_ID]_T1/[Version]/[An HASH]/changeinfo.xml</pre>
 
= System Package =
 
Bytes are in '''Little Endian'''!!
 
<pre>
typedef struct {
    unint32_t type;          /*type of pkg. must be 0x3 (Offset 0x04)*/
    unint64_t unknown;      /*unknown but static      (Offset 0x08)*/
    unint64_t hdr_size;      /*header size              (Offset 0x10)*/
    unint64_t content_size;  /*package content size    (Offset 0x18)*/
    unint64_t size;          /*package size            (Offset 0x20)*/
}s_pkg
</pre>
Please note that all contributions to Vita Developer wiki are considered to be released under the GNU Free Documentation License 1.2 (see Vita 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)