diff options
Diffstat (limited to 'include/user')
-rw-r--r-- | include/user/appmgr.h | 38 | ||||
-rw-r--r-- | include/user/incoming_dialog.h | 83 | ||||
-rw-r--r-- | include/user/kernel/clib.h | 5 | ||||
-rw-r--r-- | include/user/kernel/processmgr.h | 3 | ||||
-rw-r--r-- | include/user/kernel/threadmgr.h | 3 | ||||
-rw-r--r-- | include/user/notification_util.h | 80 | ||||
-rw-r--r-- | include/user/registrymgr.h | 4 | ||||
-rw-r--r-- | include/user/shellutil.h | 93 |
8 files changed, 306 insertions, 3 deletions
diff --git a/include/user/appmgr.h b/include/user/appmgr.h index ae0f6c9..b55859a 100644 --- a/include/user/appmgr.h +++ b/include/user/appmgr.h @@ -96,6 +96,34 @@ typedef struct sceAppMgrLoadExecOptParam { #define SCE_APPMGR_MAX_APP_NAME_LENGTH (31) +typedef struct SceAppMgrBudgetInfo { +// 0x00 + SceSize size; + SceUInt32 mode; + SceUInt32 unk_8; + SceUInt32 budgetLPDDR2; +// 0x10 + SceUInt32 freeLPDDR2; + SceUInt32 allow0x0E208060; + SceUInt32 unk_14; + SceUInt32 budget0x0E208060; +// 0x20 + SceUInt32 free0x0E208060; + SceUInt32 unk_24; + SceUInt32 unk_28; + SceUInt32 budgetPHYCONT; +// 0x30 + SceUInt32 freePHYCONT; + SceUInt32 allow; + SceUChar8 unk_38[0x20]; + SceUInt32 unk_58; + SceUInt32 budgetCDRAM; +// 0x60 + SceUInt32 freeCDRAM; + SceUChar8 reserved_64[0x24]; +// 0x88 +} SceAppMgrBudgetInfo; + /** * Save data on savedata0: partition * @@ -487,7 +515,15 @@ int _sceAppMgrGetRawPath(char *path, char *resolved_path, int resolved_path_size * @return 0 on success. */ int _sceAppMgrGetRawPathOfApp0ByAppIdForShell(int appId, char resolved_path[292]); - + +/** + * Get application memory budget info. + * + * @return 0 on success, < 0 on error. + * + */ +int sceAppMgrGetBudgetInfo(SceAppMgrBudgetInfo *info); + #ifdef __cplusplus } #endif diff --git a/include/user/incoming_dialog.h b/include/user/incoming_dialog.h new file mode 100644 index 0000000..c110cf0 --- /dev/null +++ b/include/user/incoming_dialog.h @@ -0,0 +1,83 @@ +#ifndef _DOLCESDK_PSP2_INCOMING_DIALOG_H_ +#define _DOLCESDK_PSP2_INCOMING_DIALOG_H_ + +#include <psp2/kernel/clib.h> +#include <psp2/scebase.h> +#include <psp2/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Dialog status + */ +typedef enum SceIncomingDialogStatus { + SCE_INCOMING_DIALOG_NOT_RUNNING, + SCE_INCOMING_DIALOG_BUSY, + SCE_INCOMING_DIALOG_RUNNING, + SCE_INCOMING_DIALOG_ACCEPTED, + SCE_INCOMING_DIALOG_REJECTED, + SCE_INCOMING_DIALOG_CLOSED, + SCE_INCOMING_DIALOG_TIMEOUT, +} SceIncomingDialogStatus; + +/** + * Errors + */ +#define SCE_INCOMINGDIALOG_ERROR_INVALID_ARG 0x80106202; + +typedef struct SceIncomingDialogParam { + SceInt32 sdkVersion; + SceChar8 titleid[0x10]; // TitleId of the application to open when "accept" button has been pressed. Can be all zero. + SceChar8 audioPath[0x80]; // Path to audio file that will be played during dialog, .mp3, .at9, m4a. Can be all zero. + SceUInt32 dialogTimer; // Time to show dialog in seconds + SceInt32 unk_BC; // Can be set to 0 + SceChar8 reserved1[0x3E]; + SceWChar16 buttonRightText[0x20]; // Text for "accept" button. Must be null-terminated. + SceWChar16 buttonLeftText[0x20]; // Text for "reject" button. Must be null-terminated. If all zero, only "accept" button will be created. + SceWChar16 dialogText[0x81]; // Text for dialog window, also shared with notification. Must be null-terminated. +} SceIncomingDialogParam; + +/** + * Initialize incoming dialog library, initType must be 0. + */ +SceInt32 sceIncomingDialogInitialize(int initType); + +/** + * Open incoming dialog. + */ +SceInt32 sceIncomingDialogOpen(SceIncomingDialogParam* dialogParam); + +/** + * Returns current status of incoming dialog. + */ +SceInt32 sceIncomingDialogGetStatus(void); + +/** + * Force exit to LiveArea and show dialog window + */ +SceInt32 sceIncomingDialogSwitchToDialog(void); + +/** + * Close incoming dialog. + */ +SceInt32 sceIncomingDialogClose(void); + +/** + * Finalize incoming dialog library + */ +SceInt32 sceIncomingDialogFinalize(void); + +static inline +void sceIncomingDialogParamInit(SceIncomingDialogParam* dialogParam) +{ + sceClibMemset(dialogParam, 0x0, sizeof(SceIncomingDialogParam)); + dialogParam->sdkVersion = SCE_PSP2_SDK_VERSION; +} + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _DOLCESDK_PSP2_INCOMING_DIALOG_H_ */ diff --git a/include/user/kernel/clib.h b/include/user/kernel/clib.h index a7aa75e..b22eb3f 100644 --- a/include/user/kernel/clib.h +++ b/include/user/kernel/clib.h @@ -21,6 +21,7 @@ int sceClibTolower(char ch); int sceClibToupper(char ch); int sceClibPrintf(const char *fmt, ...); +int sceClibVprintf(const char *fmt, va_list args); int sceClibSnprintf(char *dst, SceSize dst_max_size, const char *fmt, ...); int sceClibVsnprintf(char *dst, SceSize dst_max_size, const char *fmt, va_list args); @@ -45,6 +46,10 @@ int sceClibMemcmp(const void *s1, const void *s2, SceSize len); void *sceClibMemchr(const void *src, int ch, SceSize len); +void *sceClibMspaceCreate(void *base, SceSize size); +void *sceClibMspaceMalloc(void *space, SceSize size); +void sceClibMspaceFree(void *space, void *ptr); + #ifdef __cplusplus } #endif diff --git a/include/user/kernel/processmgr.h b/include/user/kernel/processmgr.h index 272fe51..70e50b6 100644 --- a/include/user/kernel/processmgr.h +++ b/include/user/kernel/processmgr.h @@ -8,6 +8,9 @@ extern "C" { #endif +/** UID of the current process */ +#define SCE_KERNEL_PROCESS_ID_SELF 0 + typedef enum SceKernelProcessPrioritySystem { SCE_KERNEL_PROCESS_PRIORITY_SYSTEM_HIGH = 32, SCE_KERNEL_PROCESS_PRIORITY_SYSTEM_DEFAULT = 96, diff --git a/include/user/kernel/threadmgr.h b/include/user/kernel/threadmgr.h index c5d93b7..9d42eb4 100644 --- a/include/user/kernel/threadmgr.h +++ b/include/user/kernel/threadmgr.h @@ -12,6 +12,9 @@ typedef SceUInt64 SceKernelSysClock; /* Threads. */ +/** UID of the current thread */ +#define SCE_KERNEL_THREAD_ID_SELF 0 + typedef int (*SceKernelThreadEntry)(SceSize args, void *argp); /** Additional options used when creating threads. */ diff --git a/include/user/notification_util.h b/include/user/notification_util.h new file mode 100644 index 0000000..e9a5298 --- /dev/null +++ b/include/user/notification_util.h @@ -0,0 +1,80 @@ +#ifndef _DOLCESDK_PSP2_NOTIFICATION_UTIL_H_ +#define _DOLCESDK_PSP2_NOTIFICATION_UTIL_H_ + +#include <psp2/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Errors + */ +#define SCE_NOTIFICATIONUTIL_ERROR_INTERNAL 0x80106301 + +/** + * BGDL-type notification event handler function + */ +typedef void (*SceNotificationUtilProgressEventHandler)(SceUInt32 eventId); + +typedef struct SceNotificationUtilProgressInitParam { + SceWChar16 notificationText[0x40]; // must be null-terminated + SceWChar16 notificationSubText[0x40]; // must be null-terminated + SceChar8 unk[0x3E6]; + SceNotificationUtilProgressEventHandler eventHandler; + SceInt32 unk_4EC; // can be set to 0 + SceWChar16 cancelDialogText[0x40]; // must be null-terminated +} SceNotificationUtilProgressInitParam; + +typedef struct SceNotificationUtilProgressUpdateParam { + SceWChar16 notificationText[0x40]; // must be null-terminated + SceWChar16 notificationSubText[0x40]; // must be null-terminated + SceFloat targetProgress; + SceChar8 reserved[0x38]; +} SceNotificationUtilProgressUpdateParam; + +typedef struct SceNotificationUtilProgressFinishParam { + SceWChar16 notificationText[0x40]; // must be null-terminated + SceWChar16 notificationSubText[0x40]; // must be null-terminated + SceChar8 path[0x3E8]; +} SceNotificationUtilProgressFinishParam; + +/** + * Initialize notification util for use with BG application. + * + * Does not need to be called for normal applications. + */ +SceInt32 sceNotificationUtilBgAppInitialize(void); + +/** + * Send notification. + * + * Text buffer size must be 0x470. + */ +SceInt32 sceNotificationUtilSendNotification(const SceWChar16* text); + +/** + * Clean notifications for calling app from notification history. + */ +SceInt32 sceNotificationUtilCleanHistory(void); + +/** + * Start BGDL-type notification. + */ +SceInt32 sceNotificationUtilProgressBegin(SceNotificationUtilProgressInitParam* initParam); + +/** + * Update BGDL-type notification. + */ +SceInt32 sceNotificationUtilProgressUpdate(SceNotificationUtilProgressUpdateParam* updateParam); + +/** + * Finish BGDL-type notification. + */ +SceInt32 sceNotificationUtilProgressFinish(SceNotificationUtilProgressFinishParam* finishParam); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _DOLCESDK_PSP2_NOTIFICATION_UTIL_H_ */ diff --git a/include/user/registrymgr.h b/include/user/registrymgr.h index cc363b5..dbf4946 100644 --- a/include/user/registrymgr.h +++ b/include/user/registrymgr.h @@ -59,11 +59,11 @@ int sceRegMgrSetKeyBin(const char *category, const char *name, void *buf, int si * * @param category - The path to the directory to be opened (e.g. /CONFIG/SYSTEM) * @param name - Name of the key - * @param buf - Pointer to an int buffer to hold the value + * @param value - Value to set to * * @return 0 on success, < 0 on error */ -int sceRegMgrSetKeyInt(const char* category, const char* name, int buf); +int sceRegMgrSetKeyInt(const char* category, const char* name, int value); /** * Set a key's information by category and name diff --git a/include/user/shellutil.h b/include/user/shellutil.h index 61d602b..0d84ff6 100644 --- a/include/user/shellutil.h +++ b/include/user/shellutil.h @@ -1,6 +1,8 @@ #ifndef _PSP2_SHELLUTIL_H_ #define _PSP2_SHELLUTIL_H_ +#include <psp2/types.h> + #ifdef __cplusplus extern "C" { #endif @@ -65,6 +67,97 @@ int sceShellUtilLock(SceShellUtilLockType type); */ int sceShellUtilUnlock(SceShellUtilLockType type); +/** + * Reboot the device + * + * @param[in] unk - pass 0 + */ +void sceShellUtilRequestColdReset(int unk); + +/** + * Poweroff the device + * + * @param[in] unk - pass 0 + */ +void sceShellUtilRequestStandby(int unk); + +/** + * Show "A serious error has occured" message and reboot + * + * @param[in] safeModeType - sets type of safemode to reboot into, 0 to reboot normally + * @param[in] errorCode - error code to display in the message + * @param[in] errorMessageType - ex. 0 "Contact technical support" + */ +void sceShellUtilRequestColdResetWithError(int safeModeType, int errorCode, int errorMessageType); + +/** + * SceTextClipboardStorage is cached memory block with usable size of 0x1FFD bytes + * allocated by SceShellSvc on startup. Normally you would access this storage with + * clipboard sysmodule, however it can also be accessed directly with SceShellSvc + * functions. This memory can be accesed from any part of the system and is managed + * by SceShell. For example, you can write to it in one application and access + * written data from the other. Or you can write to it in application and access + * written data from the plugin. + * + * @param[in] data - pointer to the data to write + * @param[in] size - size of data to write. Must not exceed 0x1FFD. + */ + +SceInt32 sceShellUtilTextClipboardWrite(const void* data, SceSize size); + +/** + * Read from text clipboard + * + * @param[in] data - pointer to the buffer where the read data will be placed + * @param[in] size - size of data to read + * @param[out] textlen - length actually read + */ + +SceInt32 sceShellUtilTextClipboardRead(void* data, SceSize size, SceSize *textlen); + +/** + * Returns size of the data that was written to clipboard with + * sceShellUtilTextClipboardWrite + */ + +SceUInt32 sceShellUtilTextClipboardGetUsedSize(void); + +/** + * Sets text in time display, UTF-16 (remains until reboot?) + */ + +SceInt32 sceShellUtilSetTimeText(SceWChar16* unk, SceWChar16* text); + +/** + * Set airplane icon visibility + * + * @param[in] mode - 0 to hide, 1 to show + */ + +SceInt32 sceShellUtilSetAirplaneIconMode(SceUInt32 mode); + +/** + * Set Bluetooth icon visibility + * + * @param[in] mode - 0 to hide, 1 to show + */ + +SceInt32 sceShellUtilSetBtIconMode(SceUInt32 mode); + +/** + * Set BGM mode + * + * @param[in] mode - 0 to disable, 1 to enable + */ + +SceInt32 sceShellUtilSetBGMMode(SceUInt32 mode); + +/** + * Set system language. Takes about 5 sec to apply. + */ + +SceInt32 sceShellUtilSetSystemLanguage(SceUInt32 languageId); + #ifdef __cplusplus } #endif |