vitasdk
Documentation of the vitasdk

Exports for User. More...

Data Structures

struct  SceNpDrmPackageCheckOpt
 
struct  _sceNpDrmPackageDecrypt_opt
 Options for _sceNpDrmPackageDecrypt. More...
 
struct  SceNpDrmPackageStartedOpt
 
struct  SceNpDrmPackageFinishedOpt
 

Functions

 VITASDK_BUILD_ASSERT_EQ (0x20, SceNpDrmPackageCheckOpt)
 
 VITASDK_BUILD_ASSERT_EQ (0x10, SceNpDrmPackageDecryptOpt)
 
 VITASDK_BUILD_ASSERT_EQ (0x10, SceNpDrmPackageStartedOpt)
 
 VITASDK_BUILD_ASSERT_EQ (0x8, SceNpDrmPackageFinishedOpt)
 
int _sceNpDrmPackageCheck (const void *buffer, SceSize size, int opt, unsigned int identifier)
 Read the header of the PKG and initialize the context.
 
int _sceNpDrmPackageDecrypt (void *__restrict__ buffer, SceSize size, SceNpDrmPackageDecryptOpt *__restrict__ opt)
 Decrypt a PKG.
 
int _sceNpDrmPackageTransform (const void *buffer, SceSize size, SceSblDmac5HashTransformContext *context, SceUInt32 identifier)
 Update a package hash-transform context.
 
int _sceNpDrmPackageInstallStarted (int identifier, int forwarded_value, const void *message, const SceNpDrmPackageStartedOpt *opt)
 Notify that package installation has started.
 
int _sceNpDrmPackageInstallFinished (int result_code, const void *message, SceSize message_size, const SceNpDrmPackageFinishedOpt *opt)
 Notify that package installation has finished.
 
int _sceNpDrmPackageUninstallStarted (int identifier, int forwarded_value, const void *message, const SceNpDrmPackageStartedOpt *opt)
 Notify that package uninstallation has started.
 
int _sceNpDrmPackageUninstallFinished (int result_code, const void *message, SceSize message_size, const SceNpDrmPackageFinishedOpt *opt)
 Notify that package uninstallation has finished.
 
int _sceNpDrmSaveDataFormatStarted (int identifier, int forwarded_value, const void *message, const SceNpDrmPackageStartedOpt *opt)
 Notify that save-data formatting has started.
 
int _sceNpDrmSaveDataFormatFinished (int result_code, const void *message, SceSize message_size, const SceNpDrmPackageFinishedOpt *opt)
 Notify that save-data formatting has finished.
 
int _sceNpDrmSaveDataInstallStarted (int identifier, int forwarded_value, const void *message, const SceNpDrmPackageStartedOpt *opt)
 Notify that save-data installation has started.
 
int _sceNpDrmSaveDataInstallFinished (int result_code, const void *message, SceSize message_size, const SceNpDrmPackageFinishedOpt *opt)
 Notify that save-data installation has finished.
 
int sceNpDrmPackageInstallOngoing (int identifier, SceUInt32 progress)
 Report package installation progress.
 
SceBool sceNpDrmPackageIsGameExist (void)
 
int sceNpDrmPackageUninstallOngoing (int identifier, SceUInt32 progress)
 Report package uninstallation progress.
 
int sceNpDrmSaveDataFormatOngoing (int identifier, SceUInt32 progress)
 Report save-data formatting progress.
 
int sceNpDrmSaveDataInstallOngoing (int identifier, SceUInt32 progress)
 Report save-data installation progress.
 

Variables

SceUInt32 SceNpDrmPackageCheckOpt::reserved [8]
 Ignored on FW 3.60.
 
SceOff _sceNpDrmPackageDecrypt_opt::offset
 Offset in the encrypted data.
 
SceUInt32 _sceNpDrmPackageDecrypt_opt::identifier
 Context identifier passed to _sceNpDrmPackageCheck without the 0x100 flag.
 
SceSize SceNpDrmPackageStartedOpt::message_size
 Size of the message buffer.
 
SceSize SceNpDrmPackageStartedOpt::message_copy_size
 Number of bytes to copy from the message buffer; must not exceed 0x40.
 
SceUInt32 SceNpDrmPackageStartedOpt::reserved [2]
 Ignored on FW 3.60.
 
SceSize SceNpDrmPackageFinishedOpt::message_copy_size
 Number of bytes to copy from the message buffer; must not exceed 0x40.
 
SceUInt32 SceNpDrmPackageFinishedOpt::reserved
 Ignored on FW 3.60.
 

Detailed Description

Exports for User.


Using this library in your project

Include the header file in your project:


Link the library to the executable:

SceNpDrm_stub



On FW 3.60, every function in this library except sceNpDrmPackageIsGameExist is restricted to system programs with auth ID 0x2800000000000001, 0x280000000000002D, 0x280000000000002E, or 0x2800000000000039.

The started and finished notification functions copy at most 0x40 bytes from the message buffer before returning. You may reuse or free the buffer after the function returns.


Data Structure Documentation

◆ SceNpDrmPackageCheckOpt

struct SceNpDrmPackageCheckOpt
Data Fields
SceUInt32 reserved[8] Ignored on FW 3.60.

◆ _sceNpDrmPackageDecrypt_opt

struct _sceNpDrmPackageDecrypt_opt

Options for _sceNpDrmPackageDecrypt.

The older type name _sceNpDrmPackageDecrypt_opt is kept for backwards compatibility.

Data Fields
SceOff offset Offset in the encrypted data.
SceUInt32 identifier Context identifier passed to _sceNpDrmPackageCheck without the 0x100 flag.

◆ SceNpDrmPackageStartedOpt

struct SceNpDrmPackageStartedOpt
Data Fields
SceSize message_size Size of the message buffer.
SceSize message_copy_size Number of bytes to copy from the message buffer; must not exceed 0x40.
SceUInt32 reserved[2] Ignored on FW 3.60.

◆ SceNpDrmPackageFinishedOpt

struct SceNpDrmPackageFinishedOpt
Data Fields
SceSize message_copy_size Number of bytes to copy from the message buffer; must not exceed 0x40.
SceUInt32 reserved Ignored on FW 3.60.

Function Documentation

◆ VITASDK_BUILD_ASSERT_EQ() [1/4]

VITASDK_BUILD_ASSERT_EQ ( 0x20  ,
SceNpDrmPackageCheckOpt   
)

◆ VITASDK_BUILD_ASSERT_EQ() [2/4]

VITASDK_BUILD_ASSERT_EQ ( 0x10  ,
SceNpDrmPackageDecryptOpt   
)

◆ VITASDK_BUILD_ASSERT_EQ() [3/4]

VITASDK_BUILD_ASSERT_EQ ( 0x10  ,
SceNpDrmPackageStartedOpt   
)

◆ VITASDK_BUILD_ASSERT_EQ() [4/4]

VITASDK_BUILD_ASSERT_EQ ( 0x8  ,
SceNpDrmPackageFinishedOpt   
)

◆ _sceNpDrmPackageCheck()

int _sceNpDrmPackageCheck ( const void *  buffer,
SceSize  size,
int  opt,
unsigned int  identifier 
)

Read the header of the PKG and initialize the context.

The caller must be one of the system programs accepted by FW 3.60.

Parameters
[in]buffer- Buffer containing the PKG header
[in]size- Buffer size. A normal check requires at least 0x8000 bytes.
[in]opt- A 32-bit user pointer to a SceNpDrmPackageCheckOpt structure, or 0. The parameter remains an integer for backwards compatibility. The structure contents are ignored on FW 3.60. Any nonzero pointer requests that the context be destroyed.
[in]identifier- Value whose low byte selects one of six contexts. Bit 0x100 creates or uses the context. Bit 0x200 also requests that the context be destroyed and requires a nonzero opt.
Returns
0 on success, < 0 on error

◆ _sceNpDrmPackageDecrypt()

int _sceNpDrmPackageDecrypt ( void *__restrict__  buffer,
SceSize  size,
SceNpDrmPackageDecryptOpt *__restrict__  opt 
)

Decrypt a PKG.

The caller must be one of the system programs accepted by FW 3.60.

Parameters
[in,out]buffer- PKG data to decrypt in place
[in]size- Size of the buffer
[in]opt- Required input-only offset and context identifier. Still declared as non-const for backwards compatibility.
Returns
0 on success, < 0 on error

◆ _sceNpDrmPackageTransform()

int _sceNpDrmPackageTransform ( const void *  buffer,
SceSize  size,
SceSblDmac5HashTransformContext *  context,
SceUInt32  identifier 
)

Update a package hash-transform context.

The caller must be one of the system programs accepted by FW 3.60.

Parameters
[in]buffer- Input data
[in]size- Size of the input data; must be nonzero
[in,out]context- Required hash context. All 0x28 bytes are copied in before the update and copied back afterwards.
[in]identifier- Package identifier and flags. Bit 0x10000 copies the 0x20-byte DMAC5 hash output into context->state. Bit 0x40000000 selects DMAC5 command 3 instead of command 0x13.
Returns
0 on success, < 0 on error

◆ _sceNpDrmPackageInstallStarted()

int _sceNpDrmPackageInstallStarted ( int  identifier,
int  forwarded_value,
const void *  message,
const SceNpDrmPackageStartedOpt *  opt 
)

Notify that package installation has started.

Parameters
[in]identifier- Package operation identifier. The FW 3.60 installer sets bit 0x80000000 for a started notification.
[in]forwarded_value- Passed unchanged to the system callback; its purpose is unknown. Observed FW 3.60 callers pass 0.
[in]message- Optional status data
[in]opt- Required message-size options
Returns
>= 0 on success, < 0 on error

◆ _sceNpDrmPackageInstallFinished()

int _sceNpDrmPackageInstallFinished ( int  result_code,
const void *  message,
SceSize  message_size,
const SceNpDrmPackageFinishedOpt *  opt 
)

Notify that package installation has finished.

Parameters
[in]result_code- Operation result
[in]message- Optional status data
[in]message_size- Size of the status data
[in]opt- Required message-copy options
Returns
>= 0 on success, < 0 on error

◆ _sceNpDrmPackageUninstallStarted()

int _sceNpDrmPackageUninstallStarted ( int  identifier,
int  forwarded_value,
const void *  message,
const SceNpDrmPackageStartedOpt *  opt 
)

Notify that package uninstallation has started.

Parameters
[in]identifier- Package operation identifier. The FW 3.60 installer sets bit 0x80000000 for a started notification.
[in]forwarded_value- Passed unchanged to the system callback; its purpose is unknown. Observed FW 3.60 callers pass 0.
[in]message- Optional status data
[in]opt- Required message-size options
Returns
>= 0 on success, < 0 on error

◆ _sceNpDrmPackageUninstallFinished()

int _sceNpDrmPackageUninstallFinished ( int  result_code,
const void *  message,
SceSize  message_size,
const SceNpDrmPackageFinishedOpt *  opt 
)

Notify that package uninstallation has finished.

Parameters
[in]result_code- Operation result
[in]message- Optional status data
[in]message_size- Size of the status data
[in]opt- Required message-copy options
Returns
>= 0 on success, < 0 on error

◆ _sceNpDrmSaveDataFormatStarted()

int _sceNpDrmSaveDataFormatStarted ( int  identifier,
int  forwarded_value,
const void *  message,
const SceNpDrmPackageStartedOpt *  opt 
)

Notify that save-data formatting has started.

Parameters
[in]identifier- Save-data operation identifier. The FW 3.60 installer sets bit 0x80000000 for a started notification.
[in]forwarded_value- Passed unchanged to the system callback; its purpose is unknown. Observed FW 3.60 callers pass 0.
[in]message- Optional status data
[in]opt- Required message-size options
Returns
>= 0 on success, < 0 on error

◆ _sceNpDrmSaveDataFormatFinished()

int _sceNpDrmSaveDataFormatFinished ( int  result_code,
const void *  message,
SceSize  message_size,
const SceNpDrmPackageFinishedOpt *  opt 
)

Notify that save-data formatting has finished.

Parameters
[in]result_code- Operation result
[in]message- Optional status data
[in]message_size- Size of the status data
[in]opt- Required message-copy options
Returns
>= 0 on success, < 0 on error

◆ _sceNpDrmSaveDataInstallStarted()

int _sceNpDrmSaveDataInstallStarted ( int  identifier,
int  forwarded_value,
const void *  message,
const SceNpDrmPackageStartedOpt *  opt 
)

Notify that save-data installation has started.

Parameters
[in]identifier- Save-data operation identifier. The FW 3.60 installer sets bit 0x80000000 for a started notification.
[in]forwarded_value- Passed unchanged to the system callback; its purpose is unknown. Observed FW 3.60 callers pass 0.
[in]message- Optional status data
[in]opt- Required message-size options
Returns
>= 0 on success, < 0 on error

◆ _sceNpDrmSaveDataInstallFinished()

int _sceNpDrmSaveDataInstallFinished ( int  result_code,
const void *  message,
SceSize  message_size,
const SceNpDrmPackageFinishedOpt *  opt 
)

Notify that save-data installation has finished.

Parameters
[in]result_code- Operation result
[in]message- Optional status data
[in]message_size- Size of the status data
[in]opt- Required message-copy options
Returns
>= 0 on success, < 0 on error

◆ sceNpDrmPackageInstallOngoing()

int sceNpDrmPackageInstallOngoing ( int  identifier,
SceUInt32  progress 
)

Report package installation progress.

Parameters
[in]identifier- Package operation identifier
[in]progress- Progress percentage. FW 3.60 does not validate this value; the FW 3.60 installer uses values from 0 through 100.
Returns
>= 0 on success, < 0 on error

◆ sceNpDrmPackageIsGameExist()

SceBool sceNpDrmPackageIsGameExist ( void  )
Returns
Nonzero when package game content exists, 0 otherwise

◆ sceNpDrmPackageUninstallOngoing()

int sceNpDrmPackageUninstallOngoing ( int  identifier,
SceUInt32  progress 
)

Report package uninstallation progress.

Parameters
[in]identifier- Package operation identifier
[in]progress- Progress percentage. FW 3.60 does not validate this value; the FW 3.60 installer uses values from 0 through 100.
Returns
>= 0 on success, < 0 on error

◆ sceNpDrmSaveDataFormatOngoing()

int sceNpDrmSaveDataFormatOngoing ( int  identifier,
SceUInt32  progress 
)

Report save-data formatting progress.

Parameters
[in]identifier- Save-data operation identifier
[in]progress- Progress percentage. FW 3.60 does not validate this value; the FW 3.60 installer uses values from 0 through 100.
Returns
>= 0 on success, < 0 on error

◆ sceNpDrmSaveDataInstallOngoing()

int sceNpDrmSaveDataInstallOngoing ( int  identifier,
SceUInt32  progress 
)

Report save-data installation progress.

Parameters
[in]identifier- Save-data operation identifier
[in]progress- Progress percentage. FW 3.60 does not validate this value; the FW 3.60 installer uses values from 0 through 100.
Returns
>= 0 on success, < 0 on error

Variable Documentation

◆ reserved [1/3]

SceUInt32 SceNpDrmPackageCheckOpt::reserved[8]

Ignored on FW 3.60.

◆ offset

SceOff _sceNpDrmPackageDecrypt_opt::offset

Offset in the encrypted data.

◆ identifier

SceUInt32 _sceNpDrmPackageDecrypt_opt::identifier

Context identifier passed to _sceNpDrmPackageCheck without the 0x100 flag.

◆ message_size

SceSize SceNpDrmPackageStartedOpt::message_size

Size of the message buffer.

◆ message_copy_size [1/2]

SceSize SceNpDrmPackageStartedOpt::message_copy_size

Number of bytes to copy from the message buffer; must not exceed 0x40.

◆ reserved [2/3]

SceUInt32 SceNpDrmPackageStartedOpt::reserved[2]

Ignored on FW 3.60.

◆ message_copy_size [2/2]

SceSize SceNpDrmPackageFinishedOpt::message_copy_size

Number of bytes to copy from the message buffer; must not exceed 0x40.

◆ reserved [3/3]

SceUInt32 SceNpDrmPackageFinishedOpt::reserved

Ignored on FW 3.60.