summaryrefslogtreecommitdiff
path: root/include/user
diff options
context:
space:
mode:
Diffstat (limited to 'include/user')
-rw-r--r--include/user/kernel/clib.h11
-rw-r--r--include/user/npdrmpackage.h51
-rw-r--r--include/user/usbserial.h83
3 files changed, 145 insertions, 0 deletions
diff --git a/include/user/kernel/clib.h b/include/user/kernel/clib.h
index f450613..6db799d 100644
--- a/include/user/kernel/clib.h
+++ b/include/user/kernel/clib.h
@@ -9,10 +9,21 @@ extern "C" {
#endif
int sceClibStrcmp(const char *, const char *);
+void *sceClibStrncmp(const char *, const char *, SceSize);
+int sceClibStrncasecmp(const char *, const char *, SceSize);
+char *sceClibStrncpy(char *, const char *, SceSize);
+char *sceClibStrncat(char *, const char *, SceSize);
+SceSize sceClibStrnlen(const char *, SceSize);
+char *sceClibStrrchr(const char *, int);
+int sceClibPrintf(const char *, ...);
int sceClibSnprintf(char *, SceSize, const char *, ...);
int sceClibVsnprintf(char *, SceSize, const char *, va_list);
+void *sceClibMemset(void *, int, SceSize);
+void *sceClibMemcpy(void *, const void *, SceSize);
+void *sceClibMemmove(void *, const void *, SceSize);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/user/npdrmpackage.h b/include/user/npdrmpackage.h
new file mode 100644
index 0000000..5a41475
--- /dev/null
+++ b/include/user/npdrmpackage.h
@@ -0,0 +1,51 @@
+#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);
+
+/**
+ * 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);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _PSP2_NPDRMPACKAGE_H_ */
diff --git a/include/user/usbserial.h b/include/user/usbserial.h
new file mode 100644
index 0000000..00c9ba6
--- /dev/null
+++ b/include/user/usbserial.h
@@ -0,0 +1,83 @@
+#ifndef _PSP2_USBSERIAL_H_
+#define _PSP2_USBSERIAL_H_
+
+#include <psp2/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Activate USB serial device
+ *
+ * @return 0 on success, < 0 on error
+ *
+ * @note The user is responsible for making sure no other UDC driver is active. This activates UDC as a "PS Vita" Type D device.
+ *
+ * @note Wrapper for kernel function sceUsbSerialStart()
+ */
+int sceUsbSerialStart(void);
+
+/**
+ * Setup USB serial device
+ *
+ * @return 0 on success, < 0 on error
+ *
+ * @param unk Unknown
+ *
+ * @note Wrapper for kernel function sceUsbSerialSetup()
+ */
+int sceUsbSerialSetup(int unk);
+
+/**
+ * Close USB serial device
+ *
+ * @note Wrapper for kernel function sceUsbSerialClose()
+ */
+int sceUsbSerialClose(void);
+
+/**
+ * Close USB serial device
+ *
+ * @return Returns 1 when serial port is open
+ *
+ * @note Wrapper for kernel function sceUsbSerialStatus()
+ */
+int sceUsbSerialStatus(void);
+
+/**
+ * Get receive buffer length
+ *
+ * @return Returns length of USB rx buffer
+ *
+ * @note Wrapper for kernel function sceUsbSerialGetLen()
+ */
+unsigned int sceUsbSerialGetRecvBufferSize(void);
+
+/**
+ * Send data
+ * @param[in] *buffer data to send over usb
+ * @param len int len of serial buffer data
+ * @param unk1 Unknown
+ * @param unk2 Unknown
+ * @note max send length is 0x10000
+ * @note Wrapper for kernel function sceUsbSerialSend()
+ */
+unsigned int sceUsbSerialSend(const void *buffer, unsigned int len, int unk1, int unk2);
+
+/**
+ * Receive Data
+ *
+ * @param[out] *buffer buffer for incoming data
+ * @param max_len max data length to receive
+ * @param unk1 Unknown
+ * @param unk2 Unknown
+ * @note max recv length is 0x10000
+ * @note Wrapper for kernel function sceUsbSerialRecv()
+ */
+unsigned int sceUsbSerialRecv(void *buffer, unsigned int max_len, int unk1, int unk2);
+
+#ifdef __cplusplus
+}
+#endif
+#endif