Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NpDrmPackage #79

Merged
merged 2 commits into from
Nov 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions db.json
Original file line number Diff line number Diff line change
Expand Up @@ -3552,6 +3552,20 @@
},
"nid": 119
},
"SceNpDrmPackage": {
"modules": {
"SceNpDrmPackage": {
"functions": {
"_sceNpDrmPackageCheck": 2715321850,
"_sceNpDrmPackageDecrypt": 3606076108
},
"kernel": false,
"nid": 2287029682,
"variables": {}
}
},
"nid": 120
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need module nid

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't all entries in db.json use a placeholder NID currently?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most do, yes. We have the technology to fill these in properly now.

Copy link
Member Author

@devnoname120 devnoname120 Nov 12, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this should be done with the massive overhaul, including the _ change.

},
"SceNpManager": {
"modules": {
"SceNpManager": {
Expand Down
62 changes: 62 additions & 0 deletions include/psp2/npdrmpackage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* \file
* \brief Header file which defines NpDrmPackage related variables and functions
*
* Copyright (C) 2016 PSP2SDK Project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

#ifndef _PSP2_NPDRMPACKAGE_H_
#define _PSP2_NPDRMPACKAGE_H_

#include <psp2/types.h>

#ifdef __cplusplus
extern "C" {
#endif

/** Options for _sceNpDrmPackageDecrypt */
typedef struct {
/** The offset in the encrypted data */
SceOff offset;

/**
* The identifier specified for _sceNpDrmPackageCheck but NOT ORed
* with (1 << 8)
*/
unsigned int identifier;
} _sceNpDrmPackageDecrypt_opt;

/**
* Read the header of the PKG and initialize the context
*
* @param buffer - The buffer containing the header of PKG.
* @param size - The size of buffer. The minimum confirmed value is 0x8000.
* @param zero - Unknown. Supposed to be set to 0.
* @param identifier - arbitrary value [0, 6) ORed with (1 << 8) or 0.
* If it is set to 0, the function just checks the header
* and doesn't create the context.
*
* @return 0 on success, != 0 on error
*/
int _sceNpDrmPackageCheck(const void *buffer, SceSize size, int zero, unsigned int identifier);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add documentation for the return value?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it's < 0 on error, otherwise 0. Need @173210 's confirmation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!= 0 on error, otherwise 0.


/**
* Decrypt a PKG
*
* @param buffer - The buffer containing the content of the PKG.
* @param size - The size of the buffer. The minimum confirmed value is 0x20.
* @param opt - The options.
*
* @return 0 on success, != 0 on error
*/
int _sceNpDrmPackageDecrypt(void * restrict buffer, SceSize size, _sceNpDrmPackageDecrypt_opt * restrict opt);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here


#ifdef __cplusplus
}
#endif

#endif /* _PSP2_NPDRMPACKAGE_H_ */