diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/kernel/idstorage.h | 24 | ||||
-rw-r--r-- | include/kernel/kernel/utils.h | 128 | ||||
-rw-r--r-- | include/user/kernel/sysmem.h | 2 | ||||
-rw-r--r-- | include/user/vshbridge.h | 27 |
4 files changed, 173 insertions, 8 deletions
diff --git a/include/kernel/idstorage.h b/include/kernel/idstorage.h new file mode 100644 index 0000000..3f65799 --- /dev/null +++ b/include/kernel/idstorage.h @@ -0,0 +1,24 @@ +#ifndef _PSP2_KERNEL_IDSTORAGE_H_ +#define _PSP2_KERNEL_IDSTORAGE_H_ + +#include <psp2kern/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @param[in] leafnum - 0x0 ~ 0x80 / leafnum > 0x80 = error + * @param[out] buf - Leaf data + * @param[in] buf_size - set 0x200 / buf_size != 0x200 = 0x800F090D + * + * @return 0 on success, < 0 on error. + */ +int sceIdStorageReadLeaf(int leafnum, void *buf, int buf_size); +int sceIdStorageWriteLeaf(int leafnum, const void *buf, int buf_size); + +#ifdef __cplusplus +} +#endif + +#endif /* _PSP2_KERNEL_IDSTORAGE_H_ */ diff --git a/include/kernel/kernel/utils.h b/include/kernel/kernel/utils.h index e9055be..c7f1c92 100644 --- a/include/kernel/kernel/utils.h +++ b/include/kernel/kernel/utils.h @@ -45,6 +45,19 @@ typedef struct SceSha256Context { char result[SCE_SHA256_DIGEST_SIZE]; } SceSha256Context; +struct SceDeflatePartialInputParam; + +typedef struct SceDeflatePartialInputParam { + uint32_t size; + const void *pBufEnd; + void *cookie; + const void *(* SceDeflateDecompressPartialInputCallback)(struct SceDeflatePartialInputParam* param, uint32_t outputsize); +} SceDeflatePartialInputParam; + +typedef struct { + uint8_t data[976]; +} SceAesContext; + int sceSha1BlockInit(SceSha1Context *pContext); int sceSha1BlockUpdate(SceSha1Context *pContext, const void *plain, uint32_t len); int sceSha1BlockResult(SceSha1Context *pContext, char *digest); @@ -66,14 +79,125 @@ int sceHmacSha256Digest(const unsigned char *key, uint32_t key_len, const void * /** * @param[out] dst - dst buf - * @param[in] dst_size - Size when decompressed + * @param[in] dst_size - dst buf size * @param[in] src - Gzip compressed data * @param[out] crc32 - crc32 when decompressed * - * @return dst_size on success, < 0 on error. + * @return decompressed size on success, < 0 on error. */ int sceGzipDecompress(void *dst, uint32_t dst_size, const void *src, uint32_t *crc32); +/** + * @brief Check magic of Gzip header + * + * @param[in] src - Gzip compressed data + * + * @return 1 on success, 0 is not Gzip data. + */ +int sceGzipIsValid(const void *src); + +/** + * @brief Get filename etc. in Gzip data + * + * @param[in] src - Gzip compressed data + * @param[out] extra - Get information on extra-field + * @param[out] name - Get filename information + * @param[out] comment - Get comment information + * @param[out] crc - Get CRC16 information + * @param[out] data - Get compressed data start address + * + * @return 0 on success, < 0 on error. + */ +int sceGzipGetInfo(const void *src, const void **extra, const char **name, const char **comment, unsigned short *crc, const void **data); + +/** + * @brief Get filename string address + * + * @param[in] src - Gzip compressed data + * + * @return string address on success, NULL on error. + */ +const char *sceGzipGetName(const void *src); + +/** + * @brief Get comment string address + * + * @param[in] src - Gzip compressed data + * + * @return string address on success, NULL on error. + */ +const char *sceGzipGetComment(const void *src); + +/** + * @brief Get compressed data start address + * + * @param[in] src - Gzip compressed data + * + * @return compressed data address on success, NULL on error. + */ +const void *sceGzipGetCompressedData(const void *src); + +/** + * @brief Get filename etc. in Zlib data + * + * @param[in] src - Zlib compressed data + * @param[out] cmf - Get CMF (Compression Method and flags) + * @param[out] flg - Get FLG (FLaGs) + * @param[out] dictid - Get DictId + * @param[out] data - Get compressed data start address + * + * @return 0 on success, < 0 on error. + */ +int sceZlibGetInfo(const void *src, unsigned char *cmf, unsigned char *flg, unsigned int *dictid, const void **data); + +/** + * @brief Get compressed data start address + * + * @param[in] src - Gzip compressed data + * + * @return compressed data address on success, NULL on error. + */ +const void *sceZlibGetCompressedData(const void *src); + +/** + * @param[out] dst - dst buf + * @param[in] dst_size - dst buf size + * @param[in] src - Zlib compressed data + * @param[out] adler32 - adler32 when decompressed + * + * @return decompressed size on success, < 0 on error. + */ +int sceZlibDecompress(void *dst, uint32_t dst_size, const void *src, uint32_t *adler32); + +/** + * @param[out] dst - dst buf + * @param[in] dst_size - dst buf size + * @param[in] src - Deflate compressed data + * @param[out] next - next data + * + * @return decompressed size on success, < 0 on error. + */ +int sceDeflateDecompress(void *dst, uint32_t dst_size, const void *src, const void **next); +int sceDeflateDecompressPartial(void *dst, unsigned int dst_size, const void *src, const void **next, SceDeflatePartialInputParam *cbInfo); + +/** + * @param[out] ctx - out key data, etc... + * @param[in] blocksize - 128 or 192 or 256 + * @param[in] keysize - 128 or 192 or 256 + * @param[in] key - key data + * + * @return 0 on success, < 0 on error. + */ +int sceAesInit1(SceAesContext *ctx, int blocksize, int keysize, const void *key); +int sceAesInit2(SceAesContext *ctx, int blocksize, int keysize, const void *key); +int sceAesInit3(SceAesContext *ctx, int blocksize, int keysize, const void *key); + +int sceAesDecrypt1(SceAesContext *ctx, const void *src, void *dst); +int sceAesDecrypt2(SceAesContext *ctx, const void *src, void *dst); + +int sceAesEncrypt1(SceAesContext *ctx, const void *src, void *dst); +int sceAesEncrypt2(SceAesContext *ctx, const void *src, void *dst); + #ifdef __cplusplus } #endif diff --git a/include/user/kernel/sysmem.h b/include/user/kernel/sysmem.h index 2e8b8c2..2e68078 100644 --- a/include/user/kernel/sysmem.h +++ b/include/user/kernel/sysmem.h @@ -123,6 +123,8 @@ int sceKernelGetModel(void); */ int sceKernelGetFreeMemorySize(SceKernelFreeMemorySizeInfo *info); +int sceKernelIsPSVitaTV(void); + #ifdef __cplusplus } #endif diff --git a/include/user/vshbridge.h b/include/user/vshbridge.h index 9e8fa13..8f2c129 100644 --- a/include/user/vshbridge.h +++ b/include/user/vshbridge.h @@ -9,7 +9,7 @@ extern "C" { #endif int _vshSblGetSystemSwVersion(SceKernelFwInfo * data); - + int _vshSblAimgrGetConsoleId(char CID[32]); /** @@ -35,7 +35,17 @@ int vshIoUmount(int id, int unk1, int unk2, int unk3); int vshIdStorageIsDirty(void); int vshIdStorageIsFormatted(void); int vshIdStorageIsReadOnly(void); - + +/** + * @param[in] leafnum - 0x0 ~ 0x80 / leafnum > 0x80 = error + * @param[out] buf - Leaf data + * @param[in] buf_size - set 0x200 / buf_size != 0x200 = 0x800F090D + * + * @return 0 on success, < 0 on error. + */ +int vshIdStorageReadLeaf(int leafnum, void *buf, int buf_size); +int vshIdStorageWriteLeaf(int leafnum, const void *buf, int buf_size); + int vshSblAimgrIsCEX(void); int vshSblAimgrIsDEX(void); int vshSblAimgrIsGenuineVITA(void); @@ -43,15 +53,20 @@ int vshSblAimgrIsGenuineDolce(void); int vshSblAimgrIsTest(void); int vshSblAimgrIsTool(void); int vshSblSsIsDevelopmentMode(void); -int sceKernelIsPSVitaTV(void); - + int vshSysconHasWWAN(void); - + int vshSysconIsDownLoaderMode(void); int vshSysconIsIduMode(void); int vshSysconIsMCEmuCapable(void); int vshSysconIsShowMode(void); - + +int vshSysconIduModeSet(void); +int vshSysconIduModeClear(void); + +int vshSysconShowModeSet(void); +int vshSysconShowModeClear(void); + int vshMemoryCardGetCardInsertState(void); int vshRemovableMemoryGetCardInsertState(void); |