diff options
Diffstat (limited to '')
72 files changed, 4943 insertions, 842 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..4ac4c2b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.0) + +set(ARCH "arm-dolce-eabi" CACHE STRING "Target architecture") +set(CMAKE_INSTALL_PREFIX "$ENV{DOLCESDK}/" CACHE PATH "Install prefix") + +if(DEFINED ENV{DOLCESDK}) + set(LIBS_GEN "$ENV{DOLCESDK}/bin/dolce-libs-gen" CACHE STRING "libs-gen command") +else() + set(LIBS_GEN "dolce-libs-gen" CACHE STRING "libs-gen command") +endif() + +project(dolcesdk-target-headers LANGUAGES NONE) + +set(STUBS_DIR stubs) +set(DB_FILE "${CMAKE_SOURCE_DIR}/db.yml") +set(DB_365_FILE "${CMAKE_SOURCE_DIR}/db_365.yml") + +add_custom_command(OUTPUT "${STUBS_DIR}" + DEPENDS "${DB_FILE}" "${DB_365_FILE}" + COMMAND ${CMAKE_COMMAND} -E make_directory "${STUBS_DIR}" + COMMAND "${LIBS_GEN}" "${DB_FILE}" "${STUBS_DIR}/cex-3600" + COMMAND "${LIBS_GEN}" "${DB_365_FILE}" "${STUBS_DIR}/cex-3650" +) + +add_custom_target(prepare-stubs ALL + DEPENDS "${STUBS_DIR}" +) + +install(DIRECTORY include/ DESTINATION "${ARCH}/include") +install(FILES db.yml db_365.yml DESTINATION share) diff --git a/include/common/appmgr.h b/include/common/appmgr.h new file mode 100644 index 0000000..da3a63a --- /dev/null +++ b/include/common/appmgr.h @@ -0,0 +1,63 @@ +#ifndef _DOLCESDK_PSP2COMMON_APPMGR_H_ +#define _DOLCESDK_PSP2COMMON_APPMGR_H_ + +#include <psp2common/types.h> + +#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) +extern "C" { +#endif + +#define SCE_APPMGR_MOUNTPOINT_DATA_MAXSIZE 16 + +#define SCE_APPMGR_SAVEDATA_SLOT_TITLE_MAXSIZE 64 +#define SCE_APPMGR_SAVEDATA_SLOT_SUBTITLE_MAXSIZE 128 +#define SCE_APPMGR_SAVEDATA_SLOT_DETAIL_MAXSIZE 512 +#define SCE_APPMGR_SAVEDATA_SLOT_ICON_PATH_MAXSIZE 64 + +#define SCE_APPMGR_NP_DRM_ADDCONT_ID_SIZE 17 + +typedef SceUInt32 SceAppMgrSaveDataSlotStatus; +typedef SceUInt32 SceAppMgrSaveDataDataSaveMode; + +typedef struct SceAppMgrMountPoint { + SceChar8 data[SCE_APPMGR_MOUNTPOINT_DATA_MAXSIZE]; +} SceAppMgrMountPoint; + +typedef struct SceAppMgrSaveDataSlotParam { + SceAppMgrSaveDataSlotStatus status; + SceChar8 title[SCE_APPMGR_SAVEDATA_SLOT_TITLE_MAXSIZE]; + SceChar8 subTitle[SCE_APPMGR_SAVEDATA_SLOT_SUBTITLE_MAXSIZE]; + SceChar8 detail[SCE_APPMGR_SAVEDATA_SLOT_DETAIL_MAXSIZE]; + SceChar8 iconPath[SCE_APPMGR_SAVEDATA_SLOT_ICON_PATH_MAXSIZE]; + SceInt32 userParam; + SceUInt32 sizeKiB; + SceDateTime modifiedTime; + SceChar8 reserved[48]; +} SceAppMgrSaveDataSlotParam; + +typedef struct SceAppMgrSaveDataDataSaveItem { + const SceChar8 *dataPath; + const void *buf; + SceSize bufSize; + SceChar8 padding[4]; + SceOff offset; + SceAppMgrSaveDataDataSaveMode mode; + SceChar8 reserved[36]; +} SceAppMgrSaveDataDataSaveItem; + +typedef struct SceAppMgrDrmAddcontId { + SceChar8 data[SCE_APPMGR_NP_DRM_ADDCONT_ID_SIZE]; + SceChar8 padding[3]; +} SceAppMgrDrmAddcontId; + +typedef struct SceAppMgrDrmAddcontParam { + SceSize size; + SceAppMgrDrmAddcontId dirName; + SceAppMgrMountPoint mountPoint; +} SceAppMgrDrmAddcontParam; + +#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) +} +#endif + +#endif // _DOLCESDK_PSP2COMMON_APPMGR_H_ diff --git a/include/common/kernel/cpu.h b/include/common/kernel/cpu.h new file mode 100644 index 0000000..4b42321 --- /dev/null +++ b/include/common/kernel/cpu.h @@ -0,0 +1,19 @@ +#ifndef _DOLCESDK_PSP2COMMON_KERNEL_CPU_H_ +#define _DOLCESDK_PSP2COMMON_KERNEL_CPU_H_ + +#define SCE_KERNEL_MAX_CPU 4 +#define SCE_KERNEL_CPU_MASK_SHIFT 16 +#define SCE_KERNEL_CPU_MASK_USER_0 (0x01 << SCE_KERNEL_CPU_MASK_SHIFT) +#define SCE_KERNEL_CPU_MASK_USER_1 (0x02 << SCE_KERNEL_CPU_MASK_SHIFT) +#define SCE_KERNEL_CPU_MASK_USER_2 (0x04 << SCE_KERNEL_CPU_MASK_SHIFT) +#define SCE_KERNEL_CPU_MASK_USER_3 (0x08 << SCE_KERNEL_CPU_MASK_SHIFT) + +#define SCE_KERNEL_CPU_MASK_USER_ALL \ + (SCE_KERNEL_CPU_MASK_USER_0 | SCE_KERNEL_CPU_MASK_USER_1 \ + | SCE_KERNEL_CPU_MASK_USER_2) + +#define SCE_KERNEL_CPU_MASK_USER_QUAD \ + (SCE_KERNEL_CPU_MASK_USER_0 | SCE_KERNEL_CPU_MASK_USER_1 \ + | SCE_KERNEL_CPU_MASK_USER_2 | SCE_KERNEL_CPU_MASK_USER_3) + +#endif // _DOLCESDK_PSP2COMMON_KERNEL_CPU_H_ diff --git a/include/common/kernel/iofilemgr.h b/include/common/kernel/iofilemgr.h new file mode 100644 index 0000000..ed03d3b --- /dev/null +++ b/include/common/kernel/iofilemgr.h @@ -0,0 +1,74 @@ +#ifndef _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_H_ +#define _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_H_ + +#include <psp2common/kernel/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* device types */ +#define SCE_D_TYPE_NULL 0x0 /* dummy device */ +#define SCE_D_TYPE_CHAR 0x1 /* character device */ +#define SCE_D_TYPE_BLOCK 0x4 /* block device */ +#define SCE_D_TYPE_FS 0x10 /* file system */ +#define SCE_D_TYPE_ALIAS 0x20 /* alias name (device alias) */ +#define SCE_D_TYPE_MOUNTPT 0x40 /* alias name (mount point) */ + +/* flags */ +#define SCE_FREAD (0x0001) /* readable */ +#define SCE_FWRITE (0x0002) /* writable */ +#define SCE_FNBLOCK (0x0004) /* Reserved: non-blocking reads */ +#define SCE_FDIRO (0x0008) /* internal use for dopen */ +#define SCE_FRLOCK (0x0010) /* Reserved: read locked (non-shared) */ +#define SCE_FWLOCK (0x0020) /* Reserved: write locked (non-shared) */ +#define SCE_FAPPEND (0x0100) /* append on each write */ +#define SCE_FCREAT (0x0200) /* create if nonexistant */ +#define SCE_FTRUNC (0x0400) /* truncate to zero length */ +#define SCE_EXCL (0x0800) /* exclusive create */ +#define SCE_FSCAN (0x1000) /* Reserved: scan type */ +#define SCE_FRCOM (0x2000) /* Reserved: remote command entry */ +#define SCE_FNBUF (0x4000) /* no device buffer */ +#define SCE_FASYNC (0x8000) /* Reserved: asyncronous i/o */ +#define SCE_FFDEXCL (0x01000000) /* exclusive access */ +#define SCE_FGAMEDATA (0x40000000) + +/* Flag for sceIoOpen() */ +#define SCE_O_RDONLY (SCE_FREAD) +#define SCE_O_WRONLY (SCE_FWRITE) +#define SCE_O_RDWR (SCE_FREAD|SCE_FWRITE) +#define SCE_O_NBLOCK (SCE_FNBLOCK) /* Reserved: Non-Blocking I/O */ +#define SCE_O_APPEND (SCE_FAPPEND) /* append (writes guaranteed at the end) */ +#define SCE_O_CREAT (SCE_FCREAT) /* open with file create */ +#define SCE_O_TRUNC (SCE_FTRUNC) /* open with truncation */ +#define SCE_O_EXCL (SCE_EXCL) /* exclusive create */ +#define SCE_O_NOBUF (SCE_FNBUF) /* no device buffer */ +#define SCE_O_NOWAIT (SCE_FASYNC) /* Reserved: asyncronous i/o */ +#define SCE_O_FDEXCL (SCE_FFDEXCL) /* exclusive access */ +#define SCE_O_PWLOCK (SCE_FPWLOCK) /* power control lock */ +#define SCE_O_FGAMEDATA (SCE_FGAMEDATA) + +/* Flag for sceIoLseek() */ +#define SCE_SEEK_SET (0) +#define SCE_SEEK_CUR (1) +#define SCE_SEEK_END (2) + +/* Path */ +#define SCE_IO_MAX_PATH_BUFFER_SIZE (1024) /* maximum path buffer size */ +#define SCE_IO_MAX_PATH_LENGTH (200) /* maximum path length */ + +/** + * May be used with sceIoDevctl() + */ +typedef struct SceIoDevInfo { + SceOff max_size; + SceOff free_size; + SceSize cluster_size; + void *unk; +} SceIoDevInfo; + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_H_ */ diff --git a/include/common/kernel/iofilemgr/async.h b/include/common/kernel/iofilemgr/async.h new file mode 100644 index 0000000..b0c0feb --- /dev/null +++ b/include/common/kernel/iofilemgr/async.h @@ -0,0 +1,21 @@ +#ifndef _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_ASYNC_H_ +#define _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_ASYNC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct SceIoAsyncParam { + int result; // [out] result of the IO operation (e.g. UID, read/wrote size, error code) + int unk_04; // [out] + int unk_08; // [in] + int unk_0C; // [out] + int unk_10; // [out] + int unk_14; // [out] +} SceIoAsyncParam; + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_ASYNC_H_ */ diff --git a/include/common/kernel/iofilemgr/dirent.h b/include/common/kernel/iofilemgr/dirent.h new file mode 100644 index 0000000..1e28c22 --- /dev/null +++ b/include/common/kernel/iofilemgr/dirent.h @@ -0,0 +1,23 @@ +#ifndef _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_DIRENT_H_ +#define _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_DIRENT_H_ + +#include <psp2common/kernel/types.h> +#include <psp2common/kernel/iofilemgr/stat.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** Describes a single directory entry */ +typedef struct SceIoDirent { + SceIoStat d_stat; //!< File status + char d_name[256]; //!< File name (not file path) + void *d_private; //!< Reserved (set to 0) + int dummy; //!< Padding +} SceIoDirent; + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_DIRENT_H_ */ diff --git a/include/common/kernel/iofilemgr/stat.h b/include/common/kernel/iofilemgr/stat.h new file mode 100644 index 0000000..4afea74 --- /dev/null +++ b/include/common/kernel/iofilemgr/stat.h @@ -0,0 +1,48 @@ +#ifndef _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_STAT_H_ +#define _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_STAT_H_ + +#include <psp2common/kernel/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* Filetypes and Protection bits */ +#define SCE_STM_FMT (0xf << 12) +#define SCE_STM_FREG (0x2 << 12) /* regular file */ +#define SCE_STM_FDIR (0x1 << 12) /* directory */ +#define SCE_STM_ISREG(m) (((m) & SCE_STM_FMT) == SCE_STM_FREG) +#define SCE_STM_ISDIR(m) (((m) & SCE_STM_FMT) == SCE_STM_FDIR) + +/* for SceMode */ +#define SCE_STM_RWU 00600 +#define SCE_STM_RU 00400 +#define SCE_STM_RWO 00006 +#define SCE_STM_RO 00004 + +/* for chstat cbit */ +#define SCE_CST_MODE 0x0001 +#define SCE_CST_ATTR 0x0000 /* not supported */ +#define SCE_CST_SIZE 0x0004 +#define SCE_CST_CT 0x0008 +#define SCE_CST_AT 0x0010 +#define SCE_CST_MT 0x0020 + +/** + * See sceIoChstat(), sceIoGetstat(), sceIoChstatByFd(), sceIoGetstatByFd() + */ +typedef struct SceIoStat { + SceIoMode st_mode; //!< File access mode + unsigned int st_attr; //!< Device-specific attribute + SceOff st_size; //!< File size + SceDateTime st_ctime; //!< File creation time + SceDateTime st_atime; //!< File last accessed time + SceDateTime st_mtime; //!< File last modified time + unsigned int st_private[6]; //!< Reserved +} SceIoStat; + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2COMMON_KERNEL_IOFILEMGR_STAT_H_ */ diff --git a/include/common/kernel/threadmgr.h b/include/common/kernel/threadmgr.h new file mode 100644 index 0000000..f8b2924 --- /dev/null +++ b/include/common/kernel/threadmgr.h @@ -0,0 +1,286 @@ +#ifndef _DOLCESDK_PSP2COMMON_KERNEL_THREADMGR_H_ +#define _DOLCESDK_PSP2COMMON_KERNEL_THREADMGR_H_ + +#include <psp2common/kernel/constants.h> +#include <psp2common/kernel/cpu.h> +#include <psp2common/kernel/types.h> + +#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) +extern "C" { +#endif + +// Thread priority + +#define SCE_KERNEL_HIGHEST_PRIORITY_USER (64) +#define SCE_KERNEL_LOWEST_PRIORITY_USER (191) + +#define SCE_KERNEL_INDIVIDUAL_QUEUE_HIGHEST_PRIORITY (64) +#define SCE_KERNEL_INDIVIDUAL_QUEUE_LOWEST_PRIORITY (127) +#define SCE_KERNEL_COMMON_QUEUE_HIGHEST_PRIORITY (128) +#define SCE_KERNEL_COMMON_QUEUE_LOWEST_PRIORITY (191) + +#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) +#define SCE_KERNEL_DEFAULT_PRIORITY (static_cast<SceInt32>(0x10000100)) +#else +#define SCE_KERNEL_DEFAULT_PRIORITY ((SceInt32)0x10000100) +#endif + +#define SCE_KERNEL_DEFAULT_PRIORITY_USER SCE_KERNEL_DEFAULT_PRIORITY + +#define SCE_KERNEL_CURRENT_THREAD_PRIORITY (0) + +// Thread stack size + +#define SCE_KERNEL_THREAD_STACK_SIZE_MAX SCE_KERNEL_32MiB +#define SCE_KERNEL_THREAD_STACK_SIZE_MIN SCE_KERNEL_4KiB + +#define SCE_KERNEL_THREAD_STACK_SIZE_DEFAULT SCE_KERNEL_THREAD_STACK_SIZE_MIN +#define SCE_KERNEL_THREAD_STACK_SIZE_DEFAULT_USER_MAIN SCE_KERNEL_256KiB + +#define SCE_KERNEL_STACK_SIZE_MAX SCE_KERNEL_1MiB +#define SCE_KERNEL_STACK_SIZE_MIN SCE_KERNEL_4KiB +#define SCE_KERNEL_STACK_SIZE_DEFAULT SCE_KERNEL_STACK_SIZE_MIN +#define SCE_KERNEL_STACK_SIZE_DEFAULT_USER_MAIN (0x00040000U) + +// Thread status + +#define SCE_KERNEL_THREAD_STATUS_RUNNING (0x00000001U) +#define SCE_KERNEL_THREAD_STATUS_READY (0x00000002U) +#define SCE_KERNEL_THREAD_STATUS_STANDBY (0x00000004U) +#define SCE_KERNEL_THREAD_STATUS_WAITING (0x00000008U) +#define SCE_KERNEL_THREAD_STATUS_DORMANT (0x00000010U) +#define SCE_KERNEL_THREAD_STATUS_DELETED (0x00000020U) +#define SCE_KERNEL_THREAD_STATUS_DEAD (0x00000040U) +#define SCE_KERNEL_THREAD_STATUS_STAGNANT (0x00000080U) +#define SCE_KERNEL_THREAD_STATUS_SUSPENDED (0x00000100U) + +#define SCE_KERNEL_THREAD_STATUS_MASK (0x0000ffffU) + +// Thread wait type + +#define SCE_KERNEL_WAITTYPE_DELAY (0x00000001U) +#define SCE_KERNEL_WAITTYPE_WAITTHEND (0x00000002U) +#define SCE_KERNEL_WAITTYPE_SIGNAL (0x00000004U) +#define SCE_KERNEL_WAITTYPE_WAITTHSUSPEND (0x00000008U) +#define SCE_KERNEL_WAITTYPE_EVENTFLAG (0x00000010U) +#define SCE_KERNEL_WAITTYPE_SEMAPHORE (0x00000020U) +#define SCE_KERNEL_WAITTYPE_MUTEX (0x00000040U) +#define SCE_KERNEL_WAITTYPE_RW_LOCK (0x00000080U) +#define SCE_KERNEL_WAITTYPE_COND_SIGNAL (0x00000100U) +#define SCE_KERNEL_WAITTYPE_COND_MUTEX (0x00000200U) +#define SCE_KERNEL_WAITTYPE_FAST_MUTEX (0x00001000U) +#define SCE_KERNEL_WAITTYPE_FAST_MUTEX_SPIN (0x00002000U) +#define SCE_KERNEL_WAITTYPE_EVENT (0x00010000U) +#define SCE_KERNEL_WAITTYPE_MP_EVENTS (0x00020000U) +#define SCE_KERNEL_WAITTYPE_MSG_PIPE (0x00040000U) +#define SCE_KERNEL_WAITTYPE_LW_MUTEX (0x00100000U) +#define SCE_KERNEL_WAITTYPE_LW_COND_SIGNAL (0x00200000U) +#define SCE_KERNEL_WAITTYPE_LW_COND_LW_MUTEX (0x00400000U) + +#define SCE_KERNEL_WAITTYPE_DELAY_CB (0x80000001U) +#define SCE_KERNEL_WAITTYPE_WAITTHEND_CB (0x80000002U) +#define SCE_KERNEL_WAITTYPE_SIGNAL_CB (0x80000004U) +#define SCE_KERNEL_WAITTYPE_WAITTHSUSPEND_CB (0x80000008U) +#define SCE_KERNEL_WAITTYPE_EVENTFLAG_CB (0x80000010U) +#define SCE_KERNEL_WAITTYPE_SEMAPHORE_CB (0x80000020U) +#define SCE_KERNEL_WAITTYPE_MUTEX_CB (0x80000040U) +#define SCE_KERNEL_WAITTYPE_RW_LOCK_CB (0x80000080U) +#define SCE_KERNEL_WAITTYPE_COND_SIGNAL_CB (0x80000100U) +#define SCE_KERNEL_WAITTYPE_COND_MUTEX_CB (0x80000200U) +#define SCE_KERNEL_WAITTYPE_FAST_MUTEX_CB (0x80001000U) +#define SCE_KERNEL_WAITTYPE_FAST_MUTEX_SPIN_CB (0x80002000U) +#define SCE_KERNEL_WAITTYPE_EVENT_CB (0x80010000U) +#define SCE_KERNEL_WAITTYPE_MP_EVENTS_CB (0x80020000U) +#define SCE_KERNEL_WAITTYPE_MSG_PIPE_CB (0x80040000U) +#define SCE_KERNEL_WAITTYPE_LW_MUTEX_CB (0x80100000U) +#define SCE_KERNEL_WAITTYPE_LW_COND_SIGNAL_CB (0x80200000U) +#define SCE_KERNEL_WAITTYPE_LW_COND_LW_MUTEX_CB (0x80400000U) + +// Thread UID + +#define SCE_KERNEL_THREAD_ID_SELF (0) + +#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) +#define SCE_KERNEL_THREAD_ID_USER (static_cast<SceUID>(0xfffffff0)) +#else +#define SCE_KERNEL_THREAD_ID_USER ((SceUID)0xfffffff0) +#endif + +// Thread synchronisation object UID class + +#define SCE_KERNEL_THREADMGR_UID_CLASS_THREAD (1) +#define SCE_KERNEL_THREADMGR_UID_CLASS_SEMA (2) +#define SCE_KERNEL_THREADMGR_UID_CLASS_EVENT_FLAG (3) +#define SCE_KERNEL_THREADMGR_UID_CLASS_MUTEX (4) +#define SCE_KERNEL_THREADMGR_UID_CLASS_COND (5) +#define SCE_KERNEL_THREADMGR_UID_CLASS_TIMER (6) +#define SCE_KERNEL_THREADMGR_UID_CLASS_MSG_PIPE (7) +#define SCE_KERNEL_THREADMGR_UID_CLASS_CALLBACK (8) +#define SCE_KERNEL_THREADMGR_UID_CLASS_THREAD_EVENT (9) +#define SCE_KERNEL_THREADMGR_UID_CLASS_LW_MUTEX (10) +#define SCE_KERNEL_THREADMGR_UID_CLASS_LW_COND (11) +#define SCE_KERNEL_THREADMGR_UID_CLASS_RW_LOCK (12) +#define SCE_KERNEL_THREADMGR_UID_CLASS_SIMPLE_EVENT (13) + +// Thread CPU affinity + +#define SCE_KERNEL_THREAD_CPU_AFFINITY_MASK_DEFAULT (0) + +// Thread function type + +typedef SceInt32 (*SceKernelThreadEntry)(SceSize argSize, void *pArgBlock); + +// Thread VFP exception mask + +#define SCE_KERNEL_VFP_EXCEPTION_MASK_QCE (0x08000000U) +#define SCE_KERNEL_VFP_EXCEPTION_MASK_IDE (0x00000080U) +#define SCE_KERNEL_VFP_EXCEPTION_MASK_IXE (0x00000010U) +#define SCE_KERNEL_VFP_EXCEPTION_MASK_UFE (0x00000008U) +#define SCE_KERNEL_VFP_EXCEPTION_MASK_OFE (0x00000004U) +#define SCE_KERNEL_VFP_EXCEPTION_MASK_DZE (0x00000002U) +#define SCE_KERNEL_VFP_EXCEPTION_MASK_IOE (0x00000001U) + +#define SCE_KERNEL_VFP_EXCEPTION_MASK_ALL \ + (SCE_KERNEL_VFP_EXCEPTION_MASK_QCE | SCE_KERNEL_VFP_EXCEPTION_MASK_IDE | \ + SCE_KERNEL_VFP_EXCEPTION_MASK_IXE | SCE_KERNEL_VFP_EXCEPTION_MASK_UFE | \ + SCE_KERNEL_VFP_EXCEPTION_MASK_OFE | SCE_KERNEL_VFP_EXCEPTION_MASK_DZE | \ + SCE_KERNEL_VFP_EXCEPTION_MASK_IOE) + +// Thread synchronisation object attribute + +#define SCE_KERNEL_ATTR_SINGLE (0x00000000U) +#define SCE_KERNEL_ATTR_MULTI (0x00001000U) +#define SCE_KERNEL_ATTR_TH_FIFO (0x00000000U) +#define SCE_KERNEL_ATTR_TH_PRIO (0x00002000U) +#define SCE_KERNEL_ATTR_MS_FIFO (0x00000000U) // Unused +#define SCE_KERNEL_ATTR_MS_PRIO (0x00000000U) // Unused +#define SCE_KERNEL_ATTR_OPENABLE (0x00000080U) + +#define SCE_KERNEL_OPEN_LIMIT_MAX (127) + +// Thread event + +#define SCE_KERNEL_THREAD_EVENT_TYPE_START (0x04) +#define SCE_KERNEL_THREAD_EVENT_TYPE_EXIT (0x08) + +#define SCE_KERNEL_THREAD_EVENT_TYPE_ALL \ + (SCE_KERNEL_THREAD_EVENT_TYPE_START | SCE_KERNEL_THREAD_EVENT_TYPE_EXIT) + +#define SCE_KERNEL_EVENT_ATTR_MANUAL_RESET (0x00000000U) +#define SCE_KERNEL_EVENT_ATTR_AUTO_RESET (0x00000100U) + +#define SCE_KERNEL_ATTR_NOTIFY_CB_ALL (0x00000000U) +#define SCE_KERNEL_ATTR_NOTIFY_CB_WAKEUP_ONLY (0x00000800U) + +#define SCE_KERNEL_EVENT_IN (0x00000001U) +#define SCE_KERNEL_EVENT_OUT (0x00000002U) +#define SCE_KERNEL_EVENT_CREATE (0x00000004U) +#define SCE_KERNEL_EVENT_DELETE (0x00000008U) +#define SCE_KERNEL_EVENT_ERROR (0x00000010U) +#define SCE_KERNEL_EVENT_OPEN (0x00000100U) +#define SCE_KERNEL_EVENT_CLOSE (0x00000200U) +#define SCE_KERNEL_EVENT_TIMER (0x00008000U) +#define SCE_KERNEL_EVENT_DATA_EXIST (0x00010000U) + +#define SCE_KERNEL_EVENT_USER_DEFINED_MASK (0xff000000U) + +#define SCE_KERNEL_EVENT_WAIT_MODE_OR (0x00000001U) +#define SCE_KERNEL_EVENT_WAIT_MODE_AND (0x00000002U) + +// Thread timer + +#define SCE_KERNEL_TIMER_TYPE_SET_EVENT (0) +#define SCE_KERNEL_TIMER_TYPE_PULSE_EVENT (1) + +// Thread message pipe + +#define SCE_KERNEL_MSG_PIPE_ATTR_TH_PRIO_S (0x00000001U) +#define SCE_KERNEL_MSG_PIPE_ATTR_TH_PRIO_R (0x00000002U) +#define SCE_KERNEL_MSG_PIPE_ATTR_TH_PRIO \ + (SCE_KERNEL_MSG_PIPE_ATTR_TH_PRIO_S | SCE_KERNEL_MSG_PIPE_ATTR_TH_PRIO_R) + +#define SCE_KERNEL_MSG_PIPE_ATTR_TH_FIFO_S (0x00000004U) +#define SCE_KERNEL_MSG_PIPE_ATTR_TH_FIFO_R (0x00000008U) +#define SCE_KERNEL_MSG_PIPE_ATTR_TH_FIFO \ + (SCE_KERNEL_MSG_PIPE_ATTR_TH_FIFO_S | SCE_KERNEL_MSG_PIPE_ATTR_TH_FIFO_R) + +#define SCE_KERNEL_MSG_PIPE_MODE_ASAP (0x00000000U) +#define SCE_KERNEL_MSG_PIPE_MODE_FULL (0x00000001U) + +#define SCE_KERNEL_MSG_PIPE_MODE_WAIT (0x00000000U) +#define SCE_KERNEL_MSG_PIPE_MODE_DONT_WAIT (0x00000010U) + +#define SCE_KERNEL_MSG_PIPE_MODE_DONT_REMOVE (0x00000100U) + +#define SCE_KERNEL_MSG_PIPE_TYPE_USER_MAIN (64) +#define SCE_KERNEL_MSG_PIPE_TYPE_USER_CDRAM (66) + +#define SCE_KERNEL_MSG_PIPE_OPT_ATTR_OPEN_LIMITATION (0x00000100U) + +// Thread event flag + +#define SCE_KERNEL_EVF_ATTR_TH_FIFO SCE_KERNEL_ATTR_TH_FIFO +#define SCE_KERNEL_EVF_ATTR_TH_PRIO SCE_KERNEL_ATTR_TH_PRIO +#define SCE_KERNEL_EVF_ATTR_SINGLE SCE_KERNEL_ATTR_SINGLE +#define SCE_KERNEL_EVF_ATTR_MULTI SCE_KERNEL_ATTR_MULTI + +#define SCE_KERNEL_EVF_WAITMODE_AND (0x00000000U) +#define SCE_KERNEL_EVF_WAITMODE_OR (0x00000001U) +#define SCE_KERNEL_EVF_WAITMODE_CLEAR_ALL (0x00000002U) +#define SCE_KERNEL_EVF_WAITMODE_CLEAR_PAT (0x00000004U) + +// Thread semaphore + +#define SCE_KERNEL_SEMA_ATTR_TH_FIFO SCE_KERNEL_ATTR_TH_FIFO +#define SCE_KERNEL_SEMA_ATTR_TH_PRIO SCE_KERNEL_ATTR_TH_PRIO + +// Thread mutex + +#define SCE_KERNEL_MUTEX_ATTR_TH_FIFO SCE_KERNEL_ATTR_TH_FIFO +#define SCE_KERNEL_MUTEX_ATTR_TH_PRIO SCE_KERNEL_ATTR_TH_PRIO +#define SCE_KERNEL_MUTEX_ATTR_RECURSIVE (0x00000002U) +#define SCE_KERNEL_MUTEX_ATTR_CEILING (0x00000004U) + +// Thread condition + +#define SCE_KERNEL_COND_ATTR_TH_FIFO SCE_KERNEL_ATTR_TH_FIFO +#define SCE_KERNEL_COND_ATTR_TH_PRIO SCE_KERNEL_ATTR_TH_PRIO + +// Thread lightweight mutex + +#define SCE_KERNEL_LW_MUTEX_ATTR_TH_FIFO SCE_KERNEL_ATTR_TH_FIFO +#define SCE_KERNEL_LW_MUTEX_ATTR_TH_PRIO SCE_KERNEL_ATTR_TH_PRIO +#define SCE_KERNEL_LW_MUTEX_ATTR_RECURSIVE (0x00000002U) + +// Thread lightweight condition + +#define SCE_KERNEL_LW_COND_ATTR_TH_FIFO SCE_KERNEL_ATTR_TH_FIFO +#define SCE_KERNEL_LW_COND_ATTR_TH_PRIO SCE_KERNEL_ATTR_TH_PRIO + +// Thread reader/writer lock + +#define SCE_KERNEL_RW_LOCK_ATTR_TH_FIFO SCE_KERNEL_ATTR_TH_FIFO +#define SCE_KERNEL_RW_LOCK_ATTR_TH_PRIO SCE_KERNEL_ATTR_TH_PRIO +#define SCE_KERNEL_RW_LOCK_ATTR_RECURSIVE (0x00000002U) +#define SCE_KERNEL_RW_LOCK_ATTR_CEILING (0x00000004U) + +#define SCE_KERNEL_RW_LOCK_CANCEL_WITH_WRITE_LOCK (1) + +// Types + +typedef struct _SceKernelThreadOptParam { + /** Size of the ::SceKernelThreadOptParam structure. */ + SceSize size; + SceUInt32 attr; + SceKernelMemBlockType memType1; + SceKernelMemBlockType memType2; + SceInt32 unk0x10; + SceInt32 unk0x14; + SceInt32 unk0x1C; +} SceKernelThreadOptParam; + +#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) +} +#endif + +#endif diff --git a/include/kernel/appmgr.h b/include/kernel/appmgr.h index 2f8e91a..8bec551 100644 --- a/include/kernel/appmgr.h +++ b/include/kernel/appmgr.h @@ -1,7 +1,7 @@ #ifndef _PSP2_KERNEL_APPMGR_H_ #define _PSP2_KERNEL_APPMGR_H_ -#include <psp2kern/types.h> +#include <psp2common/appmgr.h> #ifdef __cplusplus extern "C" { @@ -33,18 +33,22 @@ typedef struct /** * @brief Launch an application for debugging - * + * * @param[in] path Path to the executable to load * @param[in] args Arguments to pass to the executable and to configure appmgr * @param[in] arg_size The size of the args passed in * @param[in] type Set to 0x80000000 for debugging launch * @param[in] param pointer to launch params * @param unk unknown, set to nullptr - * + * * @return pid on success, else < 0. */ int sceAppMgrLaunchAppByPath(const char *path, const char *args, SceSize arg_size, unsigned int type, const SceAppMgrLaunchParam *param, void *unk); +SceInt32 sceAppMgrDrmOpen(const SceAppMgrDrmAddcontParam *pParam); + +SceInt32 sceAppMgrDrmClose(const SceAppMgrDrmAddcontParam *pParam); + #ifdef __cplusplus } #endif diff --git a/include/kernel/audioout.h b/include/kernel/audioout.h new file mode 100644 index 0000000..c1381ee --- /dev/null +++ b/include/kernel/audioout.h @@ -0,0 +1,21 @@ +#ifndef _PSP2_KERNEL_AUDIOOUT_H_ +#define _PSP2_KERNEL_AUDIOOUT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum SceAudioOutPortType { + //! Used for main audio output, freq must be set to 48000 Hz + SCE_AUDIO_OUT_PORT_TYPE_MAIN = 0, + //! Used for Background Music port + SCE_AUDIO_OUT_PORT_TYPE_BGM = 1, + //! Used for voice chat port + SCE_AUDIO_OUT_PORT_TYPE_VOICE = 2 +} SceAudioOutPortType; + +#ifdef __cplusplus +} +#endif + +#endif /* _PSP2_KERNEL_AUDIOOUT_H_ */ diff --git a/include/kernel/display.h b/include/kernel/display.h index 18800c5..5cfdc9a 100644 --- a/include/kernel/display.h +++ b/include/kernel/display.h @@ -277,6 +277,18 @@ int sceDisplaySetInvertColors(int display, int enable); */ int sceDisplaySetOwner(int head, int index, SceUID pid); +/** + * Set display scaling configuration + * + * @param[in] scale - Scaling factor between 0.80000001 and 1.20000005 + * @param[in] head - Use 0 for OLED/LCD and 1 for HDMI + * @param[in] index - Can be 0 or 1 + * @param[in] flags - Returns error if ((flags & 1) && (flags & 0xC0)) + * + * @return 0 on success, < 0 on error. +*/ +int sceDisplaySetScaleConf(float scale, int head, int index, int flags); + #ifdef __cplusplus } #endif diff --git a/include/kernel/io/devctl.h b/include/kernel/io/devctl.h index 73e1827..8d79f38 100644 --- a/include/kernel/io/devctl.h +++ b/include/kernel/io/devctl.h @@ -1,41 +1,8 @@ #ifndef _PSP2_IO_DEVCTL_H_ #define _PSP2_IO_DEVCTL_H_ -#include <psp2kern/types.h> +#pragma message "psp2kern/io/devctl.h is deprecated. Please include psp2kern/kernel/iofilemgr.h." -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct SceIoDevInfo { - SceOff max_size; - SceOff free_size; - SceSize cluster_size; - void *unk; -} SceIoDevInfo; - -/** - * Send a devctl command to a device. - * - * @par Example: Sending a simple command to a device - * @code - * SceIoDevInfo info; - * sceIoDevctl("ux0:", 0x3001, NULL, 0, &info, sizeof(SceIoDevInfo)); - * @endcode - * - * @param dev - String for the device to send the devctl to (e.g. "ux0:") - * @param cmd - The command to send to the device - * @param indata - A data block to send to the device, if NULL sends no data - * @param inlen - Length of indata, if 0 sends no data - * @param outdata - A data block to receive the result of a command, if NULL receives no data - * @param outlen - Length of outdata, if 0 receives no data - * @return 0 on success, < 0 on error - */ -int sceIoDevctl(const char *dev, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen); - -#ifdef __cplusplus -} -#endif +#include <psp2kern/kernel/iofilemgr.h> #endif /* _PSP2_IO_DEVCTL_H_ */ - diff --git a/include/kernel/kernel/cpu.h b/include/kernel/kernel/cpu.h index 2a579c7..356383a 100644 --- a/include/kernel/kernel/cpu.h +++ b/include/kernel/kernel/cpu.h @@ -1,6 +1,7 @@ #ifndef _PSP2_KERNEL_CPU_H_ #define _PSP2_KERNEL_CPU_H_ +#include <psp2common/kernel/cpu.h> #include <psp2kern/types.h> #include <string.h> diff --git a/include/kernel/kernel/iofilemgr.h b/include/kernel/kernel/iofilemgr.h new file mode 100644 index 0000000..9c79314 --- /dev/null +++ b/include/kernel/kernel/iofilemgr.h @@ -0,0 +1,471 @@ +#ifndef _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_H_ +#define _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_H_ + +#include <psp2common/kernel/iofilemgr.h> +#include <psp2kern/kernel/iofilemgr/async.h> +#include <psp2kern/kernel/iofilemgr/stat.h> +#include <psp2kern/kernel/iofilemgr/dirent.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Remove directory entry + * + * @param filename - Path to the file to remove + * @return < 0 on error + */ +int sceIoRemove(const char *filename); + +/** + * Make a directory file + * + * @param dirname - The path to the directory + * @param mode - Access mode bits. + * @return Returns the value 0 if it's successful, otherwise <0 + */ +int sceIoMkdir(const char *dirname, SceIoMode mode); + +/** + * Remove a directory file + * + * @param dirname - Removes a directory file pointed by the string path + * @return Returns the value 0 if it's successful, otherwise <0 + */ +int sceIoRmdir(const char *dirname); + +/** + * Change the name of a file + * + * @param oldname - The old filename + * @param newname - The new filename + * @return < 0 on error. + */ +int sceIoRename(const char *oldname, const char *newname); + +/** + * Send a devctl command to a device. + * + * @par Example: Sending a simple command to a device + * @code + * SceIoDevInfo info; + * sceIoDevctl("ux0:", 0x3001, NULL, 0, &info, sizeof(SceIoDevInfo)); + * @endcode + * + * @param devname - String for the device to send the devctl to (e.g. "ux0:") + * @param cmd - The command to send to the device + * @param arg - A data block to send to the device, if NULL sends no data + * @param arglen - Length of indata, if 0 sends no data + * @param bufp - A data block to receive the result of a command, if NULL receives no data + * @param buflen - Length of outdata, if 0 receives no data + * @return 0 on success, < 0 on error + */ +int sceIoDevctl( + const char *devname, + int cmd, + const void *arg, + SceSize arglen, + void *bufp, + SceSize buflen); + +/** + * Synchronize the file data on the device. + * + * @param devname - The device to synchronize (e.g. msfat0:) + * @param flag - device specific flags + */ +int sceIoSync(const char *devname, int flag); + +/** + * Open or create a file for reading or writing + * + * @par Example1: Open a file for reading + * @code + * if((fd = sceIoOpen("device:/path/to/file", SCE_O_RDONLY, 0777) < 0) { + * // error code in fd, for example no open filehandle left (0x80010018) + * } + * @endcode + * @par Example2: Open a file for writing, creating it if it doesn't exist + * @code + * if((fd = sceIoOpen("device:/path/to/file", SCE_O_WRONLY|SCE_O_CREAT, 0777) < 0) { + * // error code in fd, for example no open filehandle left (0x80010018) + * } + * @endcode + * + * @param filename - Pointer to a string holding the name of the file to open + * @param flag - Libc styled flags that are or'ed together + * @param mode - File access mode (One or more ::SceIoMode). + * @return A non-negative integer is a valid fd, anything else an error + */ +SceUID sceIoOpen(const char *filename, int flag, SceIoMode mode); + +/** + * Delete a descriptor + * + * @code + * sceIoClose(fd); + * @endcode + * + * @param fd - File descriptor to close + * @return < 0 on error + */ +int sceIoClose(SceUID fd); + +/** + * Perform an ioctl on a device. + * + * @param fd - Opened file descriptor to ioctl to + * @param cmd - The command to send to the device + * @param argp - A data block to send to the device, if NULL sends no data + * @param arglen - Length of indata, if 0 sends no data + * @param bufp - A data block to receive the result of a command, if NULL receives no data + * @param buflen - Length of outdata, if 0 receives no data + * @return 0 on success, < 0 on error + */ +int sceIoIoctl( + SceUID fd, + int cmd, + const void *argp, + SceSize arglen, + void *bufp, + SceSize buflen); + +/** + * Reposition read/write file descriptor offset + * + * @par Example: + * @code + * pos = sceIoLseek(fd, -10, SCE_SEEK_END); + * @endcode + * + * @param fd - Opened file descriptor with which to seek + * @param offset - Relative offset from the start position given by whence + * @param whence - One of ::SceIoSeekMode. + * + * @return The position in the file after the seek. + */ +SceOff sceIoLseek(SceUID fd, SceOff offset, int whence); + +/** + * Read input + * + * @par Example: + * @code + * bytes_read = sceIoRead(fd, data, 100); + * @endcode + * + * @param fd - Opened file descriptor to read from + * @param buf - Pointer to the buffer where the read data will be placed + * @param nbyte - Size of the read in bytes + * + * @return The number of bytes read + */ +SceSSize sceIoRead(SceUID fd, void *buf, SceSize nbyte); + +/** + * Write output + * + * @par Example: + * @code + * bytes_written = sceIoWrite(fd, data, 100); + * @endcode + * + * @param fd - Opened file descriptor to write to + * @param buf - Pointer to the data to write + * @param nbyte - Size of data to write + * + * @return The number of bytes written + */ +SceSSize sceIoWrite(SceUID fd, const void *buf, SceSize nbyte); + +/** + * Read input at offset + * + * @par Example: + * @code + * bytes_read = sceIoPread(fd, data, 100, 0x1000); + * @endcode + * + * @param fd - Opened file descriptor to read from + * @param buf - Pointer to the buffer where the read data will be placed + * @param nbyte - Size of the read in bytes + * @param offset - Offset to read + * + * @return < 0 on error. + */ +SceSSize sceIoPread(SceUID fd, void *buf, SceSize nbyte, SceOff offset); + +/** + * Write output at offset + * + * @par Example: + * @code + * bytes_written = sceIoPwrite(fd, data, 100, 0x1000); + * @endcode + * + * @param fd - Opened file descriptor to write to + * @param buf - Pointer to the data to write + * @param nbyte - Size of data to write + * @param offset - Offset to write + * + * @return The number of bytes written + */ +SceSSize sceIoPwrite(SceUID fd, const void *buf, SceSize nbyte, SceOff offset); + +/** + * Synchronize the file data for one file + * + * @param fd - Opened file descriptor to sync + * @param flag - device specific flags + * + * @return < 0 on error. + */ +int sceIoSyncByFd(SceUID fd, int flag); + +/*--------------------Async IO--------------------*/ + +/** + * Remove directory entry (asynchronous) + * + * @param file - Path to the file to remove + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +int sceIoRemoveAsync(const char *file, SceIoAsyncParam* asyncParam); + +/** + * Change the name of a file (asynchronous) + * + * @param oldname - The old filename + * @param newname - The new filename + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoRenameAsync(const char *oldname, const char *newname, SceIoAsyncParam* asyncParam); + +/** + * Open or create a file for reading or writing (asynchronous) + * + * @param file - Pointer to a string holding the name of the file to open + * @param flags - Libc styled flags that are or'ed together + * @param mode - File access mode (One or more ::SceIoMode). + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoOpenAsync(const char *file, int flags, SceMode mode, SceIoAsyncParam* asyncParam); + +/** + * Delete a descriptor (asynchronous) + * + * @param fd - File descriptor to close + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoCloseAsync(SceUID fd, SceIoAsyncParam* asyncParam); + +/** + * Read input (asynchronous) + * + * @param fd - Opened file descriptor to read from + * @param data - Pointer to the buffer where the read data will be placed + * @param size - Size of the read in bytes + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoReadAsync(SceUID fd, void *data, SceSize size, SceIoAsyncParam* asyncParam); + +/** + * Read input at offset (asynchronous) + * + * @param fd - Opened file descriptor to read from + * @param data - Pointer to the buffer where the read data will be placed + * @param size - Size of the read in bytes + * @param offset - Offset to read + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoPreadAsync(SceUID fd, void *data, SceSize size, SceOff offset, SceIoAsyncParam* asyncParam); + +/** + * Write output (asynchronous) + * + * @param fd - Opened file descriptor to write to + * @param data - Pointer to the data to write + * @param size - Size of data to write + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoWriteAsync(SceUID fd, const void *data, SceSize size, SceIoAsyncParam* asyncParam); + +/** + * Write output at offset (asynchronous) + * + * @param fd - Opened file descriptor to write to + * @param data - Pointer to the data to write + * @param size - Size of data to write + * @param offset - Offset to write + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoPwriteAsync(SceUID fd, const void *data, SceSize size, SceOff offset, SceIoAsyncParam* asyncParam); + +/** + * Reposition read/write file descriptor offset (asynchronous) + * + * @param fd - Opened file descriptor with which to seek + * @param offset - Relative offset from the start position given by whence + * @param whence - One of ::SceIoSeekMode. + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoLseekAsync(SceUID fd, SceOff offset, int whence, SceIoAsyncParam* asyncParam); + +/** + * Synchronize device state with state of file or directory being opened + * + * @param fd - Opened file descriptor to sync + * @param fd - Device-dependent flag + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoSyncByFdAsync(SceUID fd, int flag, SceIoAsyncParam* asyncParam); + +/** + * Synchronize device state with memory state + * + * @param fd - Device name + * @param fd - Device-dependent flag + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoSyncAsync(const char* device, int flag, SceIoAsyncParam* asyncParam); + +/** + * This function is unimplemented. + * + * @return SCE_KERNEL_ERROR_UNSUP (0x80020004) + */ +int sceIoIoctlAsync( + SceUID fd, + int cmd, + const void *argp, + SceSize arglen, + void *bufp, + SceSize buflen, + SceIoAsyncParam* asyncParam); + +/** + * This function is unimplemented. + * + * @return SCE_KERNEL_ERROR_UNSUP (0x80020004) + */ +int sceIoDevctlAsync( + const char *devname, + int cmd, + const void *arg, + SceSize arglen, + void *bufp, + SceSize buflen, + SceIoAsyncParam* asyncParam); + +/*--------------------IO Priority--------------------*/ + +/*Valid priority values range: 1 (highest) - 15 (lowest). Default priority value is 14*/ + +/** + * Set IO operations priority for file descriptor for non-game application + * + * @param fd - File UID + * @param priority - IO operations priority + * + * @return < 0 on error. + */ +int sceIoSetPriorityForSystem(SceUID fd, int priority); + +/** + * Get IO operations priority for file descriptor for non-game application + * + * @param fd - File UID + * + * @return A non-negative integer is a valid priority, anything else an error + */ +int sceIoGetPriorityForSystem(SceUID fd); + +/** + * Set IO operations priority for caller process (will be default for all new IO operations) + * + * @param priority - New default IO operations priority + * + * @return < 0 on error. + */ +int sceIoSetProcessDefaultPriorityForSystem(int priority); + +/** + * Get IO operations priority for process + * + * @return A non-negative integer is a valid priority, anything else an error + */ +int sceIoGetProcessDefaultPriorityForSystem(void); + +/** + * Set IO operations priority for caller thread for non-game + * application (will be default for all new IO operations) + * + * @param priority - New default IO operations priority + * + * @return < 0 on error. + */ +int sceIoSetThreadDefaultPriorityForSystem(int priority); + +/** + * Get IO operations priority for thread for non-game application + * + * @return A non-negative integer is a valid priority, anything else an error + */ +int sceIoGetThreadDefaultPriorityForSystem(void); + +/*--------------------Device mount functions--------------------*/ + +/** + * Mounts a device + * + * @param[in] id Device to mount + * @param[in] path Where to mount to + * @param[in] permission Permission flags + * @param a4 Unknown, set to 0 + * @param a5 Unknown, set to 0 + * @param a6 Unknown, set to 0 + * + * @return < 0 on error. + */ +int sceIoMount(int id, const char *path, int permission, int a4, int a5, int a6); + +/** + * Unmounts a device + * + * @param[in] id Device to unmount + * @param[in] a2 Unknown, set to 0 + * @param[in] a3 Unknown, set to 0 + * @param[in] a4 Unknown, set to 0 + * + * @return < 0 on error. + */ +int sceIoUmount(int id, int a2, int a3, int a4); + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_H_ */ diff --git a/include/kernel/kernel/iofilemgr/async.h b/include/kernel/kernel/iofilemgr/async.h new file mode 100644 index 0000000..4584bb7 --- /dev/null +++ b/include/kernel/kernel/iofilemgr/async.h @@ -0,0 +1,93 @@ +#ifndef _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_ASYNC_H_ +#define _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_ASYNC_H_ + +#include <psp2common/kernel/iofilemgr/async.h> +#include <psp2kern/kernel/threadmgr.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Async IO operations are scheduled automatically, similar to FIOS2. + * You can make calls to sceIoOpenAsync(), sceIoReadAsync(), + * sceIoCloseAsync() right after each other, they will be put in a schedule + * and performed automatically. + * + * All async IO functions return UID of operation handle, not file descriptor UID. + */ + +/** + * Cancel an asynchronous operation. + * + * @param opHandle - The operation handle to perform cancel on. + * + * @return < 0 on error. If operation has been canceled(finished) already, returns 0x80010002 + */ +int sceIoCancel(SceUID opHandle); + +/** + * Complete an asynchronous operation. + * + * @param opHandle - The operation handle to complete. + * + * @return < 0 on error. + */ +int sceIoComplete(SceUID opHandle); + +/** + * Wait until asynchronous operation has been finished. + * + * @param opHandle - The operation handle to wait for. + * + * @return < 0 on error. + */ +inline +int sceIoWaitAsync(SceUID opHandle) +{ + int ret = sceKernelWaitEvent(opHandle, 1, NULL, NULL, NULL); + if (ret == 0) + return sceIoComplete(opHandle); + else + return ret; +} + +/** + * Wait until asynchronous operation has been finished with callbacks. + * + * @param opHandle - The operation handle to wait for. + * + * @return < 0 on error. + */ +inline +int sceIoWaitAsyncCB(SceUID opHandle) +{ + int ret = sceKernelWaitEventCB(opHandle, 1, NULL, NULL, NULL); + if (ret == 0) + return sceIoComplete(opHandle); + else + return ret; +} + +/** + * Poll asynchronous operation status. + * + * @param opHandle - The operation handle to poll status for. + * + * @return < 0 on error or if operation is not finished. + */ +inline +int sceIoPollAsync(SceUID opHandle) +{ + int ret = sceKernelPollEvent(opHandle, 1, NULL, NULL); + if (ret == 0) + return sceIoComplete(opHandle); + else + return ret; +} + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_ASYNC_H_ */ diff --git a/include/kernel/kernel/iofilemgr/dirent.h b/include/kernel/kernel/iofilemgr/dirent.h new file mode 100644 index 0000000..4bfc584 --- /dev/null +++ b/include/kernel/kernel/iofilemgr/dirent.h @@ -0,0 +1,82 @@ +#ifndef _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_DIRENT_H_ +#define _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_DIRENT_H_ + +#include <psp2common/kernel/iofilemgr/dirent.h> +#include <psp2kern/kernel/iofilemgr/async.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Open a directory + * + * @par Example: + * @code + * int dfd; + * dfd = sceIoDopen("device:/"); + * if(dfd >= 0) + * { Do something with the file descriptor } + * @endcode + * @param dirname - The directory to open for reading. + * @return If >= 0 then a valid file descriptor, otherwise a Sony error code. + */ +SceUID sceIoDopen(const char *dirname); + +/** + * Close an opened directory file descriptor + * + * @param fd - Already opened file descriptor (using ::sceIoDopen) + * @return < 0 on error + */ +int sceIoDclose(SceUID fd); + +/** + * Reads an entry from an opened file descriptor. + * + * @param fd - Already opened file descriptor (using ::sceIoDopen) + * @param buf - Pointer to a ::SceIoDirent structure to hold the file information + * + * @return Read status + * - 0 - No more directory entries left + * - > 0 - More directory entries to go + * - < 0 - Error + */ +int sceIoDread(SceUID fd, SceIoDirent *buf); + +/** + * Open a directory (asynchronous) + * + * @param dirname - The directory to open for reading. + * @param asyncParam - parameters related to async operation. + * + * @return If >= 0 then a valid op handle, otherwise a Sony error code. + */ +SceUID sceIoDopenAsync(const char *dirname, SceIoAsyncParam* asyncParam); + +/** + * Reads an entry from an opened file descriptor (asynchronous) + * + * @param fd - Already opened file descriptor (using ::sceIoDopen or ::sceIoDopenAsync) + * @param dir - Pointer to a ::SceIoDirent structure to hold the file information + * @param asyncParam - parameters related to async operation. + * + * @return If >= 0 then a valid op handle, otherwise a Sony error code. + */ +SceUID sceIoDreadAsync(SceUID fd, SceIoDirent *dir, SceIoAsyncParam* asyncParam); + +/** + * Close an opened directory file descriptor (asynchronous) + * + * @param fd - Already opened file descriptor (using ::sceIoDopen or ::sceIoDopenAsync) + * @param asyncParam - parameters related to async operation. + * + * @return If >= 0 then a valid op handle, otherwise a Sony error code. + */ +SceUID sceIoDcloseAsync(SceUID fd, SceIoAsyncParam* asyncParam); + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_DIRENT_H_ */ diff --git a/include/kernel/kernel/iofilemgr/stat.h b/include/kernel/kernel/iofilemgr/stat.h new file mode 100644 index 0000000..c9096e2 --- /dev/null +++ b/include/kernel/kernel/iofilemgr/stat.h @@ -0,0 +1,101 @@ +#ifndef _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_STAT_H_ +#define _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_STAT_H_ + +#include <psp2common/kernel/iofilemgr/stat.h> +#include <psp2kern/kernel/iofilemgr/async.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Change the status of a file. + * + * @param name - The path to the file. + * @param buf - A pointer to a ::SceIoStat structure. + * @param cbit - Bitmask defining which bits to change. + * + * @return < 0 on error. + */ +int sceIoChstat(const char *name, const SceIoStat *buf, unsigned int cbit); + +/** + * Get the status of a file. + * + * @param name - The path to the file. + * @param buf - A pointer to a ::SceIoStat structure. + * + * @return < 0 on error. + */ +int sceIoGetstat(const char *name, SceIoStat *buf); + +/** + * Get the status of a file descriptor. + * + * @param fd - The file descriptor. + * @param buf - A pointer to a ::SceIoStat structure. + * + * @return < 0 on error. + */ +int sceIoGetstatByFd(SceUID fd, SceIoStat *buf); + +/** + * Change the status of a file descriptor. + * + * @param fd - The file descriptor. + * @param buf - A pointer to an io_stat_t structure. + * @param cbit - Bitmask defining which bits to change. + * + * @return < 0 on error. + */ +int sceIoChstatByFd(SceUID fd, const SceIoStat *buf, unsigned int cbit); + +/** + * Make a directory file (asynchronous) + * + * @param dir - The path to the directory + * @param mode - Access mode (One or more ::SceIoAccessMode). + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoMkdirAsync(const char *dir, SceMode mode, SceIoAsyncParam* asyncParam); + +/** + * Remove a directory file (asynchronous) + * + * @param path - Removes a directory file pointed by the string path + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoRmdirAsync(const char *path, SceIoAsyncParam* asyncParam); + +/** + * Get the status of a file (asynchronous) + * + * @param file - The path to the file. + * @param stat - A pointer to a ::SceIoStat structure. + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoGetstatAsync(const char *file, SceIoStat *stat, SceIoAsyncParam* asyncParam); + +/** + * Change the status of a file (asynchronous) + * + * @param file - The path to the file. + * @param stat - A pointer to a ::SceIoStat structure. + * @param bits - Bitmask defining which bits to change. + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoChstatAsync(const char *file, SceIoStat *stat, int bits, SceIoAsyncParam* asyncParam); + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2KERN_KERNEL_IOFILEMGR_STAT_H_ */ diff --git a/include/kernel/kernel/processmgr.h b/include/kernel/kernel/processmgr.h index 6438113..b176644 100644 --- a/include/kernel/kernel/processmgr.h +++ b/include/kernel/kernel/processmgr.h @@ -7,6 +7,9 @@ extern "C" { #endif +/** UID of the kernel process */ +#define SCE_KERNEL_PROCESS_ID_KERNEL 0x10005 + typedef struct SceKernelProcessInfo { SceSize size; //!< size of this struct, make sure it's 0xE8 SceUID pid; //!< our process ID diff --git a/include/kernel/kernel/sysclib.h b/include/kernel/kernel/sysclib.h new file mode 100644 index 0000000..6efdb81 --- /dev/null +++ b/include/kernel/kernel/sysclib.h @@ -0,0 +1,25 @@ +#ifndef _DOLCESDK_PSP2KERN_KERNEL_SYSCLIB_H_ +#define _DOLCESDK_PSP2KERN_KERNEL_SYSCLIB_H_ + +#include <psp2/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Like memcmp but checks all n bytes of s1 and s2 without early return. + */ +int memcmp_consttime(const void *s1, const void *s2, size_t n); + +/** + * Like strncpy but puts 0 or 1 zero bytes after copying src to dest, + * rather than filling dest with zero bytes up to n. + */ +char *strncpy_fast(char *dest, const char *src, size_t n); + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2KERN_KERNEL_SYSCLIB_H_ */ diff --git a/include/kernel/kernel/sysmem.h b/include/kernel/kernel/sysmem.h index b2fc17f..70d6cc1 100644 --- a/include/kernel/kernel/sysmem.h +++ b/include/kernel/kernel/sysmem.h @@ -1,14 +1,14 @@ #ifndef _PSP2_KERNEL_SYSMEM_H_ #define _PSP2_KERNEL_SYSMEM_H_ -#include <psp2kern/types.h> #include <stdarg.h> +#include <psp2kern/kernel/types.h> #ifdef __cplusplus extern "C" { #endif -typedef enum SceKernelMemBlockType { +typedef enum _SceKernelMemBlockType { SCE_KERNEL_MEMBLOCK_TYPE_SHARED_RX = 0x0390D050, SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW = 0x09408060, SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE = 0x0C208060, @@ -19,7 +19,7 @@ typedef enum SceKernelMemBlockType { SCE_KERNEL_MEMBLOCK_TYPE_KERNEL_RX = 0x1020D005, SCE_KERNEL_MEMBLOCK_TYPE_KERNEL_RW = 0x1020D006, SCE_KERNEL_MEMBLOCK_TYPE_RW_UNK0 = 0x6020D006 -} SceKernelMemBlockType; +} _SceKernelMemBlockType; typedef enum SceKernelAllocMemBlockAttr { SCE_KERNEL_ALLOC_MEMBLOCK_ATTR_HAS_PADDR = 0x00000002U, @@ -426,6 +426,7 @@ int sceSysrootUseExternalStorage(void); int sceSysrootUseInternalStorage(void); +__attribute__((__format__(__printf__, 1, 2))) int sceDebugPrintf(const char *fmt, ...); typedef struct SceKernelDebugMessageContext { @@ -438,13 +439,19 @@ typedef struct SceKernelDebugMessageContext { } SceKernelDebugMessageContext; // msg_type_flag : 0 or 0xB - +__attribute__((__format__(__printf__, 3, 4))) int sceDebugPrintf2(int msg_type_flag, const SceKernelDebugMessageContext *ctx, const char *fmt, ...); - + +int sceDebugVprintf(const char *fmt, va_list args); + int sceDebugPrintKernelPanic(const SceKernelDebugMessageContext *ctx, void *some_address); + +__attribute__((__format__(__printf__, 3, 4))) int sceDebugPrintfKernelPanic(const SceKernelDebugMessageContext *ctx, void *some_address, const char *fmt, ...); int sceDebugPrintKernelAssertion(int condition, const SceKernelDebugMessageContext *ctx, void *some_address); + +__attribute__((__format__(__printf__, 5, 6))) int sceDebugPrintfKernelAssertion(int unk, int condition, const SceKernelDebugMessageContext *ctx, int some_address, const char *fmt, ...); int sceDebugSetHandlers(int (*func)(int unk, const char *format, const va_list args), void *args); diff --git a/include/kernel/kernel/threadmgr.h b/include/kernel/kernel/threadmgr.h index 3836f70..edd690b 100644 --- a/include/kernel/kernel/threadmgr.h +++ b/include/kernel/kernel/threadmgr.h @@ -1,29 +1,14 @@ #ifndef _PSP2_KERNEL_THREADMGR_H_ #define _PSP2_KERNEL_THREADMGR_H_ -#include <psp2kern/types.h> +#include <psp2common/kernel/threadmgr.h> #ifdef __cplusplus extern "C" { #endif -#define SCE_KERNEL_MUTEX_ATTR_RECURSIVE 2 - -/** 64-bit system clock type. */ -typedef SceUInt64 SceKernelSysClock; - /* Threads. */ -typedef int (* SceKernelThreadEntry)(SceSize args, void *argp); - -/** Additional options used when creating threads. */ -typedef struct SceKernelThreadOptParam { - /** Size of the ::SceKernelThreadOptParam structure. */ - SceSize size; - /** Attributes */ - SceUInt32 attr; -} SceKernelThreadOptParam; - /** Structure to hold the status information for a thread * @see sceKernelGetThreadInfo */ @@ -449,18 +434,61 @@ int sceKernelCancelMutex(SceUID mutexid, int newCount, int *numWaitThreads); */ int sceKernelGetMutexInfo(SceUID mutexid, SceKernelMutexInfo *info); -typedef struct SceKernelLwMutexWork { - SceInt64 data[4]; -} SceKernelLwMutexWork; +/* Fast mutex */ + +typedef struct SceKernelFastMutexWork { + SceInt64 data[8]; +} SceKernelFastMutexWork; + +typedef enum SceKernelFastMutexAttr { + SCE_KERNEL_FAST_MUTEX_ATTR_RECURSIVE = 0x00000002, + SCE_KERNEL_FAST_MUTEX_ATTR_CEILING = 0x00000004, + SCE_KERNEL_FAST_MUTEX_ATTR_UNK_3 = 0x00000008, + SCE_KERNEL_FAST_MUTEX_ATTR_TH_FIFO = 0x00000000, + SCE_KERNEL_FAST_MUTEX_ATTR_TH_PRIO = 0x00002000, + SCE_KERNEL_FAST_MUTEX_ATTR_UNK_15 = 0x00008000, + // All other flags are invalid +} SceKernelFastMutexAttr; -typedef struct SceKernelLwMutexOptParam { +typedef struct SceKernelFastMutexOptParam { SceSize size; -} SceKernelLwMutexOptParam; + SceInt32 ceilingPriority; +} SceKernelFastMutexOptParam; -int sceKernelInitializeFastMutex(void *mutex, const char *name, int unk0, int unk1); -int sceKernelLockFastMutex(void *mutex); -int sceKernelUnlockFastMutex(void *mutex); -int sceKernelDeleteFastMutex(void *mutex); +SceInt32 sceKernelInitializeFastMutex( + SceKernelFastMutexWork *pWork, + const char *pName, + SceKernelFastMutexAttr attr, + const SceKernelFastMutexOptParam *pOptParam); + +SceInt32 sceKernelLockFastMutex(SceKernelFastMutexWork *pWork); + +SceInt32 sceKernelTryLockFastMutex(SceKernelFastMutexWork *pWork); + +SceInt32 sceKernelUnlockFastMutex(SceKernelFastMutexWork *pWork); + +SceInt32 sceKernelFinalizeFastMutex(SceKernelFastMutexWork *pWork); + +typedef struct SceKernelFastMutexInfo { +// 0x00 + SceSize size; + SceUID uid; + char name[SCE_UID_NAMELEN + 1]; + SceKernelFastMutexAttr attr; + SceKernelFastMutexWork *pWork; +// 0x30 + SceInt32 currentCount; + SceUID currentOwnerId; + SceInt32 ceilingPriority; + SceInt32 unk3C; +// 0x40 + SceUInt32 numWaitThreads; +// 0x44 +} SceKernelFastMutexInfo; + +SceInt32 sceKernelGetFastMutexInfo(SceKernelFastMutexWork *pWork, SceKernelFastMutexInfo *pInfo); + +SceInt32 sceKernelGetFastMutexInfoById(SceUID uid, SceKernelFastMutexInfo *pInfo); /* Event flags. */ @@ -1033,6 +1061,29 @@ int sceKernelTryReceiveMsgPipeVector(SceUID uid, const MsgPipeRecvData *v, SceSi */ int sceKernelCancelMsgPipe(SceUID uid, int *psend, int *precv); +SceInt32 sceKernelWaitEvent( + SceUID eventId, + SceUInt32 waitPattern, + SceUInt32 *pResultPattern, + SceUInt64 *pUserData, + SceUInt32 *pTimeout +); + +SceInt32 sceKernelWaitEventCB( + SceUID eventId, + SceUInt32 waitPattern, + SceUInt32 *pResultPattern, + SceUInt64 *pUserData, + SceUInt32 *pTimeout +); + +SceInt32 sceKernelPollEvent( + SceUID eventId, + SceUInt32 bitPattern, + SceUInt32 *pResultPattern, + SceUInt64 *pUserData +); + #ifdef __cplusplus } #endif diff --git a/include/kernel/lowio/iftu.h b/include/kernel/lowio/iftu.h index 29b233f..a03d221 100644 --- a/include/kernel/lowio/iftu.h +++ b/include/kernel/lowio/iftu.h @@ -69,19 +69,19 @@ typedef struct SceIftuFrameBuf { typedef struct SceIftuPlaneState { SceIftuFrameBuf fb; - unsigned int unk20; - unsigned int src_x; /* In (0x10000 / 960) multiples */ - unsigned int src_y; /* in (0x10000 / 544) multiples */ - unsigned int src_w; /* in (0x10000 / 960) multiples */ - unsigned int src_h; /* in (0x10000 / 544) multiples */ - unsigned int dst_x; - unsigned int dst_y; - unsigned int dst_w; - unsigned int dst_h; - unsigned int vtop_padding; - unsigned int vbot_padding; /* h - aligned_h */ - unsigned int hleft_padding; - unsigned int hright_padding; /* w - aligned_w */ + unsigned int unk20; /* not observed to be non-zero */ + unsigned int unk24; /* not observed to be non-zero */ + unsigned int unk28; /* not observed to be non-zero */ + unsigned int src_w; /* inverse scaling factor in 16.16 fixed point, greater than or equal to 0.25 */ + unsigned int src_h; /* inverse scaling factor in 16.16 fixed point, greater than or equal to 0.25 */ + unsigned int dst_x; /* offset into the destination buffer */ + unsigned int dst_y; /* offset into the destination buffer */ + unsigned int src_x; /* offset into the source buffer in 8.8 fixed point, strictly less than 4.0 */ + unsigned int src_y; /* offset into the source buffer in 8.8 fixed point, strictly less than 4.0 */ + unsigned int crop_top; + unsigned int crop_bot; + unsigned int crop_left; + unsigned int crop_right; } SceIftuPlaneState; int sceIftuCsc(SceIftuFrameBuf *dst, SceIftuPlaneState *src, SceIftuConvParams *params); diff --git a/include/kernel/power.h b/include/kernel/power.h index 105535a..b56731b 100644 --- a/include/kernel/power.h +++ b/include/kernel/power.h @@ -246,6 +246,25 @@ int scePowerSetGpuClockFrequency(int freq); */ int scePowerSetGpuXbarClockFrequency(int freq); +/** + * Sets the time before idle callback is notified. + * + * @param callback_slot - Callback slot from 0 to 7. + * @param time - Time in microseconds. + * + * @return 0 on success, < 0 on error + */ +int scePowerSetIdleTimer(int callback_slot, SceUInt64 time); + +/** + * Sets the PS button hold time for showing the quick menu. + * + * @param time - Time in microseconds. + * + * @return 0 always + */ +int scePowerSetPsButtonPushTime(int time); + #ifdef __cplusplus } #endif diff --git a/include/kernel/sblacmgr.h b/include/kernel/sblacmgr.h index 99621dc..04a182c 100644 --- a/include/kernel/sblacmgr.h +++ b/include/kernel/sblacmgr.h @@ -8,6 +8,7 @@ extern "C" { #endif int sceSblACMgrIsShell(SceUID pid); +int sceSblACMgrIsPspEmu(SceUID pid); int sceSblACMgrIsGameProgram(SceUID pid); int sceSblACMgrIsNonGameProgram(SceUID pid); int sceSblACMgrIsDevelopmentMode(void); diff --git a/include/kernel/udcd.h b/include/kernel/udcd.h index f23024f..25d1e2a 100644 --- a/include/kernel/udcd.h +++ b/include/kernel/udcd.h @@ -2,7 +2,7 @@ #define _PSP2_KERNEL_UDCD_H_ #include <psp2kern/types.h> -#include <vitasdk/align.h> +#include <dolcesdk/align.h> #ifdef __cplusplus extern "C" { diff --git a/include/user/appmgr.h b/include/user/appmgr.h index e4ba75e..8333372 100644 --- a/include/user/appmgr.h +++ b/include/user/appmgr.h @@ -1,13 +1,15 @@ #ifndef _PSP2_APPMGR_H_ #define _PSP2_APPMGR_H_ -#include <psp2/types.h> -#include <psp2/apputil.h> +#include <psp2common/appmgr.h> +#include <psp2/scebase.h> #ifdef __cplusplus extern "C" { #endif +#define _SCE_APPMGR_VERSION (SCE_PSP2_SDK_VERSION & 0xffff0000) + typedef enum SceAppMgrErrorCode { SCE_APPMGR_ERROR_BUSY = 0x80802000, //!< Busy SCE_APPMGR_ERROR_STATE = 0x80802013, //!< Invalid state @@ -40,12 +42,6 @@ typedef enum SceAppMgrInfoBarTransparency { SCE_APPMGR_INFOBAR_TRANSPARENCY_TRANSLUCENT = 1 } SceAppMgrInfoBarTransparency; -typedef enum SceAppMgrApplicationMode { - SCE_APPMGR_APPLICATION_MODE_A = 2, //!< Application without physically contiguous memory access - SCE_APPMGR_APPLICATION_MODE_B = 3, //!< Application with physically contiguous memory access - SCE_APPMGR_APPLICATION_MODE_C = 4 //!< Application with physically contiguous memory and extra memory access -} SceAppMgrApplicationMode; - typedef struct SceAppMgrSystemEvent { int systemEvent; //!< One of ::SceAppMgrSystemEventType uint8_t reserved[60]; //!< Reserved data @@ -54,36 +50,36 @@ typedef struct SceAppMgrSystemEvent { typedef struct SceAppMgrSaveDataData { int size; //!< Must be 0x4C unsigned int slotId; //!< Save slot to use - SceAppUtilSaveDataSlotParam* slotParam; //!< Save slot params + SceAppMgrSaveDataSlotParam* slotParam; //!< Save slot params uint8_t reserved[32]; //!< Reserved data - SceAppUtilSaveDataFile* files; //!< Pointer to an array of files + SceAppMgrSaveDataDataSaveItem* files; //!< Pointer to an array of files int fileNum; //!< Number of files to save - SceAppUtilSaveDataMountPoint mountPoint; //!< Savedata mountpoint + SceAppMgrMountPoint mountPoint; //!< Savedata mountpoint unsigned int* requiredSizeKB; //!< Required size in KBs } SceAppMgrSaveDataData; typedef struct SceAppMgrSaveDataDataDelete { int size; //!< Must be 0x44 unsigned int slotId; //!< Save slot to use - SceAppUtilSaveDataSlotParam* slotParam; //!< Save slot params + SceAppMgrSaveDataSlotParam* slotParam; //!< Save slot params uint8_t reserved[32]; //!< Reserved data - SceAppUtilSaveDataFile* files; //!< Pointer to an array of files + SceAppMgrSaveDataDataSaveItem* files; //!< Pointer to an array of files int fileNum; //!< Number of files to delete - SceAppUtilSaveDataMountPoint mountPoint; //!< Savedata mountpoint + SceAppMgrMountPoint mountPoint; //!< Savedata mountpoint } SceAppMgrSaveDataDataDelete; typedef struct SceAppMgrSaveDataSlot { int size; //!< Must be 0x418 unsigned int slotId; //!< Save slot to use - SceAppUtilSaveDataSlotParam slotParam; //!< Save slot params + SceAppMgrSaveDataSlotParam slotParam; //!< Save slot params uint8_t reserved[116]; //!< Reserved data - SceAppUtilSaveDataMountPoint mountPoint; //!< Savedata mountpoint + SceAppMgrMountPoint mountPoint; //!< Savedata mountpoint } SceAppMgrSaveDataSlot; typedef struct SceAppMgrSaveDataSlotDelete { int size; //!< Must be 0x18 unsigned int slotId; //!< Save slot to use - SceAppUtilSaveDataMountPoint mountPoint; //!< Savedata mountpoint + SceAppMgrMountPoint mountPoint; //!< Savedata mountpoint } SceAppMgrSaveDataSlotDelete; typedef struct SceAppMgrAppState { @@ -93,25 +89,6 @@ typedef struct SceAppMgrAppState { SceUInt8 reserved[116]; } SceAppMgrAppState; -typedef struct SceAppMgrBudgetInfo { - int size; //!< Must be 0x88 - int app_mode; //!< One of ::SceAppMgrApplicationMode - int unk0; //!< Unknown Data - unsigned int total_user_rw_mem; //!< Total amount of accessible USER_RW memory - unsigned int free_user_rw; //!< Free amount of accessible USER_RW memory - SceBool extra_mem_allowed; //!< Flag for extra memory accessibility - int unk1; //!< Unknown Data - unsigned int total_extra_mem; //!< Total amount of accessible extra memory - unsigned int free_extra_mem; //!< Free amount of accessible extra memory - int unk2[2]; //!< Unknown Data - unsigned int total_phycont_mem; //!< Total amount of accessible physically contiguous memory - unsigned int free_phycont_mem; //!< Free amount of accessible physically contiguous memory - int unk3[10]; //!< Unknown Data - unsigned int total_cdram_mem; //!< Total amount of accessible CDRAM memory - unsigned int free_cdram_mem; //!< Free amount of accessible CDRAM memory - int reserved[9]; //!< Reserved data -} SceAppMgrBudgetInfo; - typedef struct SceAppMgrExecOptParam SceAppMgrExecOptParam; // Missing struct typedef struct SceAppMgrLaunchAppOptParam SceAppMgrLaunchAppOptParam; // Missing struct @@ -121,6 +98,38 @@ typedef struct sceAppMgrLoadExecOptParam { #define SCE_APPMGR_MAX_APP_NAME_LENGTH (31) +#define SCE_APPMGR_BUDGET_MODE_MAIN 2 // Main LPDDR2 only +#define SCE_APPMGR_BUDGET_MODE_MAIN_PHYCONT 3 // Main and phycont or CDLG which is also contiguous +#define SCE_APPMGR_BUDGET_MODE_MAIN_PHYCONT_CDLG 4 // Main and phycont and CDLG + +typedef struct SceAppMgrBudgetInfo { +// 0x00 + SceSize size; //!< Sizes if 0x88 bytes + SceUInt32 mode; //!< Application budget mode + SceUInt32 unk_8; + SceUInt32 budgetMain; //!< Main LPDDR2 budget in bytes +// 0x10 + SceUInt32 freeMain; //!< Free main LPDDR2 in bytes + SceUInt32 hasCdlg; //!< Has CDLG memory type in budget + SceUInt32 unk_14; //!< Non-zero if CDLG is used, otherwise 0 + SceUInt32 budgetCdlg; //!< CDLG budget in bytes +// 0x20 + SceUInt32 freeCdlg; //!< Free CDLG in bytes + SceUInt32 unk_24; //!< always 0 + SceUInt32 unk_28; //!< Non-zero if phycont is used, otherwise 0 + SceUInt32 budgetPhycont; //!< Phycont budget in bytes +// 0x30 + SceUInt32 freePhycont; //!< Free phycont in bytes + SceUInt32 allow; //!< Some memory type? + SceUChar8 unk_38[0x20]; //!< Some memory type? + SceUInt32 unk_58; + SceUInt32 budgetCdram; //!< Cdram budget in bytes +// 0x60 + SceUInt32 freeCdram; //!< Free Cdram in bytes + SceUChar8 reserved_64[0x24]; +// 0x88 +} SceAppMgrBudgetInfo; + /** * Save data on savedata0: partition * @@ -245,7 +254,7 @@ int sceAppMgrGetRunningAppIdListForShell(SceUID *appIds, int count); * @param[out] appState - State of the application * @param[in] len - sizeof(SceAppMgrState) * @param[in] version - Version (?) - + * @return 0 on success, < 0 on error. */ int _sceAppMgrGetAppState(SceAppMgrAppState *appState, SceSize len, uint32_t version); @@ -254,7 +263,7 @@ int _sceAppMgrGetAppState(SceAppMgrAppState *appState, SceSize len, uint32_t ver * Receive system event * * @param[out] systemEvent - Received system event - + * @return 0 on success, < 0 on error. */ int sceAppMgrReceiveSystemEvent(SceAppMgrSystemEvent *systemEvent); @@ -493,7 +502,7 @@ int sceAppMgrConvertVs0UserDrivePath(char *path, char *mount_point, int unk); int sceAppMgrGetRawPath(char *path, char *mount_point, char *unk); /** - * Resolve a path to the corresponding true path (uses ::sceFiosKernelOverlayResolveSync underneath). + * Resolve a path to the corresponding true path (uses ::sceFiosKernelOverlayResolveSync underneath). * * @param[in] path - Path to convert (e.g. app0:) * @param[out] resolved_path - True resolved path @@ -502,28 +511,46 @@ int sceAppMgrGetRawPath(char *path, char *mount_point, char *unk); * @return 0 on success, < 0 on error. */ int _sceAppMgrGetRawPath(char *path, char *resolved_path, int resolved_path_size, char unk[16]); - + /** * Get the real/resolved path of app0: (where it's actually mounted) - * + * * @param[in] appId - Use -2 for the current application * @param[out] resolved_path - Buffer that will hold the resolved path. It should have enough room to hold 292 characters or it will buffer overflow (noname120). - * + * * @return 0 on success. */ int _sceAppMgrGetRawPathOfApp0ByAppIdForShell(int appId, char resolved_path[292]); /** - * Get memory budget info for a running system application + * Get application memory budget info. * - * @param[out] info - Info related to the memory budget of the running application. - * * @return 0 on success, < 0 on error. * - * @note This function will always return an error if used in a normal application. */ int sceAppMgrGetBudgetInfo(SceAppMgrBudgetInfo *info); +/** + * Shared Framebuffer + */ + +typedef struct SceSharedFbInfo SceSharedFbInfo; + +SceUID _sceSharedFbOpen(int index, SceUInt32 buildVersion); + +static __inline__ +SceUID sceSharedFbOpen(int index) { + return _sceSharedFbOpen(index, SCE_PSP2_SDK_VERSION); +} + +int sceSharedFbClose(SceUID fbId); + +int sceSharedFbBegin(SceUID fbId, SceSharedFbInfo *fbInfo); + +int sceSharedFbEnd(SceUID fbId); + +int sceSharedFbGetInfo(SceUID fbId, SceSharedFbInfo *fbInfo); + #ifdef __cplusplus } #endif diff --git a/include/user/avconfig.h b/include/user/avconfig.h index bef9ba4..7d28bd6 100644 --- a/include/user/avconfig.h +++ b/include/user/avconfig.h @@ -7,11 +7,39 @@ extern "C" { #endif -/** Color Space Mode values to specify to ::sceAVConfigSetDisplayColorSpaceMode */ -typedef enum SceAVConfigColorSpaceMode { - SCE_AVCONFIG_COLOR_SPACE_MODE_DEFAULT = 0, //!< Default - SCE_AVCONFIG_COLOR_SPACE_MODE_HIGH_CONTRAST = 1 //!< High Contrast Mode -} SceAVConfigColorSpaceMode; +#define SCE_AVCONFIG_VOLUME_MAX 30 +#define SCE_AVCONFIG_VOLUME_AVLS_MAX 21 + +#define SCE_AVCONFIG_VOLCTRL_UNK_0 0 +#define SCE_AVCONFIG_VOLCTRL_ONBOARD 1 +#define SCE_AVCONFIG_VOLCTRL_BLUETOOTH 2 +#define SCE_AVCONFIG_VOLCTRL_UNK_3 3 +#define SCE_AVCONFIG_VOLCTRL_UNK_4 4 + +#define SCE_AVCONFIG_AUDIO_DEVICE_VITA_0 0x001 //!< Not Dolce +#define SCE_AVCONFIG_AUDIO_DEVICE_MULTI_CN 0x002 //!< (sceSysconGetMultiCnInfo & 0xff00) == 0x300 (from SceHpremoteForDriver_2229EF51) +#define SCE_AVCONFIG_AUDIO_DEVICE_AUDIO_OUT 0x004 //!< 3.5mm audio out +#define SCE_AVCONFIG_AUDIO_DEVICE_HDMI 0x008 //!< HDMI audio out +#define SCE_AVCONFIG_AUDIO_DEVICE_BT_AUDIO_OUT 0x010 //!< Bluetooth audio out +#define SCE_AVCONFIG_AUDIO_DEVICE_VITA_8 0x100 //!< Not Dolce +#define SCE_AVCONFIG_AUDIO_DEVICE_AUDIO_IN 0x400 //!< 3.5mm audio in +#define SCE_AVCONFIG_AUDIO_DEVICE_BT_AUDIO_IN 0x800 //!< Bluetooth audio in + +#define SCE_AVCONFIG_REG_BT_MIC 0 +#define SCE_AVCONFIG_REG_AVLS 1 +#define SCE_AVCONFIG_REG_SOUND_OUTPUT 2 +#define SCE_AVCONFIG_REG_AVLS_TIMER 3 +#define SCE_AVCONFIG_REG_SPEAKER_MUTE 4 + +#define SCE_AVCONFIG_VOLKEY_END 0 +#define SCE_AVCONFIG_VOLKEY_UP 1 +#define SCE_AVCONFIG_VOLKEY_DOWN 2 + +#define SCE_AVCONFIG_CB_FLAG_UNK_1 0x01 +#define SCE_AVCONFIG_CB_FLAG_BT_VOL 0x02 +#define SCE_AVCONFIG_CB_FLAG_AVLS 0x04 +#define SCE_AVCONFIG_CB_FLAG_FORCE_AVLS 0x08 +#define SCE_AVCONFIG_CB_FLAG_MUTED 0x10 /** * Get the maximum brightness. @@ -65,17 +93,74 @@ int sceAVConfigSetSystemVol(int volume); * */ int sceAVConfigMuteOn(void); - + /** - * Sets the color space mode on runtime. + * Write to the registry key /CONFIG/SOUND/main_volume. * - * @param[in] csm - see ::SceAVConfigColorSpaceMode() + * @param vol - Volume level 0 to 30 * * @return 0 on success, < 0 on error. - * @note - This does not change color_space_mode in the registry. */ -int sceAVConfigSetDisplayColorSpaceMode(int csm); +int sceAVConfigWriteRegSystemVol(SceUInt32 vol); +/** + * Get volume control information. + * + * @param[out] volCtrl - Device which has volume controlled. If the volume + * cannot be controlled, then this address is not written to. + * @param[out] muted - Deviced muted state + * @param[out] avls - Device AVLS state + * + * @return 0 on success, < 0 on error. + */ +int sceAVConfigGetVolCtrlEnable(SceUInt32 *volCtrl, SceBool *muted, SceBool *avls); + +/** + * Get connected audio devices. + * + * @param[out] flags - Bitwise OR of device flags + * + * @return 0 on success, < 0 on error. + */ +int sceAVConfigGetConnectedAudioDevice(SceUInt32 *flags); + +/** + * Set configuration values which correspond to registry entries. Does not change the registry. + * + * @param key - Registry derived value to change + * @param value - Value to set to + * + * @return 0 on success, < 0 on error. + */ +int sceAVConfigChangeReg(SceUInt32 key, int value); + +/** + * Send Bluetooth volume key + * + * @param key - Key to send + * + * @return 0 on success, < 0 on error. + */ +int sceAVConfigSendVolKey(SceUInt32 key); + +/** + * Get Bluetooth volume information + * + * @param[out] unk - Unknown + * @param[out] vol - Volume + * + * @return 0 on success, < 0 on error. + */ +int sceAVConfigGetBtVol(int *unk, SceUInt32 *vol); + +/** + * Set OLED/LCD colour space mode + * + * @param mode - 0 default, 1 high saturation + * + * @return 0 on success, < 0 on error. + */ +int sceAVConfigSetDisplayColorSpaceMode(SceUInt32 mode); #ifdef __cplusplus } diff --git a/include/user/bgapputil.h b/include/user/bgapputil.h new file mode 100644 index 0000000..f35e9ad --- /dev/null +++ b/include/user/bgapputil.h @@ -0,0 +1,26 @@ +#ifndef _DOLCESDK_PSP2_BGAPPUTIL_H_ +#define _DOLCESDK_PSP2_BGAPPUTIL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Errors + */ +#define SCE_BGAPPUTIL_ERROR_INVALID_ARG 0x80106501 + +/** + * Start BG application (eboot2.bin) + * + * @param[in] mode - must be 0 + * + * @return 0 on success, <0 otherwise. + */ +int sceBgAppUtilStartBgApp(int mode); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _DOLCESDK_PSP2_BGAPPUTIL_H_ */ diff --git a/include/user/compat.h b/include/user/compat.h index 8957138..8112c46 100644 --- a/include/user/compat.h +++ b/include/user/compat.h @@ -1,7 +1,7 @@ #ifndef _PSP2_COMPAT_H_ #define _PSP2_COMPAT_H_ -#include <psp2/io/devctl.h> +#include <psp2/kernel/iofilemgr.h> #include <psp2/rtc.h> #include <psp2/types.h> #include <stdint.h> diff --git a/include/user/gxm/internal.h b/include/user/gxm/internal.h new file mode 100644 index 0000000..c3cfc5b --- /dev/null +++ b/include/user/gxm/internal.h @@ -0,0 +1,36 @@ +#ifndef _DOLCESDK_PSP2_GXM_INTERNAL_H_ +#define _DOLCESDK_PSP2_GXM_INTERNAL_H_ + +#include <stdbool.h> +#include <psp2/types.h> +#include <psp2/gxm/constants.h> +#include <psp2/gxm/errors.h> +#include <psp2/gxm/structs.h> + +#ifdef __cplusplus +extern "C" { +#endif + +SceGxmErrorCode sceGxmInternalMapVertexUsseMemory(void *base, uint32_t size, uint32_t *offset); + +SceGxmErrorCode sceGxmInternalUnmapVertexUsseMemory(void *base); + +SceGxmErrorCode sceGxmInternalMapFragmentUsseMemory(void *base, uint32_t size, uint32_t *offset); + +SceGxmErrorCode sceGxmInternalUnmapFragmentUsseMemory(void *base); + +SceGxmErrorCode sceGxmInternalGetRenderTargetMemSize( + const SceGxmRenderTargetParams *params, + uint32_t* driverMemSize); + +SceGxmErrorCode sceGxmInternalCreateRenderTarget( + const SceGxmRenderTargetParams *params, + SceGxmRenderTarget **renderTarget); + +SceBool sceGxmInternalIsInitialized(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2_GXM_INTERNAL_H_ */ diff --git a/include/user/incoming_dialog.h b/include/user/incoming_dialog.h new file mode 100644 index 0000000..616b89e --- /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_INCOMING_DIALOG_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 sceIncomingDialogInit(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); + +/** + * Terminate incoming dialog library + */ +SceInt32 sceIncomingDialogTerm(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/ini_file_processor.h b/include/user/ini_file_processor.h new file mode 100644 index 0000000..77ee0b1 --- /dev/null +++ b/include/user/ini_file_processor.h @@ -0,0 +1,198 @@ +#ifndef _DOLCESDK_PSP2_INI_FILE_PROCESSOR_H_ +#define _DOLCESDK_PSP2_INI_FILE_PROCESSOR_H_ + +#define SCE_INI_FILE_PROCESSOR_ERROR_MODE 0x80840002 +#define SCE_INI_FILE_PROCESSOR_ERROR_EOF 0x80840005 +#define SCE_INI_FILE_PROCESSOR_ERROR_READ_ONLY 0x80840007 +#define SCE_INI_FILE_PROCESSOR_ERROR_FILE_NOT_FOUND 0x80840009 +#define SCE_INI_FILE_PROCESSOR_ERROR_KEY_NOT_FOUND 0x80840010 + +#define SCE_INI_FILE_PROCESSOR_PARSE_COMPLETED 0x00840001 + +#ifdef __cplusplus + +#include <cstddef> + +namespace sce { +namespace Ini { + +class MemAllocator { +public: + typedef void* Allocator(size_t size); + typedef void Deallocator(void* ptr); + + Allocator* allocate; + Deallocator* deallocate; +}; + +class InitParameter { +public: + InitParameter(); + + int unk_0x0; // size or mode? usually 0, seen: 0x1000, 0x2000 + int unk_0x4; // size or mode? usually 0, seen: 0x1000, 0x2000 + MemAllocator* allocator; // can be NULL + int unk_0xc; +}; + +class IniFileProcessor { +public: + IniFileProcessor(); + virtual ~IniFileProcessor(); + + /** + * Initialize INI file processor to work with file + * + * @param[in] param - ::InitParameter + * + * @return 0 on success, < 0 on error. + */ + int initialize(const InitParameter* param); + + /** + * Terminate INI file processor + * + * @return 0 on success, < 0 on error. + */ + int terminate(); + + /** + * Terminate INI file processor when file could not be opened + * + * @return 0 on success, < 0 on error. + */ + int terminateForError(); + + /** + * Get INI as a char array + * + * @param[out] ini - memory where INI data is stored + * @param[out] size - size of the INI data + * + * @return 0 on success, < 0 on error. + */ + int serialize(const char** ini, size_t* size); + + /** + * Process INI as a char array + * + * @param[in] ini - memory where INI data is stored + * @param[in] size - size of the INI data + * + * @return 0 on success, < 0 on error. + */ + int deserialize(const char* ini, size_t size); + + /** + * Open INI file + * + * @param[in] path - path to the INI file to open + * @param[in] mode - file open mode + * @param[in] unk - unknown, set to 0 + * + * @return 0 on success, < 0 on error. + */ + int openFile(const char* path, const char* mode, int unk); + + /** + * Create new INI file and open it. If file is already present, it will be overwritten + * + * @param[in] path - path to the INI file to open + * @param[in] mode - file open mode + * @param[in] unk - unknown, set to 0 + * + * @return 0 on success, < 0 on error. + * + */ + int createFile(const char* path, const char* mode, int unk); + + /** + * Close file + * + * @return 0 on success, < 0 on error. + */ + int closeFile(); + + /** + * Clean temp files + * + * @return 0 on success, < 0 on error. + */ + int cleanup(); + + /** + * Get total number of keys in the opened INI file + * + * @return toatal number of keys, < 0 on error. + */ + int size(); + + /** + * Add key and set value for it + * + * @param[in] key - key string + * @param[in] value - value string + * + * @return 0 on success, < 0 on error. + */ + int add(const char* key, const char* value); + + /** + * Delete key and corresponding value from INI file + * + * @param[in] key - key string + * + * @return 0 on success, < 0 on error. + */ + int del(const char* key); + + /** + * Set value corresponding to set key + * + * @param[in] key - key string + * @param[in] value - value string + * + * @return 0 on success, < 0 on error. + */ + int set(const char* key, const char* value); + + /** + * Find value corresponding to set key + * + * @param[in] key - key string + * @param[out] val - buffer to store value string if found + * @param[in] size - size of outValueBuf + * + * @return 0 on success, < 0 on error. + */ + int get(const char* key, char* val, size_t size); + + /** + * Parse key and corresponding value, one key per call until eof + * + * @param[out] key - buffer to store key string + * @param[out] val - buffer to store value string + * @param[in] size - size of output buffers + * + * @return 0 on success, < 0 on error. + * + */ + int parse(char* key, char* val, size_t size); + + /** + * Reset parser to the beginning of the file + * + * @return 0 on success, < 0 on error. + */ + int reset(); + +private: + void *context; +}; + +} // namespace Ini +} // namespace sce + +#endif // __cplusplus + +#endif // _DOLCESDK_PSP2_INI_FILE_PROCESSOR_H_ diff --git a/include/user/io/devctl.h b/include/user/io/devctl.h index ec1d726..211fdfe 100644 --- a/include/user/io/devctl.h +++ b/include/user/io/devctl.h @@ -1,67 +1,8 @@ #ifndef _PSP2_IO_DEVCTL_H_ #define _PSP2_IO_DEVCTL_H_ -#include <psp2/types.h> +#pragma message "psp2/io/devctl.h is deprecated. Please include psp2/kernel/iofilemgr.h." -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct SceIoDevInfo { - SceOff max_size; - SceOff free_size; - SceSize cluster_size; - void *unk; -} SceIoDevInfo; - -/** - * Send a devctl command to a device. - * - * @par Example: Sending a simple command to a device - * @code - * SceIoDevInfo info; - * sceIoDevctl("ux0:", 0x3001, NULL, 0, &info, sizeof(SceIoDevInfo)); - * @endcode - * - * @param dev - String for the device to send the devctl to (e.g. "ux0:") - * @param cmd - The command to send to the device - * @param indata - A data block to send to the device, if NULL sends no data - * @param inlen - Length of indata, if 0 sends no data - * @param outdata - A data block to receive the result of a command, if NULL receives no data - * @param outlen - Length of outdata, if 0 receives no data - * @return 0 on success, < 0 on error - */ -int sceIoDevctl(const char *dev, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen); - -/** - * Perform an ioctl on a device. - * - * @param fd - Opened file descriptor to ioctl to - * @param cmd - The command to send to the device - * @param indata - A data block to send to the device, if NULL sends no data - * @param inlen - Length of indata, if 0 sends no data - * @param outdata - A data block to receive the result of a command, if NULL receives no data - * @param outlen - Length of outdata, if 0 receives no data - * @return 0 on success, < 0 on error - */ -int sceIoIoctl(SceUID fd, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen); - -/** - * Perform an ioctl on a device. (asynchronous) - * - * @param fd - Opened file descriptor to ioctl to - * @param cmd - The command to send to the device - * @param indata - A data block to send to the device, if NULL sends no data - * @param inlen - Length of indata, if 0 sends no data - * @param outdata - A data block to receive the result of a command, if NULL receives no data - * @param outlen - Length of outdata, if 0 receives no data - * @return 0 on success, < 0 on error - */ -int sceIoIoctlAsync(SceUID fd, unsigned int cmd, void *indata, int inlen, void *outdata, int outlen); - -#ifdef __cplusplus -} -#endif +#include <psp2/kernel/iofilemgr.h> #endif /* _PSP2_IO_DEVCTL_H_ */ - diff --git a/include/user/jpegarm.h b/include/user/jpegarm.h new file mode 100644 index 0000000..6a5f5c7 --- /dev/null +++ b/include/user/jpegarm.h @@ -0,0 +1,103 @@ +#ifndef _DOLCESDK_PSP2_JPEGARM_H_ +#define _DOLCESDK_PSP2_JPEGARM_H_ + +#include <psp2/types.h> +#include <psp2/jpeg.h> + +#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) +extern "C" { +#endif + +/* Error codes */ +#define SCE_JPEG_ARM_OK (SCE_JPEG_OK) + +#define SCE_JPEG_ARM_ERROR_IMAGE_EMPTY (SCE_JPEG_ERROR_IMAGE_EMPTY | 0x100) +#define SCE_JPEG_ARM_ERROR_BAD_MARKER_LENGTH (SCE_JPEG_ERROR_BAD_MARKER_LENGTH | 0x100) +#define SCE_JPEG_ARM_ERROR_BAD_DHT_COUNTS (SCE_JPEG_ERROR_BAD_DHT_COUNTS | 0x100) +#define SCE_JPEG_ARM_ERROR_BAD_DHT_INDEX (SCE_JPEG_ERROR_BAD_DHT_INDEX | 0x100) +#define SCE_JPEG_ARM_ERROR_BAD_DQT_INDEX (SCE_JPEG_ERROR_BAD_DQT_INDEX | 0x100) +#define SCE_JPEG_ARM_ERROR_DECODE_ERROR (SCE_JPEG_ERROR_DECODE_ERROR | 0x100) +#define SCE_JPEG_ARM_ERROR_INVALID_POINTER (SCE_JPEG_ERROR_INVALID_POINTER | 0x100) +#define SCE_JPEG_ARM_ERROR_BAD_COMPONENT_ID (SCE_JPEG_ERROR_BAD_COMPONENT_ID | 0x100) +#define SCE_JPEG_ARM_ERROR_UNSUPPORT_COLORSPACE (SCE_JPEG_ERROR_UNSUPPORT_COLORSPACE | 0x100) +#define SCE_JPEG_ARM_ERROR_BAD_MCU_SIZE (SCE_JPEG_ERROR_BAD_MCU_SIZE | 0x100) +#define SCE_JPEG_ARM_ERROR_BAD_PRECISION (SCE_JPEG_ERROR_BAD_PRECISION | 0x100) +#define SCE_JPEG_ARM_ERROR_UNSUPPORT_SAMPLING (SCE_JPEG_ERROR_UNSUPPORT_SAMPLING | 0x100) +#define SCE_JPEG_ARM_ERROR_COMPONENT_COUNT (SCE_JPEG_ERROR_COMPONENT_COUNT | 0x100) +#define SCE_JPEG_ARM_ERROR_EOI_EXPECTED (SCE_JPEG_ERROR_EOI_EXPECTED | 0x100) +#define SCE_JPEG_ARM_ERROR_UNSUPPORT_IMAGE_SIZE (SCE_JPEG_ERROR_UNSUPPORT_IMAGE_SIZE | 0x100) +#define SCE_JPEG_ARM_ERROR_NO_HUFF_TABLE (SCE_JPEG_ERROR_NO_HUFF_TABLE | 0x100) +#define SCE_JPEG_ARM_ERROR_NO_QUANT_TABLE (SCE_JPEG_ERROR_NO_QUANT_TABLE | 0x100) +#define SCE_JPEG_ARM_ERROR_NO_SOI (SCE_JPEG_ERROR_NO_SOI | 0x100) +#define SCE_JPEG_ARM_ERROR_BAD_DHT_MARKER (SCE_JPEG_ERROR_BAD_DHT_MARKER | 0x100) +#define SCE_JPEG_ARM_ERROR_BAD_DRI_MARKER (SCE_JPEG_ERROR_BAD_DRI_MARKER | 0x100) +#define SCE_JPEG_ARM_ERROR_BAD_SOF_MARKER (SCE_JPEG_ERROR_BAD_SOF_MARKER | 0x100) +#define SCE_JPEG_ARM_ERROR_BAD_SOS_MARKER (SCE_JPEG_ERROR_BAD_SOS_MARKER | 0x100) +#define SCE_JPEG_ARM_ERROR_SOF_DUPLICATE (SCE_JPEG_ERROR_SOF_DUPLICATE | 0x100) +#define SCE_JPEG_ARM_ERROR_NO_LOSSLESS_SUPPORT (SCE_JPEG_ERROR_NO_LOSSLESS_SUPPORT | 0x100) +#define SCE_JPEG_ARM_ERROR_NO_ARITH_SUPPORT (SCE_JPEG_ERROR_NO_ARITH_SUPPORT | 0x100) +#define SCE_JPEG_ARM_ERROR_UNKNOWN_MARKER (SCE_JPEG_ERROR_UNKNOWN_MARKER | 0x100) +#define SCE_JPEG_ARM_ERROR_BAD_RESTART_MARKER (SCE_JPEG_ERROR_BAD_RESTART_MARKER | 0x100) +#define SCE_JPEG_ARM_ERROR_UNEXPECTED_MARKER (SCE_JPEG_ERROR_UNEXPECTED_MARKER | 0x100) +#define SCE_JPEG_ARM_ERROR_INVALID_REGION (SCE_JPEG_ERROR_INVALID_REGION | 0x100) +#define SCE_JPEG_ARM_ERROR_INVALID_STATE (SCE_JPEG_ERROR_INVALID_STATE | 0x100) +#define SCE_JPEG_ARM_ERROR_CANNOT_CONTINUE (SCE_JPEG_ERROR_CANNOT_CONTINUE | 0x100) +#define SCE_JPEG_ARM_ERROR_MEMORY_SIZE (SCE_JPEG_ERROR_MEMORY_SIZE | 0x100) +#define SCE_JPEG_ARM_ERROR_INVALID_COLOR_FORMAT (SCE_JPEG_ERROR_INVALID_COLOR_FORMAT | 0x100) +#define SCE_JPEG_ARM_ERROR_INVALID_DECODE_MODE (SCE_JPEG_ERROR_INVALID_DECODE_MODE | 0x100) +#define SCE_JPEG_ARM_ERROR_BAD_PROGRESSIVE_PARAM (SCE_JPEG_ERROR_BAD_PROGRESSIVE_PARAM | 0x100) +#define SCE_JPEG_ARM_ERROR_INIT_DONE (SCE_JPEG_ERROR_INIT_DONE | 0x100) +#define SCE_JPEG_ARM_ERROR_INPUT_SUSPENDED (SCE_JPEG_ERROR_INPUT_SUSPENDED | 0x100) +#define SCE_JPEG_ARM_ERROR_INPUT_DATA_TOO_BIG (SCE_JPEG_ERROR_INPUT_DATA_TOO_BIG | 0x100) +#define SCE_JPEG_ARM_ERROR_INVALID_DATA_SIZE (SCE_JPEG_ERROR_INVALID_DATA_SIZE | 0x100) + +/* for backward compatibility */ +#define SCE_JPEG_ARM_ERROR_UNSUPPORT_DOWNSCALE (SCE_JPEG_ARM_ERROR_INVALID_DECODE_MODE) +#define SCE_JPEG_ARM_ERROR_OUT_OF_MEMORY (SCE_JPEG_ARM_ERROR_MEMORY_SIZE) + +/* Decode JPEG data to RGBA format */ +int sceJpegArmDecodeMJpeg( + const unsigned char *pJpeg, + SceSize isize, + void *pRGBA, + SceSize osize, + int decodeMode, + void *pCoefBuffer, + SceSize coefBufferSize); + +/* Decode JPEG data (no color conversion) */ +int sceJpegArmDecodeMJpegYCbCr( + const unsigned char *pJpeg, + SceSize isize, + unsigned char *pYCbCr, + SceSize osize, + int decodeMode, + void *pCoefBuffer, + SceSize coefBufferSize); + +/* tempBufferSize is always 0, even when using colour space conversion */ +typedef SceJpegOutputInfo SceJpegArmOutputInfo; + +/* Return color space and each buffer sizes required when decoding a JPEG image */ +int sceJpegArmGetOutputInfo( + const unsigned char *pJpeg, + SceSize isize, + int outputFormat, + int decodeMode, + SceJpegArmOutputInfo *pOutputInfo); + +/* Split decoder (control struct is different from sceJpeg, no reference anywhere in the apps) + * These functions cannot be used at the moment. + */ + +int sceJpegArmCreateSplitDecoder(void *pCtrl); +int sceJpegArmDeleteSplitDecoder(void *pCtrl); + +int sceJpegArmSplitDecodeMJpeg(void *pCtrl); + +#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) +} +#endif + +#endif /* _DOLCESDK_PSP2_JPEGARM_H_ */ + diff --git a/include/user/kernel/clib.h b/include/user/kernel/clib.h index a7aa75e..7367686 100644 --- a/include/user/kernel/clib.h +++ b/include/user/kernel/clib.h @@ -13,6 +13,7 @@ extern "C" { * * @return none */ +__attribute__((__noreturn__)) void sceClibAbort(void); char sceClibLookCtypeTable(char ch); @@ -20,8 +21,14 @@ char sceClibLookCtypeTable(char ch); int sceClibTolower(char ch); int sceClibToupper(char ch); +__attribute__((__format__(__printf__, 1, 2))) int sceClibPrintf(const char *fmt, ...); + +int sceClibVprintf(const char *fmt, va_list args); + +__attribute__((__format__(__printf__, 3, 4))) 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); char *sceClibStrncpy(char *dst, const char *src, SceSize len); @@ -45,6 +52,38 @@ int sceClibMemcmp(const void *s1, const void *s2, SceSize len); void *sceClibMemchr(const void *src, int ch, SceSize len); +long long sceClibStrtoll(const char *str, char **endptr, int base); + +/* mspace functions */ + +typedef void* SceClibMspace; + +typedef struct SceClibMspaceStats { + SceSize maxSystemSize; + SceSize currentSystemSize; + SceSize maxInUseSize; + SceSize currentInUseSize; + SceSize reserved[4]; +} SceClibMspaceStats; + +/* create and destroy mspace */ +SceClibMspace sceClibMspaceCreate(void *base, SceSize capacity); +SceInt32 sceClibMspaceDestroy(SceClibMspace msp); + +/* allocator and deallocator */ +void *sceClibMspaceMalloc(SceClibMspace msp, SceSize size); +void sceClibMspaceFree(SceClibMspace msp, void *ptr); +void *sceClibMspaceCalloc(SceClibMspace msp, SceSize nelem, SceSize size); +void *sceClibMspaceMemalign(SceClibMspace msp, SceSize boundary, SceSize size); +void *sceClibMspaceRealloc(SceClibMspace msp, void *ptr, SceSize size); +void *sceClibMspaceReallocalign(SceClibMspace msp, void *ptr, SceSize size, SceSize boundary); + +/* utility */ +SceSize sceClibMspaceMallocUsableSize(void *p); +SceInt32 sceClibMspaceMallocStats(SceClibMspace msp, SceClibMspaceStats *buf); +SceInt32 sceClibMspaceMallocStatsFast(SceClibMspace msp, SceClibMspaceStats *buf); +SceInt32 sceClibMspaceIsHeapEmpty(SceClibMspace msp); + #ifdef __cplusplus } #endif diff --git a/include/user/kernel/iofilemgr.h b/include/user/kernel/iofilemgr.h new file mode 100644 index 0000000..5f1b418 --- /dev/null +++ b/include/user/kernel/iofilemgr.h @@ -0,0 +1,494 @@ +#ifndef _DOLCESDK_PSP2_KERNEL_IOFILEMGR_H_ +#define _DOLCESDK_PSP2_KERNEL_IOFILEMGR_H_ + +#include <psp2common/kernel/iofilemgr.h> +#include <psp2/kernel/iofilemgr/async.h> +#include <psp2/kernel/iofilemgr/stat.h> +#include <psp2/kernel/iofilemgr/dirent.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Remove directory entry + * + * @param filename - Path to the file to remove + * @return < 0 on error + */ +int sceIoRemove(const char *filename); + +/** + * Make a directory file + * + * @param dirname - The path to the directory + * @param mode - Access mode bits. + * @return Returns the value 0 if it's successful, otherwise <0 + */ +int sceIoMkdir(const char *dirname, SceIoMode mode); + +/** + * Remove a directory file + * + * @param dirname - Removes a directory file pointed by the string path + * @return Returns the value 0 if it's successful, otherwise <0 + */ +int sceIoRmdir(const char *dirname); + +/** + * Change the name of a file + * + * @param oldname - The old filename + * @param newname - The new filename + * @return < 0 on error. + */ +int sceIoRename(const char *oldname, const char *newname); + +/** + * Send a devctl command to a device. + * + * @par Example: Sending a simple command to a device + * @code + * SceIoDevInfo info; + * sceIoDevctl("ux0:", 0x3001, NULL, 0, &info, sizeof(SceIoDevInfo)); + * @endcode + * + * @param devname - String for the device to send the devctl to (e.g. "ux0:") + * @param cmd - The command to send to the device + * @param arg - A data block to send to the device, if NULL sends no data + * @param arglen - Length of indata, if 0 sends no data + * @param bufp - A data block to receive the result of a command, if NULL receives no data + * @param buflen - Length of outdata, if 0 receives no data + * @return 0 on success, < 0 on error + */ +int sceIoDevctl( + const char *devname, + int cmd, + const void *arg, + SceSize arglen, + void *bufp, + SceSize buflen); + +/** + * Synchronize the file data on the device. + * + * @param devname - The device to synchronize (e.g. msfat0:) + * @param flag - device specific flags + */ +int sceIoSync(const char *devname, int flag); + +/** + * Open or create a file for reading or writing + * + * @par Example1: Open a file for reading + * @code + * if((fd = sceIoOpen("device:/path/to/file", SCE_O_RDONLY, 0777) < 0) { + * // error code in fd, for example no open filehandle left (0x80010018) + * } + * @endcode + * @par Example2: Open a file for writing, creating it if it doesn't exist + * @code + * if((fd = sceIoOpen("device:/path/to/file", SCE_O_WRONLY|SCE_O_CREAT, 0777) < 0) { + * // error code in fd, for example no open filehandle left (0x80010018) + * } + * @endcode + * + * @param filename - Pointer to a string holding the name of the file to open + * @param flag - Libc styled flags that are or'ed together + * @param mode - File access mode (One or more ::SceIoMode). + * @return A non-negative integer is a valid fd, anything else an error + */ +SceUID sceIoOpen(const char *filename, int flag, SceIoMode mode); + +/** + * Delete a descriptor + * + * @code + * sceIoClose(fd); + * @endcode + * + * @param fd - File descriptor to close + * @return < 0 on error + */ +int sceIoClose(SceUID fd); + +/** + * Perform an ioctl on a device. + * + * @param fd - Opened file descriptor to ioctl to + * @param cmd - The command to send to the device + * @param argp - A data block to send to the device, if NULL sends no data + * @param arglen - Length of indata, if 0 sends no data + * @param bufp - A data block to receive the result of a command, if NULL receives no data + * @param buflen - Length of outdata, if 0 receives no data + * @return 0 on success, < 0 on error + */ +int sceIoIoctl( + SceUID fd, + int cmd, + const void *argp, + SceSize arglen, + void *bufp, + SceSize buflen); + +/** + * Reposition read/write file descriptor offset + * + * @par Example: + * @code + * pos = sceIoLseek(fd, -10, SCE_SEEK_END); + * @endcode + * + * @param fd - Opened file descriptor with which to seek + * @param offset - Relative offset from the start position given by whence + * @param whence - One of ::SceIoSeekMode. + * + * @return The position in the file after the seek. + */ +SceOff sceIoLseek(SceUID fd, SceOff offset, int whence); + +/** + * Reposition read/write file descriptor offset (32bit mode) + * + * @par Example: + * @code + * pos = sceIoLseek32(fd, -10, SCE_SEEK_END); + * @endcode + * + * @param fd - Opened file descriptor with which to seek + * @param offset - Relative offset from the start position given by whence + * @param whence - One of ::SceIoSeekMode. + * + * @return The position in the file after the seek. + */ +long sceIoLseek32(SceUID fd, long offset, int whence); + +/** + * Read input + * + * @par Example: + * @code + * bytes_read = sceIoRead(fd, data, 100); + * @endcode + * + * @param fd - Opened file descriptor to read from + * @param buf - Pointer to the buffer where the read data will be placed + * @param nbyte - Size of the read in bytes + * + * @return The number of bytes read + */ +SceSSize sceIoRead(SceUID fd, void *buf, SceSize nbyte); + +/** + * Write output + * + * @par Example: + * @code + * bytes_written = sceIoWrite(fd, data, 100); + * @endcode + * + * @param fd - Opened file descriptor to write to + * @param buf - Pointer to the data to write + * @param nbyte - Size of data to write + * + * @return The number of bytes written + */ +SceSSize sceIoWrite(SceUID fd, const void *buf, SceSize nbyte); + +/** + * Read input at offset + * + * @par Example: + * @code + * bytes_read = sceIoPread(fd, data, 100, 0x1000); + * @endcode + * + * @param fd - Opened file descriptor to read from + * @param buf - Pointer to the buffer where the read data will be placed + * @param nbyte - Size of the read in bytes + * @param offset - Offset to read + * + * @return < 0 on error. + */ +SceSSize sceIoPread(SceUID fd, void *buf, SceSize nbyte, SceOff offset); + +/** + * Write output at offset + * + * @par Example: + * @code + * bytes_written = sceIoPwrite(fd, data, 100, 0x1000); + * @endcode + * + * @param fd - Opened file descriptor to write to + * @param buf - Pointer to the data to write + * @param nbyte - Size of data to write + * @param offset - Offset to write + * + * @return The number of bytes written + */ +SceSSize sceIoPwrite(SceUID fd, const void *buf, SceSize nbyte, SceOff offset); + +/** + * Synchronize the file data for one file + * + * @param fd - Opened file descriptor to sync + * @param flag - device specific flags + * + * @return < 0 on error. + */ +int sceIoSyncByFd(SceUID fd, int flag); + +/*--------------------Async IO--------------------*/ + +/** + * Remove directory entry (asynchronous) + * + * @param file - Path to the file to remove + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +int sceIoRemoveAsync(const char *file, SceIoAsyncParam* asyncParam); + +/** + * Change the name of a file (asynchronous) + * + * @param oldname - The old filename + * @param newname - The new filename + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoRenameAsync(const char *oldname, const char *newname, SceIoAsyncParam* asyncParam); + +/** + * Open or create a file for reading or writing (asynchronous) + * + * @param file - Pointer to a string holding the name of the file to open + * @param flags - Libc styled flags that are or'ed together + * @param mode - File access mode (One or more ::SceIoMode). + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoOpenAsync(const char *file, int flags, SceMode mode, SceIoAsyncParam* asyncParam); + +/** + * Delete a descriptor (asynchronous) + * + * @param fd - File descriptor to close + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoCloseAsync(SceUID fd, SceIoAsyncParam* asyncParam); + +/** + * Read input (asynchronous) + * + * @param fd - Opened file descriptor to read from + * @param data - Pointer to the buffer where the read data will be placed + * @param size - Size of the read in bytes + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoReadAsync(SceUID fd, void *data, SceSize size, SceIoAsyncParam* asyncParam); + +/** + * Read input at offset (asynchronous) + * + * @param fd - Opened file descriptor to read from + * @param data - Pointer to the buffer where the read data will be placed + * @param size - Size of the read in bytes + * @param offset - Offset to read + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoPreadAsync(SceUID fd, void *data, SceSize size, SceOff offset, SceIoAsyncParam* asyncParam); + +/** + * Write output (asynchronous) + * + * @param fd - Opened file descriptor to write to + * @param data - Pointer to the data to write + * @param size - Size of data to write + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoWriteAsync(SceUID fd, const void *data, SceSize size, SceIoAsyncParam* asyncParam); + +/** + * Write output at offset (asynchronous) + * + * @param fd - Opened file descriptor to write to + * @param data - Pointer to the data to write + * @param size - Size of data to write + * @param offset - Offset to write + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoPwriteAsync(SceUID fd, const void *data, SceSize size, SceOff offset, SceIoAsyncParam* asyncParam); + +/** + * Reposition read/write file descriptor offset (asynchronous) + * + * @param fd - Opened file descriptor with which to seek + * @param offset - Relative offset from the start position given by whence + * @param whence - One of ::SceIoSeekMode. + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoLseekAsync(SceUID fd, SceOff offset, int whence, SceIoAsyncParam* asyncParam); + +/** + * Synchronize device state with state of file or directory being opened + * + * @param fd - Opened file descriptor to sync + * @param fd - Device-dependent flag + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoSyncByFdAsync(SceUID fd, int flag, SceIoAsyncParam* asyncParam); + +/** + * Synchronize device state with memory state + * + * @param fd - Device name + * @param fd - Device-dependent flag + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoSyncAsync(const char* device, int flag, SceIoAsyncParam* asyncParam); + +/** + * This function is unimplemented. + * + * @return SCE_KERNEL_ERROR_UNSUP (0x80020004) + */ +int sceIoIoctlAsync( + SceUID fd, + int cmd, + const void *argp, + SceSize arglen, + void *bufp, + SceSize buflen, + SceIoAsyncParam* asyncParam); + +/** + * This function is unimplemented. + * + * @return SCE_KERNEL_ERROR_UNSUP (0x80020004) + */ +int sceIoDevctlAsync( + const char *devname, + int cmd, + const void *arg, + SceSize arglen, + void *bufp, + SceSize buflen, + SceIoAsyncParam* asyncParam); + +/*--------------------IO Priority--------------------*/ + +/*Valid priority values range: 1 (highest) - 15 (lowest). Default priority value is 14*/ + +/** + * Set IO operations priority for file descriptor + * + * @param fd - File UID + * @param priority - IO operations priority + * + * @return < 0 on error. + */ +int sceIoSetPriority(SceUID fd, int priority); + +/** + * Set IO operations priority for file descriptor for non-game application + * + * @param fd - File UID + * @param priority - IO operations priority + * + * @return < 0 on error. + */ +int sceIoSetPriorityForSystem(SceUID fd, int priority); + +/** + * Get IO operations priority for file descriptor + * + * @param fd - File UID + * + * @return A non-negative integer is a valid priority, anything else an error + */ +int sceIoGetPriority(SceUID fd); + +/** + * Get IO operations priority for file descriptor for non-game application + * + * @param fd - File UID + * + * @return A non-negative integer is a valid priority, anything else an error + */ +int sceIoGetPriorityForSystem(SceUID fd); + +/** + * Set IO operations priority for caller process (will be default for all new IO operations) + * + * @param priority - New default IO operations priority + * + * @return < 0 on error. + */ +int sceIoSetProcessDefaultPriority(int priority); + +/** + * Get IO operations priority for process + * + * @return A non-negative integer is a valid priority, anything else an error + */ +int sceIoGetProcessDefaultPriority(void); + +/** + * Set IO operations priority for caller thread (will be default for all new IO operations) + * + * @param priority - New default IO operations priority + * + * @return < 0 on error. + */ +int sceIoSetThreadDefaultPriority(int priority); + +/** + * Set IO operations priority for caller thread for non-game + * application (will be default for all new IO operations) + * + * @param priority - New default IO operations priority + * + * @return < 0 on error. + */ +int sceIoSetThreadDefaultPriorityForSystem(int priority); + +/** + * Get IO operations priority for thread + * + * @return A non-negative integer is a valid priority, anything else an error + */ +int sceIoGetThreadDefaultPriority(void); + +/** + * Get IO operations priority for thread for non-game application + * + * @return A non-negative integer is a valid priority, anything else an error + */ +int sceIoGetThreadDefaultPriorityForSystem(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2_KERNEL_IOFILEMGR_H_ */ diff --git a/include/user/kernel/iofilemgr/async.h b/include/user/kernel/iofilemgr/async.h new file mode 100644 index 0000000..77fac3d --- /dev/null +++ b/include/user/kernel/iofilemgr/async.h @@ -0,0 +1,104 @@ +#ifndef _DOLCESDK_PSP2_KERNEL_IOFILEMGR_ASYNC_H_ +#define _DOLCESDK_PSP2_KERNEL_IOFILEMGR_ASYNC_H_ + +#include <psp2common/kernel/iofilemgr/async.h> +#include <psp2/kernel/threadmgr.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Async IO operations are scheduled automatically, similar to FIOS2. + * You can make calls to sceIoOpenAsync(), sceIoReadAsync(), + * sceIoCloseAsync() right after each other, they will be put in a schedule + * and performed automatically. + * + * All async IO functions return UID of operation handle, not file descriptor UID. + */ + +/** + * Cancel an asynchronous operation. + * + * @param opHandle - The operation handle to perform cancel on. + * + * @return < 0 on error. If operation has been canceled(finished) already, returns 0x80010002 + */ +int sceIoCancel(SceUID opHandle); + +/** + * Complete an asynchronous operation. + * + * @param opHandle - The operation handle to complete. + * + * @return < 0 on error. + */ +int sceIoComplete(SceUID opHandle); + +/** + * Complete multiple asynchronous operations. + * + * @param asyncParam - Array of ::SceIoAsyncParam representing IO operations to complete. retVal member must have opHandle value assigned to it. + * @param numOfParam - Number of ::SceIoAsyncParam structs in asyncParam array + * @param numOfCompleted - Number of operations that has been completed successfully + * + * @return < 0 on last encountered error. + */ +int sceIoCompleteMultiple(SceIoAsyncParam* asyncParam, int numOfParam, int* numOfCompleted); + +/** + * Wait until asynchronous operation has been finished. + * + * @param opHandle - The operation handle to wait for. + * + * @return < 0 on error. + */ +inline +int sceIoWaitAsync(SceUID opHandle) +{ + int ret = sceKernelWaitEvent(opHandle, 1, NULL, NULL, NULL); + if (ret == 0) + return sceIoComplete(opHandle); + else + return ret; +} + +/** + * Wait until asynchronous operation has been finished with callbacks. + * + * @param opHandle - The operation handle to wait for. + * + * @return < 0 on error. + */ +inline +int sceIoWaitAsyncCB(SceUID opHandle) +{ + int ret = sceKernelWaitEventCB(opHandle, 1, NULL, NULL, NULL); + if (ret == 0) + return sceIoComplete(opHandle); + else + return ret; +} + +/** + * Poll asynchronous operation status. + * + * @param opHandle - The operation handle to poll status for. + * + * @return < 0 on error or if operation is not finished. + */ +inline +int sceIoPollAsync(SceUID opHandle) +{ + int ret = sceKernelPollEvent(opHandle, 1, NULL, NULL); + if (ret == 0) + return sceIoComplete(opHandle); + else + return ret; +} + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2_KERNEL_IOFILEMGR_ASYNC_H_ */ diff --git a/include/user/kernel/iofilemgr/dirent.h b/include/user/kernel/iofilemgr/dirent.h new file mode 100644 index 0000000..c518a08 --- /dev/null +++ b/include/user/kernel/iofilemgr/dirent.h @@ -0,0 +1,82 @@ +#ifndef _DOLCESDK_PSP2_KERNEL_IOFILEMGR_DIRENT_H_ +#define _DOLCESDK_PSP2_KERNEL_IOFILEMGR_DIRENT_H_ + +#include <psp2common/kernel/iofilemgr/dirent.h> +#include <psp2/kernel/iofilemgr/async.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Open a directory + * + * @par Example: + * @code + * int dfd; + * dfd = sceIoDopen("device:/"); + * if(dfd >= 0) + * { Do something with the file descriptor } + * @endcode + * @param dirname - The directory to open for reading. + * @return If >= 0 then a valid file descriptor, otherwise a Sony error code. + */ +SceUID sceIoDopen(const char *dirname); + +/** + * Close an opened directory file descriptor + * + * @param fd - Already opened file descriptor (using ::sceIoDopen) + * @return < 0 on error + */ +int sceIoDclose(SceUID fd); + +/** + * Reads an entry from an opened file descriptor. + * + * @param fd - Already opened file descriptor (using ::sceIoDopen) + * @param buf - Pointer to a ::SceIoDirent structure to hold the file information + * + * @return Read status + * - 0 - No more directory entries left + * - > 0 - More directory entries to go + * - < 0 - Error + */ +int sceIoDread(SceUID fd, SceIoDirent *buf); + +/** + * Open a directory (asynchronous) + * + * @param dirname - The directory to open for reading. + * @param asyncParam - parameters related to async operation. + * + * @return If >= 0 then a valid op handle, otherwise a Sony error code. + */ +SceUID sceIoDopenAsync(const char *dirname, SceIoAsyncParam* asyncParam); + +/** + * Reads an entry from an opened file descriptor (asynchronous) + * + * @param fd - Already opened file descriptor (using ::sceIoDopen or ::sceIoDopenAsync) + * @param dir - Pointer to a ::SceIoDirent structure to hold the file information + * @param asyncParam - parameters related to async operation. + * + * @return If >= 0 then a valid op handle, otherwise a Sony error code. + */ +SceUID sceIoDreadAsync(SceUID fd, SceIoDirent *dir, SceIoAsyncParam* asyncParam); + +/** + * Close an opened directory file descriptor (asynchronous) + * + * @param fd - Already opened file descriptor (using ::sceIoDopen or ::sceIoDopenAsync) + * @param asyncParam - parameters related to async operation. + * + * @return If >= 0 then a valid op handle, otherwise a Sony error code. + */ +SceUID sceIoDcloseAsync(SceUID fd, SceIoAsyncParam* asyncParam); + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2_KERNEL_IOFILEMGR_DIRENT_H_ */ diff --git a/include/user/kernel/iofilemgr/stat.h b/include/user/kernel/iofilemgr/stat.h new file mode 100644 index 0000000..b0b57f6 --- /dev/null +++ b/include/user/kernel/iofilemgr/stat.h @@ -0,0 +1,101 @@ +#ifndef _DOLCESDK_PSP2_KERNEL_IOFILEMGR_STAT_H_ +#define _DOLCESDK_PSP2_KERNEL_IOFILEMGR_STAT_H_ + +#include <psp2common/kernel/iofilemgr/stat.h> +#include <psp2/kernel/iofilemgr/async.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Change the status of a file. + * + * @param name - The path to the file. + * @param buf - A pointer to a ::SceIoStat structure. + * @param cbit - Bitmask defining which bits to change. + * + * @return < 0 on error. + */ +int sceIoChstat(const char *name, const SceIoStat *buf, unsigned int cbit); + +/** + * Get the status of a file. + * + * @param name - The path to the file. + * @param buf - A pointer to a ::SceIoStat structure. + * + * @return < 0 on error. + */ +int sceIoGetstat(const char *name, SceIoStat *buf); + +/** + * Get the status of a file descriptor. + * + * @param fd - The file descriptor. + * @param buf - A pointer to a ::SceIoStat structure. + * + * @return < 0 on error. + */ +int sceIoGetstatByFd(SceUID fd, SceIoStat *buf); + +/** + * Change the status of a file descriptor. + * + * @param fd - The file descriptor. + * @param buf - A pointer to an io_stat_t structure. + * @param cbit - Bitmask defining which bits to change. + * + * @return < 0 on error. + */ +int sceIoChstatByFd(SceUID fd, const SceIoStat *buf, unsigned int cbit); + +/** + * Make a directory file (asynchronous) + * + * @param dir - The path to the directory + * @param mode - Access mode (One or more ::SceIoAccessMode). + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoMkdirAsync(const char *dir, SceMode mode, SceIoAsyncParam* asyncParam); + +/** + * Remove a directory file (asynchronous) + * + * @param path - Removes a directory file pointed by the string path + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoRmdirAsync(const char *path, SceIoAsyncParam* asyncParam); + +/** + * Get the status of a file (asynchronous) + * + * @param file - The path to the file. + * @param stat - A pointer to a ::SceIoStat structure. + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoGetstatAsync(const char *file, SceIoStat *stat, SceIoAsyncParam* asyncParam); + +/** + * Change the status of a file (asynchronous) + * + * @param file - The path to the file. + * @param stat - A pointer to a ::SceIoStat structure. + * @param bits - Bitmask defining which bits to change. + * @param asyncParam - parameters related to async operation. + * + * @return A non-negative integer is a valid op handle, anything else an error + */ +SceUID sceIoChstatAsync(const char *file, SceIoStat *stat, int bits, SceIoAsyncParam* asyncParam); + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2_KERNEL_IOFILEMGR_STAT_H_ */ diff --git a/include/user/kernel/iofilemgr/syscall.h b/include/user/kernel/iofilemgr/syscall.h new file mode 100644 index 0000000..c47623a --- /dev/null +++ b/include/user/kernel/iofilemgr/syscall.h @@ -0,0 +1,79 @@ +#ifndef _DOLCESDK_PSP2_KERNEL_IOFILEMGR_SYSCALL_H_ +#define _DOLCESDK_PSP2_KERNEL_IOFILEMGR_SYSCALL_H_ + +#include <psp2/kernel/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* Struct definitions */ + +typedef struct SceIoUnusedSyscallParam0x8 { + char unused[0x8]; +} SceIoUnusedSyscallParam0x8; + +typedef struct SceIoUnusedSyscallParam0x10 { + char unused[0x10]; +} SceIoUnusedSyscallParam0x10; + +typedef struct SceIoDevctlSyscallParam { + SceSize arglen; + void *bufp; + SceSize buflen; + char unused[0xC]; + // size 0x18 +} SceIoDevctlSyscallParam; + +typedef struct SceIoIoctlSyscallParam { + SceSize arglen; + void *bufp; + SceSize buflen; + char unused[0x4]; + // size 0x10 +} SceIoIoctlSyscallParam; + +typedef struct SceIoLseekSyscallParam { + SceOff offset; + int whence; + char unused[0x4]; + // size 0x10 +} SceIoLseekSyscallParam; + +typedef struct SceIoPreadSyscallParam { + SceOff offset; + char unused[0x8]; + // size 0x10 +} SceIoPreadSyscallParam; + +typedef SceIoPreadSyscallParam SceIoPwriteSyscallParam; + +/* Function declarations */ + +SceUID _sceIoRemove(const char *filename, SceIoUnusedSyscallParam0x8 param); + +int _sceIoMkdir(const char *dirname, SceIoMode mode, SceIoUnusedSyscallParam0x8 param); + +int _sceIoRmdir(const char *dirname, SceIoUnusedSyscallParam0x8 param); + +int _sceIoRename(const char *oldname, const char *newname, SceIoUnusedSyscallParam0x10 param); + +int _sceIoDevctl(const char *devname, int cmd, const void *arg, SceIoDevctlSyscallParam param); + +int _sceIoSync(const char *devname, int flag, SceIoUnusedSyscallParam0x8 param); + +SceUID _sceIoOpen(const char *filename, int flag, SceIoMode mode, SceIoUnusedSyscallParam0x8 param); + +int _sceIoIoctl(SceUID fd, int cmd, const void *argp, SceIoIoctlSyscallParam param); + +SceOff _sceIoLseek(SceUID fd, SceIoLseekSyscallParam param); + +SceSSize _sceIoPread(SceUID fd, void *buf, SceSize nbyte, SceIoPreadSyscallParam param); + +SceSSize _sceIoPwrite(SceUID fd, const void *buf, SceSize nbyte, SceIoPwriteSyscallParam param); + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2_KERNEL_IOFILEMGR_SYSCALL_H_ */ diff --git a/include/user/kernel/processmgr.h b/include/user/kernel/processmgr.h index 272fe51..e515f60 100644 --- a/include/user/kernel/processmgr.h +++ b/include/user/kernel/processmgr.h @@ -90,13 +90,6 @@ SceUInt32 sceKernelGetProcessTimeLow(void); */ SceUInt64 sceKernelGetProcessTimeWide(void); -/** - * Get the process ID of the current process. - * - * @return process ID of the current process - */ -SceUID sceKernelGetProcessId(void); - #ifdef __cplusplus } #endif diff --git a/include/user/kernel/sysmem.h b/include/user/kernel/sysmem.h index 654949d..6a55a46 100644 --- a/include/user/kernel/sysmem.h +++ b/include/user/kernel/sysmem.h @@ -1,20 +1,20 @@ #ifndef _PSP2_KERNEL_SYSMEM_H_ #define _PSP2_KERNEL_SYSMEM_H_ -#include <psp2/types.h> +#include <psp2/kernel/types.h> #ifdef __cplusplus extern "C" { #endif -typedef enum SceKernelMemBlockType { +typedef enum _SceKernelMemBlockType { SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE = 0x0C208060, SCE_KERNEL_MEMBLOCK_TYPE_USER_RX = 0x0C20D050, SCE_KERNEL_MEMBLOCK_TYPE_USER_RW = 0x0C20D060, SCE_KERNEL_MEMBLOCK_TYPE_USER_MAIN_PHYCONT_RW = 0x0C80D060, SCE_KERNEL_MEMBLOCK_TYPE_USER_MAIN_PHYCONT_NC_RW = 0x0D808060, SCE_KERNEL_MEMBLOCK_TYPE_USER_CDRAM_RW = 0x09408060 -} SceKernelMemBlockType; +} _SceKernelMemBlockType; typedef struct SceKernelAllocMemBlockOpt { SceSize size; diff --git a/include/user/kernel/threadmgr.h b/include/user/kernel/threadmgr.h index 3ece29e..f2840d6 100644 --- a/include/user/kernel/threadmgr.h +++ b/include/user/kernel/threadmgr.h @@ -1,77 +1,44 @@ #ifndef _PSP2_KERNEL_THREADMGR_H_ #define _PSP2_KERNEL_THREADMGR_H_ -#include <psp2/types.h> +#include <psp2common/kernel/threadmgr.h> #ifdef __cplusplus extern "C" { #endif -/** 64-bit system clock type. */ -typedef SceUInt64 SceKernelSysClock; - /* Threads. */ -typedef int (*SceKernelThreadEntry)(SceSize args, void *argp); - -/** Additional options used when creating threads. */ -typedef struct SceKernelThreadOptParam { - /** Size of the ::SceKernelThreadOptParam structure. */ - SceSize size; - /** Attributes */ - SceUInt32 attr; -} SceKernelThreadOptParam; - /** Structure to hold the status information for a thread * @see sceKernelGetThreadInfo */ -typedef struct SceKernelThreadInfo { +typedef struct _SceKernelThreadInfo { /** Size of the structure */ SceSize size; - /** The UID of the process where the thread belongs */ - SceUID processId; //Needs confirmation - /** Nul terminated name of the thread */ - char name[32]; - /** Thread attributes */ - SceUInt attr; - /** Thread status */ - int status; - /** Thread entry point */ + SceUID processId; + char name[SCE_UID_NAMELEN+1]; + SceUInt32 attr; + SceUInt32 status; SceKernelThreadEntry entry; - /** Thread stack pointer */ - void *stack; - /** Thread stack size */ - int stackSize; - /** Initial priority */ - int initPriority; - /** Current priority */ - int currentPriority; - /** Initial CPU affinity mask */ - int initCpuAffinityMask; - /** Current CPU affinity mask */ - int currentCpuAffinityMask; - /** Current CPU ID */ - int currentCpuId; - /** Last executed CPU ID */ - int lastExecutedCpuId; - /** Wait type */ - int waitType; - /** Wait id */ + void *pStack; + SceSize stackSize; + SceInt32 initPriority; + SceInt32 currentPriority; + SceInt32 initCpuAffinityMask; + SceInt32 currentCpuAffinityMask; + SceInt32 currentCpuId; + SceInt32 lastExecutedCpuId; + SceUInt32 waitType; SceUID waitId; - /** Exit status of the thread */ - int exitStatus; - /** Number of clock cycles run */ + SceInt32 exitStatus; SceKernelSysClock runClocks; - /** Interrupt preemption count */ - SceUInt intrPreemptCount; - /** Thread preemption count */ - SceUInt threadPreemptCount; - /** Thread release count */ - SceUInt threadReleaseCount; + SceUInt32 intrPreemptCount; + SceUInt32 threadPreemptCount; + SceUInt32 threadReleaseCount; + SceInt32 changeCpuCount; /** Function notify callback UID */ - SceUID fNotifyCallback; - /** Reserved */ - int reserved; + SceInt32 fNotifyCallback; + SceInt32 reserved; } SceKernelThreadInfo; /** Statistics about a running thread. @@ -83,7 +50,7 @@ typedef struct SceKernelThreadRunStatus { SceUID processId; SceUID threadId; int priority; - } cpuInfo[4]; + } cpuInfo[SCE_KERNEL_MAX_CPU]; } SceKernelThreadRunStatus; /* Sure there must be more than this, but haven't seen them */ @@ -96,183 +63,188 @@ typedef enum SceThreadStatus { SCE_THREAD_KILLED = 32, /* Thread manager has killed the thread (stack overflow) */ } SceThreadStatus; -typedef enum SceKernelMutexAttribute { - SCE_KERNEL_MUTEX_ATTR_RECURSIVE = 0x02 -} SceKernelMutexAttribute; - /** * Create a thread * - * @par Example: - * @code - * SceUID thid; - * thid = sceKernelCreateThread("my_thread", threadFunc, 0x10000100, 0x10000, 0, 0, NULL); - * @endcode - * - * @param name - An arbitrary thread name. + * @param pName - An arbitrary thread name. * @param entry - The thread function to run when started. * @param initPriority - The initial priority of the thread. Less if higher priority. * @param stackSize - The size of the initial stack. * @param attr - The thread attributes, zero or more of ::SceThreadAttributes. * @param cpuAffinityMask - The CPU affinity mask - * @param option - Additional options specified by ::SceKernelThreadOptParam. + * @param pOptParam - Additional options specified by ::SceKernelThreadOptParam. * @return UID of the created thread, or an error code. */ -SceUID sceKernelCreateThread(const char *name, SceKernelThreadEntry entry, int initPriority, - SceSize stackSize, SceUInt attr, int cpuAffinityMask, - const SceKernelThreadOptParam *option); +SceUID sceKernelCreateThread( + const char *pName, + SceKernelThreadEntry entry, + SceInt32 initPriority, + SceSize stackSize, + SceUInt32 attr, + SceInt32 cpuAffinityMask, + const SceKernelThreadOptParam *pOptParam); /** * Delate a thread * - * @param thid - UID of the thread to be deleted. + * @param threadId - UID of the thread to be deleted. * * @return < 0 on error. */ -int sceKernelDeleteThread(SceUID thid); +SceInt32 sceKernelDeleteThread(SceUID threadId); /** * Start a created thread * - * @param thid - Thread id from ::sceKernelCreateThread - * @param arglen - Length of the data pointed to by argp, in bytes - * @param argp - Pointer to the arguments. + * @param threadId - Thread id from ::sceKernelCreateThread + * @param argSize - Length of the data pointed to by argp, in bytes + * @param pArgBlock - Pointer to the arguments. */ -int sceKernelStartThread(SceUID thid, SceSize arglen, void *argp); +SceInt32 sceKernelStartThread(SceUID threadId, SceSize argSize, const void *pArgBlock); /** * Exit a thread * - * @param status - Exit status. + * @param exitStatus - Exit status. */ -int sceKernelExitThread(int status); +SceInt32 sceKernelExitThread(SceInt32 exitStatus); /** * Exit a thread and delete itself. * - * @param status - Exit status + * @param exitStatus - Exit status */ -int sceKernelExitDeleteThread(int status); +SceInt32 sceKernelExitDeleteThread(SceInt32 exitStatus); /** * Wait until a thread has ended. * - * @param thid - Id of the thread to wait for. - * @param stat - Exit status. - * @param timeout - Timeout in microseconds (assumed). + * @param threadId - Id of the thread to wait for. + * @param pExitStatus - Exit status. + * @param pTimeout - Timeout in microseconds. * * @return < 0 on error. */ -int sceKernelWaitThreadEnd(SceUID thid, int *stat, SceUInt *timeout); +SceInt32 sceKernelWaitThreadEnd(SceUID threadId, SceInt32 *pExitStatus, SceUInt32 *pTimeout); /** * Wait until a thread has ended and handle callbacks if necessary. * - * @param thid - Id of the thread to wait for. - * @param stat - Exit status. - * @param timeout - Timeout in microseconds (assumed). + * @param threadId - Id of the thread to wait for. + * @param pExitStatus - Exit status. + * @param pTimeout - Timeout in microseconds. * * @return < 0 on error. */ -int sceKernelWaitThreadEndCB(SceUID thid, int *stat, SceUInt *timeout); +SceInt32 sceKernelWaitThreadEndCB(SceUID threadId, SceInt32 *pExitStatus, SceUInt32 *pTimeout); /** * Delay the current thread by a specified number of microseconds * - * @param delay - Delay in microseconds. + * @param usec - Delay in microseconds. * * @par Example: * @code * sceKernelDelayThread(1000000); // Delay for a second * @endcode */ -int sceKernelDelayThread(SceUInt delay); +SceInt32 sceKernelDelayThread(SceUInt32 usec); /** * Delay the current thread by a specified number of microseconds and handle any callbacks. * - * @param delay - Delay in microseconds. + * @param usec - Delay in microseconds. * * @par Example: * @code * sceKernelDelayThread(1000000); // Delay for a second * @endcode */ -int sceKernelDelayThreadCB(SceUInt delay); +SceInt32 sceKernelDelayThreadCB(SceUInt32 usec); /** * Modify the attributes of the current thread. * - * @param unknown - Set to 0. - * @param attr - The thread attributes to modify. One of ::SceThreadAttributes. + * @param clearAttr - Bits to clear + * @param setAttr - Bits to set * * @return < 0 on error. */ -int sceKernelChangeCurrentThreadAttr(int unknown, SceUInt attr); +SceInt32 sceKernelChangeCurrentThreadAttr(SceUInt32 clearAttr, SceUInt32 setAttr); /** * Change the threads current priority. * - * @param thid - The ID of the thread (from ::sceKernelCreateThread or ::sceKernelGetThreadId) + * @param threadId - The ID of the thread (from ::sceKernelCreateThread or ::sceKernelGetThreadId) * @param priority - The new priority (the lower the number the higher the priority) * * @par Example: * @code - * int thid = sceKernelGetThreadId(); + * int threadId = sceKernelGetThreadId(); * // Change priority of current thread to 16 * sceKernelChangeThreadPriority(thid, 16); * @endcode * * @return 0 if successful, otherwise the error code. */ -int sceKernelChangeThreadPriority(SceUID thid, int priority); +SceInt32 sceKernelChangeThreadPriority(SceUID threadId, SceInt32 priority); + +/** + * Change the threads current priority. + * + * @param threadId - The ID of the thread (from ::sceKernelCreateThread or ::sceKernelGetThreadId) + * @param priority - The new priority (the lower the number the higher the priority) + * + * @return old priority or error code + */ +SceInt32 sceKernelChangeThreadPriority2(SceUID threadId, SceInt32 priority); /** * Get the current thread Id * * @return The thread id of the calling thread. */ -int sceKernelGetThreadId(void); +SceUID sceKernelGetThreadId(void); /** * Get the current priority of the thread you are in. * * @return The current thread priority */ -int sceKernelGetThreadCurrentPriority(void); +SceInt32 sceKernelGetThreadCurrentPriority(void); /** * Get the exit status of a thread. * - * @param[in] thid - The UID of the thread to check. - * @param[out] status - Status out pointer - * @return The exit status + * @param threadId - The UID of the thread to check. + * @param pExitStatus - pointer to area to store result + * + * @return 0 or <0 on error */ -int sceKernelGetThreadExitStatus(SceUID thid, int *status); +SceInt32 sceKernelGetThreadExitStatus(SceUID threadId, SceInt32 *pExitStatus); /** - * Check the thread stack? + * Check remaining thread stack size * - * @return Unknown. + * @return Stack size at the time of function call */ -int sceKernelCheckThreadStack(void); +SceSize sceKernelCheckThreadStack(void); /** * Get the free stack size for a thread. * - * @param thid - The thread ID. Seem to take current thread - * if set to 0. + * @param threadId - The thread ID * * @return The free size. */ -int sceKernelGetThreadStackFreeSize(SceUID thid); +SceSize sceKernelGetThreadStackFreeSize(SceUID threadId); /** * Get the status information for the specified thread. * - * @param thid - Id of the thread to get status - * @param info - Pointer to the info structure to receive the data. + * @param threadId - Id of the thread to get status + * @param pInfo - Pointer to the info structure to receive the data. * Note: The structures size field should be set to * sizeof(SceKernelThreadInfo) before calling this function. * @@ -285,17 +257,41 @@ int sceKernelGetThreadStackFreeSize(SceUID thid); * @endcode * @return 0 if successful, otherwise the error code. */ -int sceKernelGetThreadInfo(SceUID thid, SceKernelThreadInfo *info); +SceInt32 sceKernelGetThreadInfo(SceUID threadId, SceKernelThreadInfo *pInfo); /** * Retrive the runtime status of a thread. * - * @param thid - UID of the thread to retrieve status. - * @param status - Pointer to a ::SceKernelThreadRunStatus struct to receive the runtime status. + * @param pStatus - Pointer to a ::SceKernelThreadRunStatus struct to receive the runtime status. * * @return 0 if successful, otherwise the error code. */ -int sceKernelGetThreadRunStatus(SceUID thid, SceKernelThreadRunStatus *status); +SceInt32 sceKernelGetThreadRunStatus(SceKernelThreadRunStatus *pStatus); + +typedef SceInt32 (*SceKernelChangeStackFunction)(void *pArg); + +SceInt32 sceKernelCallWithChangeStack( + void *pBase, + SceSize size, + SceKernelChangeStackFunction changeStackFunc, + void *pCommon); + +SceInt32 sceKernelChangeThreadCpuAffinityMask(SceUID threadId, SceInt32 cpuAffinityMask); + +SceInt32 sceKernelGetThreadCpuAffinityMask(SceUID threadId); + +/** + * Get the process ID of the current thread. + * + * @return process ID of the current thread + */ +SceUID sceKernelGetProcessId(void); + +SceInt32 sceKernelCheckWaitableStatus(void); + +SceInt32 sceKernelChangeThreadVfpException(SceInt32 clearMask, SceInt32 setMask); + +SceInt32 sceKernelGetCurrentThreadVfpException(void); /* Semaphores. */ @@ -315,7 +311,7 @@ typedef struct SceKernelSemaInfo { /** The UID of the semaphore */ SceUID semaId; /** NUL-terminated name of the semaphore. */ - char name[32]; + char name[SCE_UID_NAMELEN + 1]; /** Attributes. */ SceUInt attr; /** The initial count the semaphore was created with. */ @@ -339,20 +335,25 @@ typedef struct SceKernelSemaInfo { * * @param name - Specifies the name of the sema * @param attr - Sema attribute flags (normally set to 0) - * @param initVal - Sema initial value - * @param maxVal - Sema maximum value - * @param option - Sema options (normally set to 0) + * @param initCount - Sema initial value + * @param maxCount - Sema maximum value + * @param pOptParam - Sema options (normally set to 0) * @return A semaphore id */ -SceUID sceKernelCreateSema(const char *name, SceUInt attr, int initVal, int maxVal, SceKernelSemaOptParam *option); +SceUID sceKernelCreateSema( + const char *name, + SceUInt32 attr, + SceInt32 initCount, + SceInt32 maxCount, + SceKernelSemaOptParam *pOptParam); /** * Destroy a semaphore * - * @param semaid - The semaid returned from a previous create call. - * @return Returns the value 0 if it's successful, otherwise -1 + * @param semaId - The semaid returned from a previous create call. + * @return Returns the value 0 if it's successful, otherwise negative */ -int sceKernelDeleteSema(SceUID semaid); +SceInt32 sceKernelDeleteSema(SceUID semaId); /** * Send a signal to a semaphore @@ -360,77 +361,81 @@ int sceKernelDeleteSema(SceUID semaid); * @par Example: * @code * // Signal the sema - * sceKernelSignalSema(semaid, 1); + * sceKernelSignalSema(semaId, 1); * @endcode * - * @param semaid - The sema id returned from ::sceKernelCreateSema - * @param signal - The amount to signal the sema (i.e. if 2 then increment the sema by 2) + * @param semaId - The sema ID returned from ::sceKernelCreateSema + * @param signalCount - The amount to signal the sema (i.e. if 2 then increment the sema by 2) * * @return < 0 On error. */ -int sceKernelSignalSema(SceUID semaid, int signal); +SceInt32 sceKernelSignalSema(SceUID semaId, SceInt32 signalCount); /** * Lock a semaphore * * @par Example: * @code - * sceKernelWaitSema(semaid, 1, 0); + * sceKernelWaitSema(semaId, 1, 0); * @endcode * - * @param semaid - The sema id returned from ::sceKernelCreateSema - * @param signal - The value to wait for (i.e. if 1 then wait till reaches a signal state of 1) - * @param timeout - Timeout in microseconds (assumed). + * @param semaId - The sema id returned from ::sceKernelCreateSema + * @param needCount - The value to wait for (i.e. if 1 then wait till reaches a signal state of 1) + * @param pTimeout - Timeout in microseconds. * * @return < 0 on error. */ -int sceKernelWaitSema(SceUID semaid, int signal, SceUInt *timeout); +SceInt32 sceKernelWaitSema(SceUID semaId, SceInt32 needCount, SceUInt32 *pTimeout); /** * Lock a semaphore and handle callbacks if necessary. * * @par Example: * @code - * sceKernelWaitSemaCB(semaid, 1, 0); + * sceKernelWaitSemaCB(semaId, 1, 0); * @endcode * - * @param semaid - The sema id returned from ::sceKernelCreateSema - * @param signal - The value to wait for (i.e. if 1 then wait till reaches a signal state of 1) - * @param timeout - Timeout in microseconds (assumed). + * @param semaId - The sema id returned from ::sceKernelCreateSema + * @param needCount - The value to wait for (i.e. if 1 then wait till reaches a signal state of 1) + * @param pTimeout - Timeout in microseconds. * * @return < 0 on error. */ -int sceKernelWaitSemaCB(SceUID semaid, int signal, SceUInt *timeout); +SceInt32 sceKernelWaitSemaCB(SceUID semaId, SceInt32 needCount, SceUInt32 *pTimeout); /** * Poll a semaphore. * - * @param semaid - UID of the semaphore to poll. - * @param signal - The value to test for. + * @param semaId - UID of the semaphore to poll. + * @param needCount - The value to test for. * * @return < 0 on error. */ -int sceKernelPollSema(SceUID semaid, int signal); +SceInt32 sceKernelPollSema(SceUID semaId, SceInt32 needCount); /** * Cancels a semaphore * - * @param semaid - The sema id returned from ::sceKernelCreateSema + * @param semaId - The sema id returned from ::sceKernelCreateSema * @param setCount - The new lock count of the semaphore - * @param numWaitThreads - Number of threads waiting for the semaphore + * @param pNumWaitThreads - Number of threads waiting for the semaphore * @return < 0 On error. */ -int sceKernelCancelSema(SceUID semaid, int setCount, int *numWaitThreads); +SceInt32 sceKernelCancelSema(SceUID semaId, SceInt32 setCount, SceUInt32 *pNumWaitThreads); /** * Retrieve information about a semaphore. * - * @param semaid - UID of the semaphore to retrieve info for. - * @param info - Pointer to a ::SceKernelSemaInfo struct to receive the info. + * @param semaId - UID of the semaphore to retrieve info for. + * @param pInfo - Pointer to a ::SceKernelSemaInfo struct to receive the info. * * @return < 0 on error. */ -int sceKernelGetSemaInfo(SceUID semaid, SceKernelSemaInfo *info); +SceInt32 sceKernelGetSemaInfo(SceUID semaId, SceKernelSemaInfo *pInfo); + +SceUID sceKernelOpenSema(const char *pName); + +SceInt32 sceKernelCloseSema(SceUID semaId); /* Mutexes. */ @@ -439,7 +444,7 @@ int sceKernelGetSemaInfo(SceUID semaid, SceKernelSemaInfo *info); typedef struct SceKernelMutexOptParam { /** Size of the ::SceKernelMutexOptParam structure. */ SceSize size; - int ceilingPriority; + SceInt32 ceilingPriority; } SceKernelMutexOptParam; /** Current state of a mutex. @@ -451,17 +456,18 @@ typedef struct SceKernelMutexInfo { /** The UID of the mutex. */ SceUID mutexId; /** NUL-terminated name of the mutex. */ - char name[32]; + char name[SCE_UID_NAMELEN + 1]; /** Attributes. */ - SceUInt attr; + SceUInt32 attr; /** The initial count the mutex was created with. */ - int initCount; + SceInt32 initCount; /** The current count. */ - int currentCount; + SceInt32 currentCount; /** The UID of the current owner of the mutex. */ SceUID currentOwnerId; /** The number of threads waiting on the mutex. */ - int numWaitThreads; + SceUInt32 numWaitThreads; + SceInt32 ceilingPriority; } SceKernelMutexInfo; /** @@ -473,149 +479,125 @@ typedef struct SceKernelMutexInfo { * mutexid = sceKernelCreateMutex("MyMutex", 0, 1, NULL); * @endcode * - * @param name - Specifies the name of the mutex + * @param pName - Specifies the name of the mutex * @param attr - Mutex attribute flags (normally set to 0) * @param initCount - Mutex initial value - * @param option - Mutex options (normally set to 0) + * @param pOptParam - Mutex options (normally set to 0) * @return A mutex id */ -SceUID sceKernelCreateMutex(const char *name, SceUInt attr, int initCount, SceKernelMutexOptParam *option); +SceUID sceKernelCreateMutex( + const char *pName, + SceUInt32 attr, + SceInt32 initCount, + const SceKernelMutexOptParam *pOptParam); /** * Destroy a mutex * - * @param mutexid - The mutex id returned from ::sceKernelCreateMutex - * @return Returns the value 0 if it's successful, otherwise -1 + * @param mutexId - The mutex id returned from ::sceKernelCreateMutex + * @return Returns the value 0 if it's successful, otherwise < 0 */ -int sceKernelDeleteMutex(SceUID mutexid); +SceInt32 sceKernelDeleteMutex(SceUID mutexId); /** * Open a mutex * - * @param name - The name of the mutex to open - * @return Returns the value 0 if it's successful, otherwise -1 + * @param pName - The name of the mutex to open + * @return Returns an UID if successful, otherwise < 0 */ -int sceKernelOpenMutex(const char *name); +SceUID sceKernelOpenMutex(const char *pName); /** * Close a mutex * - * @param mutexid - The mutex id returned from ::sceKernelCreateMutex - * @return Returns the value 0 if it's successful, otherwise -1 + * @param mutexId - The mutex id returned from ::sceKernelCreateMutex + * @return Returns the value 0 if it's successful, otherwise < 0 */ -int sceKernelCloseMutex(SceUID mutexid); +SceInt32 sceKernelCloseMutex(SceUID mutexId); /** * Lock a mutex * - * @param mutexid - The mutex id returned from ::sceKernelCreateMutex + * @param mutexId - The mutex id returned from ::sceKernelCreateMutex * @param lockCount - The value to increment to the lock count of the mutex - * @param timeout - Timeout in microseconds (assumed) + * @param pTimeout - Timeout in microseconds * @return < 0 On error. */ -int sceKernelLockMutex(SceUID mutexid, int lockCount, unsigned int *timeout); +SceInt32 sceKernelLockMutex(SceUID mutexId, SceInt32 lockCount, SceUInt32 *pTimeout); /** * Lock a mutex and handle callbacks if necessary. * - * @param mutexid - The mutex id returned from ::sceKernelCreateMutex + * @param mutexId - The mutex id returned from ::sceKernelCreateMutex * @param lockCount - The value to increment to the lock count of the mutex - * @param timeout - Timeout in microseconds (assumed) + * @param pTimeout - Timeout in microseconds * @return < 0 On error. */ -int sceKernelLockMutexCB(SceUID mutexid, int lockCount, unsigned int *timeout); +SceInt32 sceKernelLockMutexCB(SceUID mutexId, SceInt32 lockCount, SceUInt32 *pTimeout); /** * Try to lock a mutex (non-blocking) * - * @param mutexid - The mutex id returned from ::sceKernelCreateMutex + * @param mutexId - The mutex id returned from ::sceKernelCreateMutex * @param lockCount - The value to increment to the lock count of the mutex * @return < 0 On error. */ -int sceKernelTryLockMutex(SceUID mutexid, int lockCount); +SceInt32 sceKernelTryLockMutex(SceUID mutexId, SceInt32 lockCount); /** * Try to unlock a mutex (non-blocking) * - * @param mutexid - The mutex id returned from ::sceKernelCreateMutex + * @param mutexId - The mutex id returned from ::sceKernelCreateMutex * @param unlockCount - The value to decrement to the lock count of the mutex * @return < 0 On error. */ -int sceKernelUnlockMutex(SceUID mutexid, int unlockCount); +SceInt32 sceKernelUnlockMutex(SceUID mutexId, SceInt32 unlockCount); /** * Cancels a mutex * - * @param mutexid - The mutex id returned from ::sceKernelCreateMutex + * @param mutexId - The mutex id returned from ::sceKernelCreateMutex * @param newCount - The new lock count of the mutex - * @param numWaitThreads - Number of threads waiting for the mutex + * @param pNumWaitThreads - Number of threads waiting for the mutex * @return < 0 On error. */ -int sceKernelCancelMutex(SceUID mutexid, int newCount, int *numWaitThreads); +SceInt32 sceKernelCancelMutex(SceUID mutexId, SceInt32 newCount, SceUInt32 *pNumWaitThreads); /** * Retrieve information about a mutex. * - * @param mutexid - UID of the mutex to retrieve info for. - * @param info - Pointer to a ::SceKernelMutexInfo struct to receive the info. + * @param mutexId - UID of the mutex to retrieve info for. + * @param pInfo - Pointer to a ::SceKernelMutexInfo struct to receive the info. * * @return < 0 on error. */ -int sceKernelGetMutexInfo(SceUID mutexid, SceKernelMutexInfo *info); +SceInt32 sceKernelGetMutexInfo(SceUID mutexId, SceKernelMutexInfo *pInfo); /* Event flags. */ /** Structure to hold the event flag information */ typedef struct SceKernelEventFlagInfo { - SceSize size; - SceUID evfId; // Needs confirmation - char name[32]; - SceUInt attr; - SceUInt initPattern; - SceUInt currentPattern; - int numWaitThreads; + SceSize size; + SceUID evfId; + char name[SCE_UID_NAMELEN + 1]; + SceUInt32 attr; + SceUInt32 initPattern; + SceUInt32 currentPattern; + SceUInt32 numWaitThreads; } SceKernelEventFlagInfo; typedef struct SceKernelEventFlagOptParam { SceSize size; } SceKernelEventFlagOptParam; -typedef struct SceKernelEventFlagOptParam SceKernelEventFlagOptParam; - -/** Event flag creation attributes */ -typedef enum SceEventFlagAttributes { - /* Waiting threads queued on a FIFO basis */ - SCE_EVENT_THREAD_FIFO = 0, - /* Waiting threads queued on priority basis */ - SCE_EVENT_THREAD_PRIO = 0x00002000, - /* Event flag can only be waited upon by one thread */ - SCE_EVENT_WAITSINGLE = 0, - /* Event flag can be waited upon by multiple threads */ - SCE_EVENT_WAITMULTIPLE = 0x00001000, - /* Event flag can be accessed by sceKernelOpenEventFlag / sceKernelCloseEventFlag */ - SCE_EVENT_OPENABLE = 0x00000080 -} SceEventFlagAttributes; - -/** Event flag wait types */ -typedef enum SceEventFlagWaitTypes { - /** Wait for all bits in the pattern to be set */ - SCE_EVENT_WAITAND = 0, - /** Wait for one or more bits in the pattern to be set */ - SCE_EVENT_WAITOR = 1, - /** Clear all the bits when it matches */ - SCE_EVENT_WAITCLEAR = 2, - /** Clear the wait pattern when it matches */ - SCE_EVENT_WAITCLEAR_PAT = 4 -} SceEventFlagWaitTypes; - /** * Create an event flag. * - * @param name - The name of the event flag. + * @param pName - The name of the event flag. * @param attr - Attributes from ::SceEventFlagAttributes - * @param bits - Initial bit pattern. - * @param opt - Options, set to NULL + * @param initPattern - Initial bit pattern. + * @param pOptParam - Options, set to NULL * @return < 0 on error. >= 0 event flag id. * * @par Example: @@ -624,81 +606,101 @@ typedef enum SceEventFlagWaitTypes { * evid = sceKernelCreateEventFlag("wait_event", 0, 0, NULL); * @endcode */ -SceUID sceKernelCreateEventFlag(const char *name, int attr, int bits, SceKernelEventFlagOptParam *opt); +SceUID sceKernelCreateEventFlag( + const char *pName, + SceUInt32 attr, + SceUInt32 initPattern, + const SceKernelEventFlagOptParam *pOptParam); /** * Set an event flag bit pattern. * - * @param evid - The event id returned by ::sceKernelCreateEventFlag. - * @param bits - The bit pattern to set. + * @param evfId - The event id returned by ::sceKernelCreateEventFlag. + * @param bitPattern - The bit pattern to set. * * @return < 0 On error */ -int sceKernelSetEventFlag(SceUID evid, unsigned int bits); +SceInt32 sceKernelSetEventFlag(SceUID evfId, SceUInt32 bitPattern); /** * Clear a event flag bit pattern * - * @param evid - The event id returned by ::sceKernelCreateEventFlag - * @param bits - The bits to clean + * @param evfId - The event id returned by ::sceKernelCreateEventFlag + * @param bitPattern - The bits to unset * * @return < 0 on Error */ -int sceKernelClearEventFlag(SceUID evid, unsigned int bits); +SceInt32 sceKernelClearEventFlag(SceUID evfId, SceUInt32 bitPattern); /** * Poll an event flag for a given bit pattern. * - * @param evid - The event id returned by ::sceKernelCreateEventFlag. - * @param bits - The bit pattern to poll for. - * @param wait - Wait type, one or more of ::SceEventFlagWaitTypes or'ed together - * @param outBits - The bit pattern that was matched. + * @param evfId - The event id returned by ::sceKernelCreateEventFlag. + * @param bitPattern - The bit pattern to poll for. + * @param waitMode - Wait type, one or more of ::SceEventFlagWaitTypes or'ed together + * @param pResultPat - The bit pattern that was matched. * @return < 0 On error */ -int sceKernelPollEventFlag(int evid, unsigned int bits, unsigned int wait, unsigned int *outBits); +SceInt32 sceKernelPollEventFlag(SceUID evfId, SceUInt32 bitPattern, SceUInt32 waitMode, SceUInt32 *pResultPat); /** * Wait for an event flag for a given bit pattern. * - * @param evid - The event id returned by ::sceKernelCreateEventFlag. - * @param bits - The bit pattern to poll for. - * @param wait - Wait type, one or more of ::SceEventFlagWaitTypes or'ed together - * @param outBits - The bit pattern that was matched. - * @param timeout - Timeout in microseconds + * @param evfId - The event id returned by ::sceKernelCreateEventFlag. + * @param bitPattern - The bit pattern to poll for. + * @param waitMode - Wait type, one or more of ::SceEventFlagWaitTypes or'ed together + * @param pResultPat - The bit pattern that was matched. + * @param pTimeout - Timeout in microseconds * @return < 0 On error */ -int sceKernelWaitEventFlag(int evid, unsigned int bits, unsigned int wait, unsigned int *outBits, SceUInt *timeout); +SceInt32 sceKernelWaitEventFlag( + SceUID evfId, + SceUInt32 bitPattern, + SceUInt32 waitMode, + SceUInt32 *pResultPat, + SceUInt32 *pTimeout); /** * Wait for an event flag for a given bit pattern with callback. * - * @param evid - The event id returned by ::sceKernelCreateEventFlag. - * @param bits - The bit pattern to poll for. - * @param wait - Wait type, one or more of ::SceEventFlagWaitTypes or'ed together - * @param outBits - The bit pattern that was matched. - * @param timeout - Timeout in microseconds + * @param evfId - The event id returned by ::sceKernelCreateEventFlag. + * @param bitPattern - The bit pattern to poll for. + * @param waitMode - Wait type, one or more of ::SceEventFlagWaitTypes or'ed together + * @param pResultPat - The bit pattern that was matched. + * @param pTimeout - Timeout in microseconds * @return < 0 On error */ -int sceKernelWaitEventFlagCB(int evid, unsigned int bits, unsigned int wait, unsigned int *outBits, SceUInt *timeout); +SceInt32 sceKernelWaitEventFlagCB( + SceUID evfId, + SceUInt32 bitPattern, + SceUInt32 waitMode, + SceUInt32 *pResultPat, + SceUInt32 *pTimeout); /** * Delete an event flag * - * @param evid - The event id returned by ::sceKernelCreateEventFlag. + * @param evfId - The event id returned by ::sceKernelCreateEventFlag. * * @return < 0 On error */ -int sceKernelDeleteEventFlag(int evid); +SceInt32 sceKernelDeleteEventFlag(SceUID evfId); /** * Get the status of an event flag. * - * @param event - The UID of the event. - * @param status - A pointer to a ::SceKernelEventFlagInfo structure. + * @param evfId - The UID of the event. + * @param pInfo - A pointer to a ::SceKernelEventFlagInfo structure. * * @return < 0 on error. */ -int sceKernelGetEventFlagInfo(SceUID event, SceKernelEventFlagInfo *info); +SceInt32 sceKernelGetEventFlagInfo(SceUID evfId, SceKernelEventFlagInfo *pInfo); + +SceUID sceKernelOpenEventFlag(const char *pName); + +SceInt32 sceKernelCloseEventFlag(SceUID evfId); + +SceInt32 sceKernelCancelEventFlag(SceUID evfId, SceUInt32 setPattern, SceUInt32 *pNumWaitThreads); /* Condition variables */ @@ -717,7 +719,7 @@ typedef struct SceKernelCondInfo { /** The UID of the condition variable. */ SceUID condId; /** NUL-terminated name of the condition variable. */ - char name[32]; + char name[SCE_UID_NAMELEN + 1]; /** Attributes. */ SceUInt attr; /** Mutex associated with the condition variable. */ @@ -735,55 +737,59 @@ typedef struct SceKernelCondInfo { * condId = sceKernelCreateCond("MyCond", 0, mutexId, NULL); * @endcode * - * @param name - Specifies the name of the condition variable + * @param pName - Specifies the name of the condition variable * @param attr - Condition variable attribute flags (normally set to 0) * @param mutexId - Mutex to be related to the condition variable - * @param option - Condition variable options (normally set to 0) + * @param pOptParam - Condition variable options (normally set to 0) * @return A condition variable id */ -SceUID sceKernelCreateCond(const char *name, SceUInt attr, SceUID mutexId, const SceKernelCondOptParam *option); +SceUID sceKernelCreateCond( + const char *pName, + SceUInt32 attr, + SceUID mutexId, + const SceKernelCondOptParam *pOptParam); /** * Destroy a condition variable * * @param condition variableid - The condition variable id returned from ::sceKernelCreateCond - * @return Returns the value 0 if it's successful, otherwise -1 + * @return Returns the value 0 if it's successful, otherwise < 0 */ -int sceKernelDeleteCond(SceUID condId); +SceInt32 sceKernelDeleteCond(SceUID condId); /** * Open a condition variable * - * @param name - The name of the condition variable to open - * @return Returns the value 0 if it's successful, otherwise -1 + * @param pName - The name of the condition variable to open + * @return Returns an UID if successful, otherwise < 0 */ -int sceKernelOpenCond(const char *name); +SceUID sceKernelOpenCond(const char *pName); /** * Close a condition variable * * @param condition variableid - The condition variable id returned from ::sceKernelCreateCond - * @return Returns the value 0 if it's successful, otherwise -1 + * @return Returns the value 0 if it's successful, otherwise < 0 */ -int sceKernelCloseCond(SceUID condId); +SceInt32 sceKernelCloseCond(SceUID condId); /** * Waits for a signal of a condition variable * * @param condId - The condition variable id returned from ::sceKernelCreateCond - * @param timeout - Timeout in microseconds (assumed) + * @param pTimeout - Timeout in microseconds * @return < 0 On error. */ -int sceKernelWaitCond(SceUID condId, unsigned int *timeout); +SceInt32 sceKernelWaitCond(SceUID condId, SceUInt32 *pTimeout); /** * Waits for a signal of a condition variable (with callbacks) * * @param condId - The condition variable id returned from ::sceKernelCreateCond - * @param timeout - Timeout in microseconds (assumed) + * @param pTimeout - Timeout in microseconds * @return < 0 On error. */ -int sceKernelWaitCondCB(SceUID condId, unsigned int *timeout); +SceInt32 sceKernelWaitCondCB(SceUID condId, SceUInt32 *pTimeout); /** * Signals a condition variable @@ -791,7 +797,7 @@ int sceKernelWaitCondCB(SceUID condId, unsigned int *timeout); * @param condId - The condition variable id returned from ::sceKernelCreateCond * @return < 0 On error. */ -int sceKernelSignalCond(SceUID condId); +SceInt32 sceKernelSignalCond(SceUID condId); /** * Signals a condition variable to all threads waiting for it @@ -799,7 +805,7 @@ int sceKernelSignalCond(SceUID condId); * @param condId - The condition variable id returned from ::sceKernelCreateCond * @return < 0 On error. */ -int sceKernelSignalCondAll(SceUID condId); +SceInt32 sceKernelSignalCondAll(SceUID condId); /** * Signals a condition variable to a specific thread waiting for it @@ -808,31 +814,37 @@ int sceKernelSignalCondAll(SceUID condId); * @param threadId - The thread id returned from ::sceKernelCreateThread * @return < 0 On error. */ -int sceKernelSignalCondTo(SceUID condId, SceUID threadId); +SceInt32 sceKernelSignalCondTo(SceUID condId, SceUID threadId); + +SceInt32 sceKernelGetCondInfo(SceUID condId, SceKernelCondInfo *pInfo); /* Callbacks. */ /** Callback function prototype */ -typedef int (*SceKernelCallbackFunction)(int notifyId, int notifyCount, int notifyArg, void *common); +typedef SceInt32 (*SceKernelCallbackFunction)( + SceUID notifyId, + SceInt32 notifyCount, + SceInt32 notifyArg, + void *pCommon); /** Structure to hold the status information for a callback */ typedef struct SceKernelCallbackInfo { /** Size of the structure (i.e. sizeof(SceKernelCallbackInfo)) */ - SceSize size; + SceSize size; /** The UID of the callback. */ - SceUID callbackId; // Needs confirmation + SceUID callbackId; /** The name given to the callback */ - char name[32]; + char name[SCE_UID_NAMELEN + 1]; + SceUInt32 attr; /** The thread id associated with the callback */ - SceUID threadId; + SceUID threadId; /** Pointer to the callback function */ - SceKernelCallbackFunction callback; + SceKernelCallbackFunction callbackFunc; + SceUID notifyId; + SceInt32 notifyCount; + SceInt32 notifyArg; /** User supplied argument for the callback */ - void *common; - /** Unknown */ - int notifyCount; - /** Unknown */ - int notifyArg; + void *pCommon; } SceKernelCallbackInfo; /** @@ -845,209 +857,563 @@ typedef struct SceKernelCallbackInfo { * @endcode * * @param name - A textual name for the callback - * @param attr - ? - * @param func - A pointer to a function that will be called as the callback - * @param arg - Argument for the callback ? + * @param attr - Set to 0. There are no attributes. + * @param callbackFunc - A pointer to a function that will be called as the callback + * @param pCommon - Common data for the callback * * @return >= 0 A callback id which can be used in subsequent functions, < 0 an error. */ -int sceKernelCreateCallback(const char *name, unsigned int attr, SceKernelCallbackFunction func, void *arg); +SceUID sceKernelCreateCallback( + const char *name, + SceUInt32 attr, + SceKernelCallbackFunction callbackFunc, + void *pCommon); /** * Gets the status of a specified callback. * - * @param cb - The UID of the callback to retrieve info for. - * @param status - Pointer to a status structure. The size parameter should be + * @param callbackId - The UID of the callback to retrieve info for. + * @param pInfo - Pointer to a status structure. The size parameter should be * initialised before calling. * * @return < 0 on error. */ -int sceKernelGetCallbackInfo(SceUID cb, SceKernelCallbackInfo *infop); +SceInt32 sceKernelGetCallbackInfo(SceUID callbackId, SceKernelCallbackInfo *pInfo); /** * Delete a callback * - * @param cb - The UID of the specified callback + * @param callbackId - The UID of the specified callback * * @return 0 on success, < 0 on error */ -int sceKernelDeleteCallback(SceUID cb); +SceInt32 sceKernelDeleteCallback(SceUID callbackId); /** * Notify a callback * - * @param cb - The UID of the specified callback - * @param arg2 - Passed as arg2 into the callback function + * @param callbackId - The UID of the specified callback + * @param notifyArg - Passed as arg2 into the callback function * * @return 0 on success, < 0 on error */ -int sceKernelNotifyCallback(SceUID cb, int arg2); +SceInt32 sceKernelNotifyCallback(SceUID callbackId, SceInt32 notifyArg); /** * Cancel a callback ? * - * @param cb - The UID of the specified callback + * @param callbackId - The UID of the specified callback * * @return 0 on success, < 0 on error */ -int sceKernelCancelCallback(SceUID cb); +SceInt32 sceKernelCancelCallback(SceUID callbackId); /** * Get the callback count * - * @param cb - The UID of the specified callback + * @param callbackId - The UID of the specified callback * * @return The callback count, < 0 on error */ -int sceKernelGetCallbackCount(SceUID cb); +SceInt32 sceKernelGetCallbackCount(SceUID callbackId); /** - * Check callback ? + * Check callback notification * - * @return Something or another + * @return Callback notification count or < 0 on error */ -int sceKernelCheckCallback(void); +SceInt32 sceKernelCheckCallback(void); /* Message pipes */ +typedef struct _SceKernelMsgPipeOptParam { + SceSize size; + SceUInt32 attr; + SceInt32 reserved[2]; + SceUInt32 openLimit; +} SceKernelMsgPipeOptParam; + /** * Create a message pipe * - * @param name - Name of the pipe - * @param type - The type of memory attribute to use internally (set to 0x40) - * @param attr - Set to 12 - * @param bufSize - The size of the internal buffer in multiples of 0x1000 (4KB) - * @param opt - Message pipe options (set to NULL) + * @param pName - Name of the pipe + * @param type - Message pipe memory type + * @param attr - Message pipe attribute + * @param bufSize - The size of the internal buffer in multiples of 0x1000 (4KiB) up to 32MiB + * @param pOptParam - Message pipe options * * @return The UID of the created pipe, < 0 on error */ -SceUID sceKernelCreateMsgPipe(const char *name, int type, int attr, unsigned int bufSize, void *opt); +SceUID sceKernelCreateMsgPipe( + const char *pName, + SceUInt32 type, + SceUInt32 attr, + SceSize bufSize, + const SceKernelMsgPipeOptParam *pOptParam); /** * Delete a message pipe * - * @param uid - The UID of the pipe + * @param msgPipeId - The UID of the pipe * * @return 0 on success, < 0 on error */ -int sceKernelDeleteMsgPipe(SceUID uid); +SceInt32 sceKernelDeleteMsgPipe(SceUID msgPipeId); /** * Send a message to a pipe * - * @param uid - The UID of the pipe - * @param message - Pointer to the message - * @param size - Size of the message - * @param unk1 - Unknown - async vs sync? use 0 for sync - * @param unk2 - Unknown - use NULL - * @param timeout - Timeout for send in us. use NULL to wait indefinitely + * @param msgPipeId - The UID of the pipe + * @param pSendBuf - Pointer to the message + * @param sendSize - Size of the message + * @param waitMode - Wait mode when sending + * @param pResult - Pointer to area to store sent size + * @param pTimeout - Timeout in microseconds * * @return 0 on success, < 0 on error */ -int sceKernelSendMsgPipe(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout); +SceInt32 sceKernelSendMsgPipe( + SceUID msgPipeId, + const void *pSendBuf, + SceSize sendSize, + SceUInt32 waitMode, + SceSize *pResult, + SceUInt32 *pTimeout); /** * Send a message to a pipe (with callback) * - * @param uid - The UID of the pipe - * @param message - Pointer to the message - * @param size - Size of the message - * @param unk1 - Unknown - async vs sync? use 0 for sync - * @param unk2 - Unknown - use NULL - * @param timeout - Timeout for send in us. use NULL to wait indefinitely + * @param msgPipeId - The UID of the pipe + * @param pSendBuf - Pointer to the message + * @param sendSize - Size of the message + * @param waitMode - Wait mode when sending + * @param pResult - Pointer to area to store sent size + * @param pTimeout - Timeout in microseconds * * @return 0 on success, < 0 on error */ -int sceKernelSendMsgPipeCB(SceUID uid, void *message, unsigned int size, int unk1, void *unk2, unsigned int *timeout); +SceInt32 sceKernelSendMsgPipeCB( + SceUID msgPipeId, + const void *pSendBuf, + SceSize sendSize, + SceUInt32 waitMode, + SceSize *pResult, + SceUInt32 *pTimeout); /** - * Try to send a message to a pipe + * Send a message to a pipe (non blocking) * - * @param uid - The UID of the pipe - * @param message - Pointer to the message - * @param size - Size of the message - * @param unk1 - Unknown - use 0 - * @param unk2 - Unknown - use NULL + * @param msgPipeId - The UID of the pipe + * @param pSendBuf - Pointer to the message + * @param sendSize - Size of the message + * @param waitMode - Wait mode when sending + * @param pResult - Pointer to area to store sent size * * @return 0 on success, < 0 on error */ -int sceKernelTrySendMsgPipe(SceUID uid, void *message, SceSize size, int unk1, void *unk2); +SceInt32 sceKernelTrySendMsgPipe( + SceUID msgPipeId, + const void *pSendBuf, + SceSize sendSize, + SceUInt32 waitMode, + SceSize *pResult); /** * Receive a message from a pipe * - * @param uid - The UID of the pipe - * @param message - Pointer to the message - * @param size - Size of the message - * @param unk1 - Unknown - async vs sync? use 0 for sync - * @param unk2 - Unknown - use NULL - * @param timeout - Timeout for receive in us. use NULL to wait indefinitely + * @param msgPipeId - The UID of the pipe + * @param pRecvBuf - Pointer to the message + * @param recvSize - Size of the message + * @param waitMode - Wait mode when receiving + * @param pResult - Pointer to area to store received size + * @param pTimeout - Timeout in microseconds * * @return 0 on success, < 0 on error */ -int sceKernelReceiveMsgPipe(SceUID uid, void *message, SceSize size, int unk1, void *unk2, unsigned int *timeout); +SceInt32 sceKernelReceiveMsgPipe( + SceUID msgPipeId, + const void *pRecvBuf, + SceSize recvSize, + SceUInt32 waitMode, + SceSize *pResult, + SceUInt32 *pTimeout); /** * Receive a message from a pipe (with callback) * - * @param uid - The UID of the pipe - * @param message - Pointer to the message - * @param size - Size of the message - * @param unk1 - Unknown - async vs sync? use 0 for sync - * @param unk2 - Unknown - use NULL - * @param timeout - Timeout for receive in us. use NULL to wait indefinitely + * @param msgPipeId - The UID of the pipe + * @param pRecvBuf - Pointer to the message + * @param recvSize - Size of the message + * @param waitMode - Wait mode when receiving + * @param pResult - Pointer to area to store received size + * @param pTimeout - Timeout in microseconds * * @return 0 on success, < 0 on error */ -int sceKernelReceiveMsgPipeCB(SceUID uid, void *message, SceSize size, int unk1, void *unk2, unsigned int *timeout); +SceInt32 sceKernelReceiveMsgPipeCB( + SceUID msgPipeId, + const void *pRecvBuf, + SceSize recvSize, + SceUInt32 waitMode, + SceSize *pResult, + SceUInt32 *pTimeout); /** - * Receive a message from a pipe + * Receive a message from a pipe (non blocking) * - * @param uid - The UID of the pipe - * @param message - Pointer to the message - * @param size - Size of the message - * @param unk1 - Unknown - use 0 - * @param unk2 - Unknown - use NULL + * @param msgPipeId - The UID of the pipe + * @param pRecvBuf - Pointer to the message + * @param recvSize - Size of the message + * @param waitMode - Wait mode when receiving + * @param pResult - Pointer to area to store received size * * @return 0 on success, < 0 on error */ -int sceKernelTryReceiveMsgPipe(SceUID uid, void *message, SceSize size, int unk1, void *unk2); +SceInt32 sceKernelTryReceiveMsgPipe( + SceUID msgPipeId, + void *pRecvBuf, + SceSize recvSize, + SceUInt32 waitMode, + SceSize *pResult); /** * Cancel a message pipe * - * @param uid - UID of the pipe to cancel - * @param psend - Receive number of sending threads, NULL is valid - * @param precv - Receive number of receiving threads, NULL is valid + * @param msgPipeId - UID of the pipe to cancel + * @param pNumSendWaitThreads - Receive number of sending threads, NULL is valid + * @param pNumReceiveWaitThreads - Receive number of receiving threads, NULL is valid * * @return 0 on success, < 0 on error */ -int sceKernelCancelMsgPipe(SceUID uid, int *psend, int *precv); +SceInt32 sceKernelCancelMsgPipe( + SceUID msgPipeId, + SceUInt32 *pNumSendWaitThreads, + SceUInt32 *pNumReceiveWaitThreads); /** Message Pipe status info */ typedef struct SceKernelMppInfo { - SceSize size; - SceUID mppId; // Needs confirmation - char name[32]; - SceUInt attr; - int bufSize; - int freeSize; - int numSendWaitThreads; - int numReceiveWaitThreads; + SceSize size; + SceUID msgPipeId; + char name[SCE_UID_NAMELEN + 1]; + SceUInt32 attr; + SceSize bufSize; + SceSize freeSize; + SceUInt32 numSendWaitThreads; + SceUInt32 numReceiveWaitThreads; } SceKernelMppInfo; /** * Get the status of a Message Pipe * - * @param uid - The uid of the Message Pipe - * @param info - Pointer to a ::SceKernelMppInfo structure + * @param msgPipeId - The uid of the Message Pipe + * @param pInfo - Pointer to a ::SceKernelMppInfo structure * * @return 0 on success, < 0 on error */ -int sceKernelGetMsgPipeInfo(SceUID uid, SceKernelMppInfo *info); +SceInt32 sceKernelGetMsgPipeInfo(SceUID msgPipeId, SceKernelMppInfo *pInfo); + +SceUID sceKernelOpenMsgPipe(const char *pName); + +SceInt32 sceKernelCloseMsgPipe(SceUID msgPipeId); + +typedef struct _SceKernelMsgPipeVector { + void *pBase; + SceSize bufSize; +} SceKernelMsgPipeVector; + +SceInt32 sceKernelSendMsgPipeVector( + SceUID msgPipeId, + const SceKernelMsgPipeVector *pVector, + SceUInt32 numVector, + SceUInt32 waitMode, + SceSize *pResult, + SceUInt32 *pTimeout +); + +SceInt32 sceKernelSendMsgPipeVectorCB( + SceUID msgPipeId, + const SceKernelMsgPipeVector *pVector, + SceUInt32 numVector, + SceUInt32 waitMode, + SceSize *pResult, + SceUInt32 *pTimeout); + +SceInt32 sceKernelTrySendMsgPipeVector( + SceUID msgPipeId, + const SceKernelMsgPipeVector *pVector, + SceUInt32 numVector, + SceUInt32 waitMode, + SceSize *pResult); + +SceInt32 sceKernelReceiveMsgPipeVector( + SceUID msgPipeId, + const SceKernelMsgPipeVector *pVector, + SceUInt32 numVector, + SceUInt32 waitMode, + SceSize *pResult, + SceUInt32 *pTimeout); + +SceInt32 sceKernelReceiveMsgPipeVectorCB( + SceUID msgPipeId, + const SceKernelMsgPipeVector *pVector, + SceUInt32 numVector, + SceUInt32 waitMode, + SceSize *pResult, + SceUInt32 *pTimeout); + +SceInt32 sceKernelTryReceiveMsgPipeVector( + SceUID msgPipeId, + const SceKernelMsgPipeVector *pVector, + SceUInt32 numVector, + SceUInt32 waitMode, + SceSize *pResult); + +/* Thread event */ + +SceInt32 sceKernelRegisterCallbackToEvent(SceUID eventId, SceUID callbackId); + +SceInt32 sceKernelUnregisterCallbackFromEvent(SceUID eventId, SceUID callbackId); + +SceInt32 sceKernelUnregisterCallbackFromEventAll(SceUID eventId); + +typedef SceInt32 (*SceKernelThreadEventHandler)(SceInt32 type, SceUID threadId, SceInt32 arg, void *pCommon); + +typedef struct _SceKernelEventInfo { + SceSize size; + SceUID eventId; + char name[SCE_UID_NAMELEN + 1]; + SceUInt32 attr; + SceUInt32 eventPattern; + SceUInt64 userData; + SceUInt32 numWaitThreads; + SceInt32 reserved[1]; +} SceKernelEventInfo; + +SceInt32 sceKernelWaitEvent( + SceUID eventId, + SceUInt32 waitPattern, + SceUInt32 *pResultPattern, + SceUInt64 *pUserData, + SceUInt32 *pTimeout +); + +SceInt32 sceKernelWaitEventCB( + SceUID eventId, + SceUInt32 waitPattern, + SceUInt32 *pResultPattern, + SceUInt64 *pUserData, + SceUInt32 *pTimeout +); + +SceInt32 sceKernelPollEvent( + SceUID eventId, + SceUInt32 bitPattern, + SceUInt32 *pResultPattern, + SceUInt64 *pUserData +); + +typedef struct _SceKernelWaitEvent { + SceUID eventId; + SceUInt32 eventPattern; +} SceKernelWaitEvent; + +typedef struct _SceKernelResultEvent { + SceUID eventId; + SceInt32 result; + SceUInt32 resultPattern; + SceInt32 reserved[1]; + SceUInt64 userData; +} SceKernelResultEvent; + +SceInt32 sceKernelWaitMultipleEvents( + SceKernelWaitEvent *pWaitEventList, + SceUInt32 numEvents, + SceUInt32 waitMode, + SceKernelResultEvent *pResultEventList, + SceUInt32 *pTimeout); + +SceInt32 sceKernelWaitMultipleEventsCB( + SceKernelWaitEvent *pWaitEventList, + SceUInt32 numEvents, + SceUInt32 waitMode, + SceKernelResultEvent *pResultEventList, + SceUInt32 *pTimeout); + +SceInt32 sceKernelSetEvent( + SceUID eventId, + SceUInt32 setPattern, + SceUInt64 userData); + +SceInt32 sceKernelSetEventWithNotifyCallback( + SceUID eventId, + SceUInt32 setPattern, + SceUInt64 userData, + SceInt32 notifyArg); + +SceInt32 sceKernelPulseEvent( + SceUID eventId, + SceUInt32 pulsePattern, + SceUInt64 userData); + +SceInt32 sceKernelPulseEventWithNotifyCallback( + SceUID eventId, + SceUInt32 pulsePattern, + SceUInt64 userData, + SceInt32 notifyArg); + +SceInt32 sceKernelClearEvent( + SceUID eventId, + SceUInt32 clearPattern); + +SceInt32 sceKernelCancelEventWithSetPattern( + SceUID eventId, + SceUInt32 setPattern, + SceUInt64 userData, + SceUInt32 *pNumWaitThreads); + +SceInt32 sceKernelGetEventPattern( + SceUID eventId, + SceUInt32 *pPattern); + +SceInt32 sceKernelCancelEvent( + SceUID eventId, + SceUInt32 *pNumWaitThreads); + +SceInt32 sceKernelGetEventInfo( + SceUID eventId, + SceKernelEventInfo *pInfo); + +/* Reader/writer lock */ + +typedef struct _SceKernelRWLockOptParam { + SceSize size; +} SceKernelRWLockOptParam; + +typedef struct _SceKernelRWLockInfo { + SceSize size; + SceUID rwLockId; + char name[SCE_UID_NAMELEN + 1]; + SceUInt32 attr; + SceInt32 lockCount; + SceUID writeOwnerId; + SceUInt32 numReadWaitThreads; + SceUInt32 numWriteWaitThreads; +} SceKernelRWLockInfo; + +SceUID sceKernelCreateRWLock( + const char *pName, + SceUInt32 attr, + const SceKernelRWLockOptParam*pOptParam); + +SceInt32 sceKernelDeleteRWLock(SceUID rwLockId); + +SceUID sceKernelOpenRWLock(const char pName); + +SceInt32 sceKernelCloseRWLock(SceUID rwLockId); + +SceInt32 sceKernelLockReadRWLock(SceUID rwLockId, SceUInt32 *pTimeout); + +SceInt32 sceKernelLockReadRWLockCB(SceUID rwLockId, SceUInt32 *pTimeout); +SceInt32 sceKernelTryLockReadRWLock(SceUID rwLockId); + +SceInt32 sceKernelUnlockReadRWLock(SceUID rwLockId); + +SceInt32 sceKernelLockWriteRWLock(SceUID rwLockId, SceUInt32 *pTimeout); + +SceInt32 sceKernelLockWriteRWLockCB(SceUID rwLockId, SceUInt32 *pTimeout); + +SceInt32 sceKernelTryLockWriteRWLock(SceUID rwLockId); + +SceInt32 sceKernelUnlockWriteRWLock(SceUID rwLockId); + +SceInt32 sceKernelCancelRWLock( + SceUID rwLockId, + SceUInt32 *pNumReadWaitThreads, + SceUInt32 *pNumWriteWaitThreads, + SceInt32 flag); + +SceInt32 sceKernelGetRWLockInfo(SceUID rwLockId, SceKernelRWLockInfo *pInfo); + +/* Thread timer */ + +typedef struct _SceKernelTimerOptParam { + SceSize size; +} SceKernelTimerOptParam; + +typedef struct _SceKernelTimerInfo { + SceSize size; + SceUID timerId; + char name[SCE_UID_NAMELEN + 1]; + SceUInt32 attr; + SceInt32 fActive; + SceKernelSysClock baseTime; + SceKernelSysClock currentTime; + SceKernelSysClock schedule; + SceKernelSysClock interval; + SceInt32 type; + SceInt32 fRepeat; + SceUInt32 numWaitThreads; + SceInt32 reserved[1]; +} SceKernelTimerInfo; + +SceUID sceKernelCreateTimer( + const char *pName, + SceUInt32 attr, + const SceKernelTimerOptParam *pOptParam); + +SceInt32 sceKernelDeleteTimer(SceUID timerId); + +SceUID sceKernelOpenTimer(const char *pName); + +SceInt32 sceKernelCloseTimer(SceUID timerId); + +SceInt32 sceKernelStartTimer(SceUID timerId); + +SceInt32 sceKernelStopTimer(SceUID timerId); + +SceInt32 sceKernelGetTimerBase(SceUID timerId, SceKernelSysClock *pBase); + +SceUInt64 sceKernelGetTimerBaseWide(SceUID timerId); + +SceInt32 sceKernelGetTimerTime(SceUID timerId, SceKernelSysClock *pClock); + +SceUInt64 sceKernelGetTimerTimeWide(SceUID timerId); + +SceInt32 sceKernelSetTimerTime(SceUID timerId, SceKernelSysClock *pClock); + +SceUInt64 sceKernelSetTimerTimeWide(SceUID timerId, SceUInt64 clock); + +SceInt32 sceKernelSetTimerEvent( + SceUID timerId, + SceInt32 type, + SceKernelSysClock *pInterval, + SceInt32 fRepeat); + +SceInt32 sceKernelCancelTimer(SceUID timerId, SceUInt32 *pNumWaitThreads); + +SceInt32 sceKernelGetTimerInfo(SceUID timerId, SceKernelTimerInfo *pInfo); + +SceInt32 sceKernelGetTimerEventRemainingTime(SceUID timerId, SceKernelSysClock *pClock); + +/* Simple event */ + +typedef struct _SceKernelSimpleEventOptParam { + SceSize size; +} SceKernelSimpleEventOptParam; + +SceUID sceKernelCreateSimpleEvent( + const char *pName, + SceUInt32 attr, + SceUInt32 initPattern, + const SceKernelSimpleEventOptParam *pOptParam); + +SceInt32 sceKernelDeleteSimpleEvent(SceUID simpleEventId); + +SceUID sceKernelOpenSimpleEvent(const char *pName); + +SceInt32 sceKernelCloseSimpleEvent(SceUID simpleEventId); /* Misc. */ @@ -1059,17 +1425,17 @@ typedef struct SceKernelSystemInfo { SceKernelSysClock idleClock; SceUInt32 comesOutOfIdleCount; SceUInt32 threadSwitchCount; - } cpuInfo[4]; + } cpuInfo[SCE_KERNEL_MAX_CPU]; } SceKernelSystemInfo; /** * Get the system information * - * @param info - Pointer to a ::SceKernelSystemInfo structure + * @param pInfo - Pointer to a ::SceKernelSystemInfo structure * * @return 0 on success, < 0 on error */ -int sceKernelGetSystemInfo(SceKernelSystemInfo *info); +SceInt32 sceKernelGetSystemInfo(SceKernelSystemInfo *pInfo); /* Misc. */ @@ -1101,22 +1467,52 @@ typedef enum SceKernelIdListType { */ SceKernelIdListType sceKernelGetThreadmgrUIDClass(SceUID uid); +/* Lightweight mutex */ -typedef struct SceKernelLwMutexWork { +typedef struct SceKernelLwMutexWork { SceInt64 data[4]; } SceKernelLwMutexWork; typedef struct SceKernelLwMutexOptParam { - SceSize size; + SceSize size; } SceKernelLwMutexOptParam; -int sceKernelCreateLwMutex(SceKernelLwMutexWork *pWork,const char *pName, unsigned int attr, int initCount, const SceKernelLwMutexOptParam *pOptParam); -int sceKernelDeleteLwMutex(SceKernelLwMutexWork *pWork); -int sceKernelLockLwMutex(SceKernelLwMutexWork *pWork, int lockCount, unsigned int *pTimeout); -int sceKernelTryLockLwMutex(SceKernelLwMutexWork *pWork, int lockCount); -int sceKernelUnlockLwMutex(SceKernelLwMutexWork *pWork, int unlockCount); +typedef struct _SceKernelLwMutexInfo { + SceSize size; + SceUID uid; + char name[SCE_UID_NAMELEN + 1]; + SceUInt32 attr; + SceKernelLwMutexWork *pWork; + SceInt32 initCount; + SceInt32 currentCount; + SceUID currentOwnerId; + SceUInt32 numWaitThreads; +} SceKernelLwMutexInfo; + +SceInt32 sceKernelCreateLwMutex( + SceKernelLwMutexWork *pWork, + const char *pName, + SceUInt32 attr, + SceInt32 initCount, + const SceKernelLwMutexOptParam *pOptParam); + +SceInt32 sceKernelDeleteLwMutex(SceKernelLwMutexWork *pWork); + +SceInt32 sceKernelLockLwMutex(SceKernelLwMutexWork *pWork, SceInt32 lockCount, SceUInt32 *pTimeout); + +SceInt32 sceKernelLockLwMutexCB(SceKernelLwMutexWork *pWork, SceInt32 lockCount, SceUInt32 *pTimeout); + +SceInt32 sceKernelTryLockLwMutex(SceKernelLwMutexWork *pWork, SceInt32 lockCount); -typedef struct SceKernelLwCondWork { +SceInt32 sceKernelUnlockLwMutex(SceKernelLwMutexWork *pWork, SceInt32 unlockCount); + +SceInt32 sceKernelGetLwMutexInfo(SceKernelLwMutexWork *pWork, SceKernelLwMutexInfo *pInfo); + +SceInt32 sceKernelGetLwMutexInfoById(SceUID lwMutexId, SceKernelLwMutexInfo *pInfo); + +/* Lightweight condition */ + +typedef struct SceKernelLwCondWork { SceInt64 data[4]; } SceKernelLwCondWork; @@ -1124,10 +1520,37 @@ typedef struct SceKernelLwCondOptParam { SceSize size; } SceKernelLwCondOptParam; -int sceKernelCreateLwCond(SceKernelLwCondWork *pWork, const char *pName, unsigned int attr, SceKernelLwMutexWork *pLwMutex, const SceKernelLwCondOptParam *pOptParam); -int sceKernelDeleteLwCond(SceKernelLwCondWork *pWork); -int sceKernelSignalLwCond(SceKernelLwCondWork *pWork); -int sceKernelWaitLwCond(SceKernelLwCondWork *pWork, unsigned int *pTimeout); +typedef struct _SceKernelLwCondInfo { + SceSize size; + SceUID uid; + char name[SCE_UID_NAMELEN + 1]; + SceUInt32 attr; + SceKernelLwCondWork *pWork; + SceKernelLwMutexWork *pLwMutex; + SceUInt32 numWaitThreads; +} SceKernelLwCondInfo; + +SceInt32 sceKernelCreateLwCond( + SceKernelLwCondWork *pWork, + const char *pName, + SceUInt32 attr, + SceKernelLwMutexWork *pLwMutex, + const SceKernelLwCondOptParam *pOptParam +); + +SceInt32 sceKernelDeleteLwCond(SceKernelLwCondWork *pWork); + +SceInt32 sceKernelSignalLwCond(SceKernelLwCondWork *pWork); + +SceInt32 sceKernelWaitLwCond(SceKernelLwCondWork *pWork, SceUInt32 *pTimeout); + +SceInt32 sceKernelSignalLwCondAll(SceKernelLwCondWork *pWork); + +SceInt32 sceKernelSignalLwCondTo(SceKernelLwCondWork *pWork, SceUID threadId); + +SceInt32 sceKernelGetLwCondInfo (SceKernelLwCondWork *pWork, SceKernelLwCondInfo *pInfo); + +SceInt32 sceKernelGetLwCondInfoById(SceUID lwCondId, SceKernelLwCondInfo *pInfo); typedef struct SceKernelWaitSignalOptParam { SceUInt32 unk; @@ -1175,6 +1598,21 @@ void *sceKernelGetThreadTLSAddr(SceUID thid, int key); */ void *sceKernelGetTLSAddr(int key); +typedef enum _SceKernelThreadSpecificInfo { + SCE_THREAD_SPECIFIC_INFO_UNK_0, + SCE_THREAD_SPECIFIC_INFO_ID, + SCE_THREAD_SPECIFIC_INFO_STACK_START_ADDRESS, + SCE_THREAD_SPECIFIC_INFO_STACK_END_ADDRESS, + SCE_THREAD_SPECIFIC_INFO_VFP_EXCEPTION, + SCE_THREAD_SPECIFIC_INFO_LWMUTEX_STATUS, + SCE_THREAD_SPECIFIC_INFO_UNK_6, + SCE_THREAD_SPECIFIC_INFO_UNK_7, + SCE_THREAD_SPECIFIC_INFO_PRIORITY, + SCE_THREAD_SPECIFIC_INFO_AFFINITY, +} SceKernelThreadSpecificInfo; + +SceUnion32 sceKernelGetThreadSpecificInfo(SceUID threadId, SceKernelThreadSpecificInfo info); + #ifdef __cplusplus } #endif diff --git a/include/user/notification_util.h b/include/user/notification_util.h new file mode 100644 index 0000000..4aa362a --- /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_NOTIFICATION_UTIL_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/paf.h b/include/user/paf.h index f01190e..2cf7444 100644 --- a/include/user/paf.h +++ b/include/user/paf.h @@ -1,32 +1,115 @@ #ifndef _PSP2_PAF_H_ #define _PSP2_PAF_H_ +#include <stdarg.h> +#include <wchar.h> #include <psp2/types.h> +#include <psp2/ces/error.h> #ifdef __cplusplus extern "C" { #endif -void sce_paf_private_free(void *ptr); -void *sce_paf_private_malloc(SceSize size); -void *sce_paf_private_bzero(void *ptr, SceSize num); -void *sce_paf_private_memchr(const void *ptr, int value, SceSize num); -int sce_paf_private_memcmp(const void *ptr1, const void *ptr2, SceSize num); -int sce_paf_private_bcmp(const void *ptr1, const void *ptr2, SceSize num); -void *sce_paf_private_memcpy(void *destination, const void *source, SceSize num); -void *sce_paf_private_memcpy2(void *destination, const void *source, SceSize num); -void *sce_paf_private_memmove(void *destination, const void *source, SceSize num); -void *sce_paf_private_bcopy(void *destination, const void *source, SceSize num); -void *sce_paf_private_memset(void *ptr, int value, SceSize num); -int sce_paf_private_snprintf(char *s, SceSize n, const char *format, ...); -int sce_paf_private_strcasecmp(const char *str1, const char *str2); -char *sce_paf_private_strchr(const char *str, int character); -int sce_paf_private_strcmp(const char *str1, const char *str2); -size_t sce_paf_private_strlen(const char *str); -int sce_paf_private_strncasecmp(const char *str1, const char *str2, SceSize num); -int sce_paf_private_strncmp(const char *str1, const char *str2, SceSize num); -char *sce_paf_private_strncpy(char *destination, const char *source, SceSize num); -char *sce_paf_private_strrchr(const char *str, int character); +typedef struct ScePafString { + char *data; + SceSize length; +} ScePafString; + +typedef struct ScePafWString { + SceWChar16 *data; + SceSize length; +} ScePafWString; + +/** + * std C functions + */ + +void sce_paf_free(void *ptr); +void *sce_paf_malloc(SceSize size); +void *sce_paf_bzero(void *ptr, SceSize num); +void *sce_paf_memchr(const void *ptr, int value, SceSize num); +int sce_paf_memcmp(const void *ptr1, const void *ptr2, SceSize num); +int sce_paf_bcmp(const void *ptr1, const void *ptr2, SceSize num); +void *sce_paf_memcpy(void *destination, const void *source, SceSize num); +void *sce_paf_memcpy2(void *destination, const void *source, SceSize num); +void *sce_paf_memmove(void *destination, const void *source, SceSize num); +void *sce_paf_bcopy(void *destination, const void *source, SceSize num); +void *sce_paf_memset(void *ptr, int value, SceSize num); +int sce_paf_snprintf(char *s, SceSize n, const char *format, ...); +int sce_paf_strcasecmp(const char *str1, const char *str2); +char *sce_paf_strchr(const char *str, int character); +int sce_paf_strcmp(const char *str1, const char *str2); +size_t sce_paf_strlen(const char *str); +int sce_paf_strncasecmp(const char *str1, const char *str2, SceSize num); +int sce_paf_strncmp(const char *str1, const char *str2, SceSize num); +char *sce_paf_strncpy(char *destination, const char *source, SceSize num); +char *sce_paf_strrchr(const char *str, int character); + +/** + * wchar functions + */ + +/* __attribute__((__format__(__wprintf__, 3, 4))) */ +int sce_paf_swprintf(wchar_t *buffer, size_t bufsz, const wchar_t *format, ...); + +int sce_paf_vswprintf(wchar_t *buffer, size_t bufsz, const wchar_t *format, va_list vlist); + +wint_t sce_paf_towlower(wint_t wc); + +wchar_t *sce_paf_wcscat(wchar_t *dest, const wchar_t *src); +wchar_t *sce_paf_wcsncat(wchar_t *dest, const wchar_t *src, size_t count); +wchar_t *sce_paf_wcscpy(wchar_t *dest, const wchar_t *src); +wchar_t *sce_paf_wcsncpy(wchar_t *dest, const wchar_t *src, size_t count); + +int sce_paf_wcscasecmp(const wchar_t *s1, const wchar_t *s2); +wchar_t *sce_paf_wcschr(const wchar_t *str, wchar_t ch); +int sce_paf_wcscmp(const wchar_t *lhs, const wchar_t *rhs); +size_t sce_paf_wcscspn(const wchar_t *dest, const wchar_t *src); +size_t sce_paf_wcslen(const wchar_t *str); +int sce_paf_wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n); +int sce_paf_wcsncmp(const wchar_t *lhs, const wchar_t *rhs, size_t count); +size_t sce_paf_wcsnlen(const wchar_t *s, size_t maxlen); +wchar_t *sce_paf_wcspbrk(const wchar_t *dest, const wchar_t *str); +wchar_t *sce_paf_wcsrchr(const wchar_t *str, wchar_t ch); +size_t sce_paf_wcsspn(const wchar_t *dest, const wchar_t *src); + +wchar_t *sce_paf_wmemchr(const wchar_t *ptr, wchar_t ch, size_t count); +int sce_paf_wmemcmp(const wchar_t *lhs, const wchar_t *rhs, size_t count); +wchar_t *sce_paf_wmemcpy(wchar_t *dest, const wchar_t *src, size_t count); +wchar_t *sce_paf_wmemmove(wchar_t *dest, const wchar_t *src, size_t count); + +/** + * CES functions + */ + +#define SCE_PAF_CES_ALLOW_ILLEGAL_CODE 0x2 +#define SCE_PAF_CES_ALLOW_OUT_OF_CODE_RANGE 0x4 +#define SCE_PAF_CES_ALLOW_INVALID_ENCODE 0x8 +#define SCE_PAF_CES_ALLOW_SRC_BUFFER_END 0x10 + +/* UTF8 to UTF16 */ + +SceSSize scePafCesUtf8ToUtf16(const ScePafString *utf8, ScePafWString *utf16); + +SceSSize scePafCesUtf8ToUtf16WithFlag(const ScePafString *utf8, ScePafWString *utf16, SceUInt32 flags); + +SceSSize scePafCesUtf8CharToUtf16(const char *utf8, ScePafWString *utf16); + +SceSSize scePafCesUtf8CharToUtf16WithFlag(const char *utf8, ScePafWString *utf16, SceUInt32 flags); + +ScePafWString *scePafCesUtf8CharToUtf16WithAlloc(const char *utf8, ScePafWString *utf16); + +/* UTF16 to UTF8 */ + +SceSSize scePafCesUtf16ToUtf8(const ScePafWString *utf16, ScePafString *utf8); + +SceSSize scePafCesUtf16ToUtf8WithFlag(const ScePafWString *utf16, ScePafString *utf8, SceUInt32 flags); + +SceSSize scePafCesUtf16CharToUtf8(const SceWChar16 *utf16, ScePafString *utf8); + +SceSSize scePafCesUtf16CharToUtf8WithFlag(const SceWChar16 *utf16, ScePafString *utf8, SceUInt32 flags); + +ScePafString *scePafCesUtf16CharToUtf8WithAlloc(const SceWChar16 *utf16, ScePafString *utf8); #ifdef __cplusplus } diff --git a/include/user/power.h b/include/user/power.h index ed35bed..8148139 100644 --- a/include/user/power.h +++ b/include/user/power.h @@ -18,30 +18,24 @@ typedef enum ScePowerErrorCode { } ScePowerErrorCode; typedef enum ScePowerCallbackType { - /** indicates the unit is using battery as power source */ - SCE_POWER_CB_BATTERY_MODE = 0x00000000, + /** indicates the power button was pushed, putting the unit into suspend mode */ + SCE_POWER_CB_POWER_SWITCH = 0x80000000, + /** ? screen on after off ? **/ + SCE_POWER_CB_UNK_1 = 0x00600000, + /** ? screen off ? **/ + SCE_POWER_CB_UNK_2 = 0x00400000, + /** indicates the unit has finish resuming from suspend mode */ + SCE_POWER_CB_RESUME_COMPLETE = 0x00040000, + /** indicates the unit is resuming from suspend mode */ + SCE_POWER_CB_RESUMING = 0x00020000, + /** indicates the unit is suspending, seems to occur due to inactivity */ + SCE_POWER_CB_SUSPENDING = 0x00010000, + /** indicates the unit is plugged into an AC outlet */ + SCE_POWER_CB_AC_POWER = 0x00001000, /** indicates the battery is in low state */ - SCE_POWER_CB_LOW_BATTERY = 0x00000100, - /** indicates the unit is using an AC outlet as power source */ - SCE_POWER_CB_AC_POWER_MODE = 0x00001000, - /** indicates the unit has been shutdown **/ - SCE_POWER_CB_SHUTDOWN = 0x00010000, - /** indicates the application resumed after being put in suspend from a LiveArea event **/ - SCE_POWER_CB_RESUME_LIVEAREA = 0x00200000, - /** indicates the unit entered suspend mode **/ - SCE_POWER_CB_SUSPENDING = 0x00400000, - /** indicates the unit resumed from suspend mode **/ - SCE_POWER_CB_RESUMING = 0x00800000, - /** indicates the system is taking a screenshot **/ - SCE_POWER_CB_SCREENSHOT_TRIGGER = 0x04000000, - /** indicates the system shown the Quick Menu screen **/ - SCE_POWER_CB_QUICK_MENU_TRIGGER = 0x10000000, - /** indicates the PS button was pushed **/ - SCE_POWER_CB_PS_BUTTON_PRESS = 0x20000000, - /** indicates the system shown the shutdown screen **/ - SCE_POWER_CB_SHUTDOWN_MENU_TRIGGER = 0x40000000, - /** indicates the system shown the unlock screen **/ - SCE_POWER_CB_UNLOCK_MENU_TRIGGER = 0x80000000, + SCE_POWER_CB_LOWBATTERY = 0x00000100, + /** indicates there is a battery present in the unit */ + SCE_POWER_CB_BATTERY_EXIST = 0x00000080 } ScePowerCallbackType; /* GPU, WLAN/COM configuration setting */ diff --git a/include/user/registrymgr.h b/include/user/registrymgr.h index cc363b5..a85a56b 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 @@ -131,7 +131,6 @@ int sceRegMgrSystemParamGetInt(const int id, int* buf); */ int sceRegMgrSystemParamGetStr(const int id, char* buf, const int size); - /** * Get the registry version * @@ -142,6 +141,70 @@ int sceRegMgrSystemParamGetStr(const int id, char* buf, const int size); */ int sceRegMgrGetRegVersion(int version, char* buf); +/** + * Get binary registry key by id + * + * @param id - The id of the key + * @param buf[out] - Pointer to a buffer + * @param size - The size of the buffer + * + * @return 0 on success, < 0 on error + */ +SceInt32 sceRegMgrUtilityGetBin(SceUInt32 id, void *buf, SceSize size); + +/** + * Get integer registry key by id + * + * @param id - The id of the key + * @param buf[out] - Pointer to a buffer + * + * @return 0 on success, < 0 on error + */ +SceInt32 sceRegMgrUtilityGetInt(SceUInt32 id, SceInt32 *buf); + +/** + * Get char array registry key by id + * + * @param id - The id of the key + * @param buf[out] - Pointer to a buffer + * @param size - The size of the buffer + * + * @return 0 on success, < 0 on error + */ +SceInt32 sceRegMgrUtilityGetStr(SceUInt32 id, char *buf, SceSize size); + +/** + * Set binary registry key by id + * + * @param id - The id of the key + * @param buf - Pointer to a buffer + * @param size - The size of the buffer + * + * @return 0 on success, < 0 on error + */ +SceInt32 sceRegMgrUtilitySetBin(SceUInt32 id, const void *buf, SceSize size); + + +/** + * Set integer registry key by id + * + * @param id - The id of the key + * @param val - Value to set + * + * @return 0 on success, < 0 on error + */ +SceInt32 sceRegMgrUtilitySetInt(SceUInt32 id, SceInt32 val); + +/** + * Set char array registry key by id + * + * @param id - The id of the key + * @param buf - Pointer to a buffer + * @param size - The size of the buffer + * + * @return 0 on success, < 0 on error + */ +SceInt32 sceRegMgrUtilitySetStr(SceUInt32 id, const char *buf, SceSize size); #ifdef __cplusplus } diff --git a/include/user/sharedfb.h b/include/user/sharedfb.h deleted file mode 100644 index 1919245..0000000 --- a/include/user/sharedfb.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef _PSP2_SHAREDFB_H_ -#define _PSP2_SHAREDFB_H_ - -#include <psp2/types.h> -#include <psp2/defs.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct SceSharedFbInfo { - void *fb_base; - int fb_size; - void *fb_base2; - int unk0[6]; - int stride; - int width; - int height; - int unk1; - int index; - int unk2[4]; - int vsync; - int unk3[3]; -} SceSharedFbInfo; - -SceUID _sceSharedFbOpen(int index, int sysver); -int sceSharedFbClose(SceUID fb_id); -int sceSharedFbBegin(SceUID fb_id, SceSharedFbInfo *info); -int sceSharedFbEnd(SceUID fb_id); -int sceSharedFbGetInfo(SceUID fb_id, SceSharedFbInfo *info); - -static inline -SceUID sceSharedFbOpen(int index) -{ - return _sceSharedFbOpen(index, PSP2_SDK_VERSION); -}; - -#ifdef __cplusplus -} -#endif - -#endif /* _PSP2_SHAREDFB_H_ */ diff --git a/include/user/shellsvc.h b/include/user/shellsvc.h new file mode 100644 index 0000000..462fa13 --- /dev/null +++ b/include/user/shellsvc.h @@ -0,0 +1,179 @@ +#ifndef _DOLCESDK_PSP2_SHELLSVC_H_ +#define _DOLCESDK_PSP2_SHELLSVC_H_ + +#include <psp2/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* SceShellUtil */ + +typedef enum SceShellUtilLockType { + SCE_SHELL_UTIL_LOCK_TYPE_PS_BTN = 0x1, + SCE_SHELL_UTIL_LOCK_TYPE_QUICK_MENU = 0x2, + SCE_SHELL_UTIL_LOCK_TYPE_POWEROFF_MENU = 0x4, + SCE_SHELL_UTIL_LOCK_TYPE_UNK8 = 0x8, + SCE_SHELL_UTIL_LOCK_TYPE_USB_CONNECTION = 0x10, + SCE_SHELL_UTIL_LOCK_TYPE_MC_INSERTED = 0x20, + SCE_SHELL_UTIL_LOCK_TYPE_MC_REMOVED = 0x40, + SCE_SHELL_UTIL_LOCK_TYPE_UNK80 = 0x80, + SCE_SHELL_UTIL_LOCK_TYPE_UNK100 = 0x100, + SCE_SHELL_UTIL_LOCK_TYPE_UNK200 = 0x200, + SCE_SHELL_UTIL_LOCK_TYPE_MUSIC_PLAYER = 0x400, + SCE_SHELL_UTIL_LOCK_TYPE_PS_BTN_2 = 0x800 //! without the stop symbol +} SceShellUtilLockType; + +typedef enum SceShellUtilLockMode { + SCE_SHELL_UTIL_LOCK_MODE_LOCK = 1, + SCE_SHELL_UTIL_LOCK_MODE_UNLOCK = 2 +} SceShellUtilLockMode; + +typedef void (SceShellUtilEventHandler)(int result, SceShellUtilLockMode mode, SceShellUtilLockType type, void *userData); + +/** + * Init events + * + * @param[in] unk - Unknown, use 0 + * + * @return 0 on success, < 0 on error. +*/ +int sceShellUtilInitEvents(int unk); + +/** + * Register event handler + * + * @param[in] handler - Event handler + * + * @param[in] userData - The user data passed to the handler + * + * @return 0 on success, < 0 on error. +*/ +int sceShellUtilRegisterEventHandler(SceShellUtilEventHandler *handler, void *userData); + +/** + * Lock event + * + * @param[in] type - One of ::SceShellUtilLockType + * + * @return 0 on success, < 0 on error. +*/ +int sceShellUtilLock(SceShellUtilLockType type); + +/** + * Unlock event + * + * @param[in] type - One of ::SceShellUtilLockType + * + * @return 0 on success, < 0 on error. +*/ +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); + +/* SceShellSvc */ + +typedef struct SceShellSvcSvcObjVtable SceShellSvcSvcObjVtable; + +typedef struct SceShellSvcSvcObj { + SceShellSvcSvcObjVtable *vptr; + // more ... +} SceShellSvcSvcObj; + +SceShellSvcSvcObj *sceShellSvcGetSvcObj(void); + +#ifdef __cplusplus +} +#endif + +#endif /* _DOLCESDK_PSP2_SHELLSVC_H_ */ + diff --git a/include/user/shellutil.h b/include/user/shellutil.h index 61d602b..6ae648c 100644 --- a/include/user/shellutil.h +++ b/include/user/shellutil.h @@ -1,73 +1,3 @@ -#ifndef _PSP2_SHELLUTIL_H_ -#define _PSP2_SHELLUTIL_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum SceShellUtilLockType { - SCE_SHELL_UTIL_LOCK_TYPE_PS_BTN = 0x1, - SCE_SHELL_UTIL_LOCK_TYPE_QUICK_MENU = 0x2, - SCE_SHELL_UTIL_LOCK_TYPE_POWEROFF_MENU = 0x4, - SCE_SHELL_UTIL_LOCK_TYPE_UNK8 = 0x8, - SCE_SHELL_UTIL_LOCK_TYPE_USB_CONNECTION = 0x10, - SCE_SHELL_UTIL_LOCK_TYPE_MC_INSERTED = 0x20, - SCE_SHELL_UTIL_LOCK_TYPE_MC_REMOVED = 0x40, - SCE_SHELL_UTIL_LOCK_TYPE_UNK80 = 0x80, - SCE_SHELL_UTIL_LOCK_TYPE_UNK100 = 0x100, - SCE_SHELL_UTIL_LOCK_TYPE_UNK200 = 0x200, - SCE_SHELL_UTIL_LOCK_TYPE_MUSIC_PLAYER = 0x400, - SCE_SHELL_UTIL_LOCK_TYPE_PS_BTN_2 = 0x800 //! without the stop symbol -} SceShellUtilLockType; - -typedef enum SceShellUtilLockMode { - SCE_SHELL_UTIL_LOCK_MODE_LOCK = 1, - SCE_SHELL_UTIL_LOCK_MODE_UNLOCK = 2 -} SceShellUtilLockMode; - -typedef void (SceShellUtilEventHandler)(int result, SceShellUtilLockMode mode, SceShellUtilLockType type, void *userData); - -/** - * Init events - * - * @param[in] unk - Unknown, use 0 - * - * @return 0 on success, < 0 on error. -*/ -int sceShellUtilInitEvents(int unk); - -/** - * Register event handler - * - * @param[in] handler - Event handler - * - * @param[in] userData - The user data passed to the handler - * - * @return 0 on success, < 0 on error. -*/ -int sceShellUtilRegisterEventHandler(SceShellUtilEventHandler *handler, void *userData); - -/** - * Lock event - * - * @param[in] type - One of ::SceShellUtilLockType - * - * @return 0 on success, < 0 on error. -*/ -int sceShellUtilLock(SceShellUtilLockType type); - -/** - * Unlock event - * - * @param[in] type - One of ::SceShellUtilLockType - * - * @return 0 on success, < 0 on error. -*/ -int sceShellUtilUnlock(SceShellUtilLockType type); - -#ifdef __cplusplus -} -#endif - -#endif /* _PSP2_SHELLUTIL_H_ */ +#pragma message "psp2/shellutil.h is deprecated. Please include psp2/shellsvc.h." +#include <psp2/shellsvc.h> diff --git a/include/user/trigger_util.h b/include/user/trigger_util.h new file mode 100644 index 0000000..3ac6e09 --- /dev/null +++ b/include/user/trigger_util.h @@ -0,0 +1,232 @@ +#ifndef _DOLCESDK_PSP2_TRIGGER_UTIL_H_ +#define _DOLCESDK_PSP2_TRIGGER_UTIL_H_ + +#include <psp2/kernel/clib.h> +#include <psp2/rtc.h> +#include <psp2/types.h> + +#ifdef __cplusplus +extern "C" { +#endif + +// NOTE1: Last two params in all of the functions are never used, probably callbacks since all sceTriggerUtil functions are non-blocking +// NOTE2: Max number of events (eventId) per application is 8 + +#define SCE_TRIGGER_UTIL_VERSION 0x3100000 + +/** + * Days of the week for use in repeatDays member of ::SceTriggerUtilEventParamDaily + */ +typedef enum SceTriggerUtilDays { + SCE_TRIGGER_UTIL_SUNDAY = 0x1, + SCE_TRIGGER_UTIL_MONDAY = 0x2, + SCE_TRIGGER_UTIL_TUESDAY = 0x4, + SCE_TRIGGER_UTIL_WEDNESDAY = 0x8, + SCE_TRIGGER_UTIL_THURSDAY = 0x10, + SCE_TRIGGER_UTIL_FRIDAY = 0x20, + SCE_TRIGGER_UTIL_SATURDAY = 0x40, +} SceTriggerUtilDays; + +/** + * Errors + */ +#define SCE_TRIGGER_UTIL_ERROR_BUSY 0x80103601 +#define SCE_TRIGGER_UTIL_ERROR_NOT_FOUND_USER 0x80103610 +#define SCE_TRIGGER_UTIL_ERROR_NOT_FOUND_SYSTEM 0x80103612 +#define SCE_TRIGGER_UTIL_ERROR_NOT_REGISTERED 0x80103620 +#define SCE_TRIGGER_UTIL_ERROR_EVENT_TYPE_MISMATCH 0x80103623 +#define SCE_TRIGGER_UTIL_ERROR_INVALID_ARG 0x80103650 + +typedef struct SceTriggerUtilEventParamDaily { // size is 0x50 + SceUInt32 ver; + SceInt32 triggerTime; // POSIX time + SceInt16 extraParam1; // set to 1 + SceInt16 extraParam2; // set to 0 + SceUInt16 repeatDays; // bitwise + SceChar8 reserved[0x40]; +} SceTriggerUtilEventParamDaily; + +typedef struct SceTriggerUtilEventParamOneTime { // size is 0x58 + SceUInt32 ver; + SceInt32 a2; + SceRtcTick triggerTime; // SceRtcTick, UTC + SceUInt8 extraParam1; // set to 1 + SceUInt8 extraParam2; // set to 0 + SceChar8 reserved[0x44]; +} SceTriggerUtilEventParamOneTime; + +typedef struct SceTriggerUtilUserAppInfo { // size is 0x46A + SceWChar16 name[0x34]; + SceChar8 iconPath[0x400]; + short unk; +} SceTriggerUtilUserAppInfo; + +typedef struct SceTriggerUtilSystemAppInfo { // size is 0x602 + SceWChar16 name[0x100]; + SceChar8 iconPath[0x400]; + char reserved[0x102]; +} SceTriggerUtilSystemAppInfo; + +/** + * Register application start event that will be repeated on certain days + * + * @param[in] titleid - title ID of application to register event for. + * @param[in] param - event parameters. + * @param[in] eventId - ID number of event. + * @param[in] a4 - Unknown, set to 0. + * @param[in] a5 - Unknown, set to 0. + * + * @return 0 on success, <0 otherwise. + */ +int sceTriggerUtilRegisterDailyEvent( + const char* titleid, + const SceTriggerUtilEventParamDaily* param, + int eventId, + int a4, + int a5); + +/** + * Register one time application start event + * + * @param[in] titleid - title ID of application to register event for. + * @param[in] param - event parameters. + * @param[in] eventId - ID number of event. + * @param[in] a4 - Unknown, set to 0. + * @param[in] a5 - Unknown, set to 0. + * + * @return 0 on success, <0 otherwise. + */ +int sceTriggerUtilRegisterOneTimeEvent( + const char* titleid, + const SceTriggerUtilEventParamOneTime* param, + int eventId, + int a4, + int a5); + +/** + * Unregister daily event for caller application + * + * @param[in] eventId - ID number of event to unregister. + * @param[in] a2 - Unknown, set to 0. + * @param[in] a3 - Unknown, set to 0. + * + * @return 0 on success, <0 otherwise. + */ +int sceTriggerUtilUnregisterDailyEvent(int eventId, int a2, int a3); + +/** + * Unregister one time event for caller application + * + * @param[in] eventId - ID number of event to unregister. + * @param[in] a2 - Unknown, set to 0. + * @param[in] a3 - Unknown, set to 0. + * + * @return 0 on success, <0 otherwise. + */ +int sceTriggerUtilUnregisterOneTimeEvent(int eventId, int a2, int a3); + +/** + * Get value from "Settings->System->Auto-Start Settings" for caller application. Required to be 1 to use sceTriggerUtil + * + * @param[out] status - auto-start status. Required to be 1 to use sceTriggerUtil. + * @param[in] a2 - Unknown, set to 0. + * @param[in] a3 - Unknown, set to 0. + * + * @return 0 on success, <0 otherwise. + */ +int sceTriggerUtilGetAutoStartStatus(int* status, int a2, int a3); + +/** + * Get one time event info for caller application + * + * @param[in] eventId - ID number of event to get information for. + * @param[out] triggerTime - SceRtcTick, UTC + * @param[out] unk_ptr - Unknown + * @param[in] a4 - Unknown, set to 0. + * @param[in] a5 - Unknown, set to 0. + * + * @return 0 on success, <0 otherwise. + */ +int sceTriggerUtilGetOneTimeEventInfo(int eventId, SceRtcTick* triggerTime, int* unk_ptr, int a4, int a5); + +/** + * Get daily event info for caller application + * + * @param[in] eventId - ID number of event to get information for. + * @param[out] unk_ptr - Unknown + * @param[out] param - event parameters. + * @param[out] timeUntilEvent - POSIX time until next event trigger + * @param[in] a5 - Unknown, set to 0. + * @param[in] a6 - Unknown, set to 0. + * + * @return 0 on success, <0 otherwise. + */ +int sceTriggerUtilGetDailyEventInfo( + int eventId, + int* unk_ptr, + SceTriggerUtilEventParamDaily* param, + SceInt32* timeUntilEvent, + int a5, + int a6); + +/** + * Get info for user application that has registered sceTriggerUtil events + * + * @param[in] titleid - title ID of application to get info for. + * @param[out] unk_ptr - Unknown + * @param[out] appInfo - application information + * @param[in] a4 - Unknown, set to 0. + * @param[in] a5 - Unknown, set to 0. + * + * @return 0 on success, <0 otherwise. + */ +int sceTriggerUtilGetUserAppInfo( + const char* titleid, + int* unk_ptr, + SceTriggerUtilUserAppInfo* appInfo, + int a4, + int a5); + +/** + * Get list of user applications that has registered sceTriggerUtil events. List contains null-separated title IDs + * + * @param[out] titleIdBuffer - pointer to buffer to recieve title ID list. Max size is 0x1000, min size is unlimited + * @param[out] numOfIds - number of title IDs stored in the list + * + * @return 0 on success, <0 otherwise. + */ +int sceTriggerUtilGetRegisteredUserTitleIdList(char* titleIdBuffer, int* numOfIds); + +/** + * Get info for system application that has registered sceTriggerUtil events + * + * @param[in] titleid - title ID of application to get info for. + * @param[out] unk_ptr - Unknown + * @param[out] appInfo - application information + * @param[in] a4 - Unknown, set to 0. + * @param[in] a5 - Unknown, set to 0. + * + * @return 0 on success, <0 otherwise. + */ +int sceTriggerUtilGetSystemAppInfo( + const char* titleid, + int* unk_ptr, + SceTriggerUtilSystemAppInfo* appInfo, + int a4, + int a5); + +/** + * Get list of system applications that has registered sceTriggerUtil events. List contains null-separated fake title IDs + * + * @param[out] titleIdBuffer - pointer to buffer to recieve fake title ID list. Max size is 0x140, min size is unlimited + * @param[out] numOfIds - number of fake title IDs stored in the list + * + * @return 0 on success, <0 otherwise. + */ +int sceTriggerUtilGetRegisteredSystemTitleIdList(char* buffer, int *numOfIds); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* _DOLCESDK_PSP2_TRIGGER_UTIL_H_ */ diff --git a/include/user/vshbridge.h b/include/user/vshbridge.h index e2771f3..09f256b 100644 --- a/include/user/vshbridge.h +++ b/include/user/vshbridge.h @@ -42,7 +42,7 @@ int _vshIoMount(int id, const char *path, int permission, void *buf); * * @return 0 >= on success, < 0 on error. */ -int vshIoUmount(int id, int force, int unk2, int unk3); +int vshIoUmount(int id, int force, int unk2, int unk3); int vshIdStorageIsDirty(void); int vshIdStorageIsFormatted(void); @@ -64,6 +64,15 @@ int vshIdStorageReadLeaf(SceSize leafnum, void *buf); */ int vshIdStorageWriteLeaf(SceSize leafnum, const void *buf); +/** + * Sets the PS button hold time for showing the quick menu. + * + * @param time - Time in microseconds. + * + * @return 0 always + */ +int vshPowerSetPsButtonPushTime(int time); + int vshSblAimgrIsCEX(void); int vshSblAimgrIsDEX(void); int vshSblAimgrIsVITA(void); diff --git a/nids/360/SceBgAppUtil.yml b/nids/360/SceBgAppUtil.yml new file mode 100644 index 0000000..3547c65 --- /dev/null +++ b/nids/360/SceBgAppUtil.yml @@ -0,0 +1,8 @@ +modules: + SceBgAppUtil: + nid: 0x795E683F + libraries: + SceBgAppUtil: + nid: 0xF9516A07 + functions: + sceBgAppUtilStartBgApp: 0x7C3525B5 diff --git a/nids/360/SceGxm.yml b/nids/360/SceGxm.yml index 830a96c..9e15811 100644 --- a/nids/360/SceGxm.yml +++ b/nids/360/SceGxm.yml @@ -8,6 +8,7 @@ modules: sceGxmAddRazorGpuCaptureBuffer: 0xE9E81073 sceGxmBeginCommandList: 0x944D3F83 sceGxmBeginScene: 0x8734FF4E + sceGxmBeginScene0940: 0xDBA33160 sceGxmBeginSceneEx: 0x4709CF5A sceGxmColorSurfaceGetClip: 0x07DFEE4B sceGxmColorSurfaceGetData: 0x2DB6026C @@ -75,6 +76,7 @@ modules: sceGxmMapMemory: 0xC61E34FC sceGxmMapVertexUsseMemory: 0xFA437510 sceGxmMidSceneFlush: 0x2B5C0444 + sceGxmMidSceneFlush0940: 0x51FE0899 sceGxmNotificationWait: 0x9F448E79 sceGxmPadHeartbeat: 0x3D25FCE9 sceGxmPadTriggerGpuPaTrace: 0x47E06984 @@ -95,13 +97,16 @@ modules: sceGxmPrecomputedVertexStateGetDefaultUniformBuffer: 0xBE5A68EF sceGxmPrecomputedVertexStateInit: 0xBE937F8D sceGxmPrecomputedVertexStateSetAllTextures: 0xC40C9127 + sceGxmPrecomputedVertexStateSetAllTextures0940: 0x8FF68274 sceGxmPrecomputedVertexStateSetAllUniformBuffers: 0x0389861D sceGxmPrecomputedVertexStateSetDefaultUniformBuffer: 0x34BF64E3 sceGxmPrecomputedVertexStateSetTexture: 0x6A29EB06 + sceGxmPrecomputedVertexStateSetTexture0940: 0x1625D348 sceGxmPrecomputedVertexStateSetUniformBuffer: 0xDBF97ED6 sceGxmProgramCheck: 0xED8B6C69 sceGxmProgramFindParameterByName: 0x277794C4 sceGxmProgramFindParameterBySemantic: 0x633CAA54 + sceGxmProgramFindParameterBySemantic0940: 0x7FFFDD7A sceGxmProgramGetDefaultUniformBufferSize: 0x8FA3F9C3 sceGxmProgramGetFragmentProgramInputs: 0xC6924709 sceGxmProgramGetOutputRegisterFormat: 0xE11603B1 @@ -124,6 +129,7 @@ modules: sceGxmProgramParameterGetName: 0x6AF88A5D sceGxmProgramParameterGetResourceIndex: 0x5C79D59A sceGxmProgramParameterGetSemantic: 0xE6D9C4CE + sceGxmProgramParameterGetSemantic0940: 0xAAFD61D5 sceGxmProgramParameterGetSemanticIndex: 0xB85CC13E sceGxmProgramParameterGetType: 0x7B9023C3 sceGxmProgramParameterIsRegFormat: 0x871E5009 @@ -179,6 +185,7 @@ modules: sceGxmSetVertexProgram: 0x31FF8ABD sceGxmSetVertexStream: 0x895DF2E9 sceGxmSetVertexTexture: 0x9EB4380F + sceGxmSetVertexTexture0940: 0x16C9D339 sceGxmSetVertexUniformBuffer: 0xC68015E4 sceGxmSetViewport: 0x3EB3380B sceGxmSetViewportEnable: 0x814F61EB @@ -244,6 +251,7 @@ modules: sceGxmTextureSetFormat: 0xFC943596 sceGxmTextureSetGammaMode: 0xA6D9F4DA sceGxmTextureSetHeight: 0xAEE7FDD1 + sceGxmTextureSetHeight0940: 0x1B20D5DF sceGxmTextureSetLodBias: 0xB65EE6F7 sceGxmTextureSetLodMin: 0xB79E43DD sceGxmTextureSetMagFilter: 0xFA695FD7 @@ -258,6 +266,7 @@ modules: sceGxmTextureSetVAddrMode: 0x126CDAA3 sceGxmTextureSetVAddrModeSafe: 0xFA22F6CC sceGxmTextureSetWidth: 0x2EA178BE + sceGxmTextureSetWidth0940: 0x5A690B60 sceGxmTextureValidate: 0x5331BED3 sceGxmTransferCopy: 0x62312BF8 sceGxmTransferDownscale: 0xD10F7EAD @@ -269,6 +278,16 @@ modules: sceGxmVertexFence: 0xE05277D6 sceGxmVertexProgramGetProgram: 0xBC52320E sceGxmWaitEvent: 0x8BD94593 + SceGxmInternal: + nid: 0x3FE654E6 + functions: + sceGxmInternalCreateRenderTarget: 0xC8A0F04E + sceGxmInternalGetRenderTargetMemSize: 0x4DD98588 + sceGxmInternalIsInitialized: 0xEC82DB20 + sceGxmInternalMapFragmentUsseMemory: 0xB9391D22 + sceGxmInternalMapVertexUsseMemory: 0x5694B569 + sceGxmInternalUnmapFragmentUsseMemory: 0xC29B9B82 + sceGxmInternalUnmapVertexUsseMemory: 0xD7506735 SceGxmInternalForVsh: nid: 0xC98AEB79 functions: diff --git a/nids/360/SceIncomingDialog.yml b/nids/360/SceIncomingDialog.yml new file mode 100644 index 0000000..7b50553 --- /dev/null +++ b/nids/360/SceIncomingDialog.yml @@ -0,0 +1,13 @@ +modules: + SceIncomingDialog: + nid: 0xC3E0DAF2 + libraries: + SceIncomingDialog: + nid: 0x5058F4AB + functions: + sceIncomingDialogClose: 0x126BD15E + sceIncomingDialogGetStatus: 0x839DE14C + sceIncomingDialogInit: 0x18AF99EB + sceIncomingDialogOpen: 0x2BEDC1A0 + sceIncomingDialogSwitchToDialog: 0x0123B83A + sceIncomingDialogTerm: 0x860B1885 diff --git a/nids/360/SceIniFileProcessor.yml b/nids/360/SceIniFileProcessor.yml new file mode 100644 index 0000000..4620450 --- /dev/null +++ b/nids/360/SceIniFileProcessor.yml @@ -0,0 +1,30 @@ +modules: + SceIniFileProcessor: + nid: 0x999CFBD5 + libraries: + SceIniFileProcessor: + nid: 0x5EE28724 + functions: + _ZN3sce3Ini13InitParameterC1Ev: 0x14146AF5 + _ZN3sce3Ini13InitParameterC2Ev: 0x9F8FC03F + _ZN3sce3Ini16IniFileProcessor10createFileEPKcS3_i: 0xFD8DE2F8 + _ZN3sce3Ini16IniFileProcessor10initializeEPKNS0_13InitParameterE: 0x0975D396 + _ZN3sce3Ini16IniFileProcessor11deserializeEPKcj: 0xB785FE67 + _ZN3sce3Ini16IniFileProcessor17terminateForErrorEv: 0x48A6BDCB + _ZN3sce3Ini16IniFileProcessor3addEPKcS3_: 0x703E1BAE + _ZN3sce3Ini16IniFileProcessor3delEPKc: 0xC2B3A41C + _ZN3sce3Ini16IniFileProcessor3getEPKcPcj: 0x7F22CED1 + _ZN3sce3Ini16IniFileProcessor3setEPKcS3_: 0xDBC5F9A8 + _ZN3sce3Ini16IniFileProcessor4sizeEv: 0xD7648B61 + _ZN3sce3Ini16IniFileProcessor5parseEPcS2_j: 0xD5C7B3EE + _ZN3sce3Ini16IniFileProcessor5resetEv: 0xB48C756B + _ZN3sce3Ini16IniFileProcessor7cleanupEv: 0xA51840C7 + _ZN3sce3Ini16IniFileProcessor8openFileEPKcS3_i: 0x51B791E8 + _ZN3sce3Ini16IniFileProcessor9closeFileEv: 0xEDFAD6B4 + _ZN3sce3Ini16IniFileProcessor9serializeEPPKcPj: 0x109B4E83 + _ZN3sce3Ini16IniFileProcessor9terminateEv: 0x2BEF7391 + _ZN3sce3Ini16IniFileProcessorC1Ev: 0xA0F71A2C + _ZN3sce3Ini16IniFileProcessorC2Ev: 0x746B194F + _ZN3sce3Ini16IniFileProcessorD0Ev: 0x9F57E743 + _ZN3sce3Ini16IniFileProcessorD1Ev: 0xACEB88BD + _ZN3sce3Ini16IniFileProcessorD2Ev: 0x7169CE28 diff --git a/nids/360/SceIofilemgr.yml b/nids/360/SceIofilemgr.yml index 590706e..e1364a4 100644 --- a/nids/360/SceIofilemgr.yml +++ b/nids/360/SceIofilemgr.yml @@ -76,6 +76,7 @@ modules: sceIoClearErrorEvent: 0x40B933C7 sceIoClose: 0xF99DD8A3 sceIoCloseAsync: 0x11C57CC6 + sceIoComplete: 0x8F0DE34D sceIoCreateErrorEvent: 0x3C0343DB sceIoCreateMountEvent: 0x2DFA192F sceIoDclose: 0x19C81DD6 @@ -91,7 +92,9 @@ modules: sceIoDreadAsync: 0x5982B0E3 sceIoFlock: 0x16336A0D sceIoGetMediaType: 0x9C220246 + sceIoGetPriorityForSystem: 0x9FCDCE62 sceIoGetProcessDefaultPriorityForSystem: 0xCE397158 + sceIoGetThreadDefaultPriorityForSystem: 0x6D0FEDB6 sceIoGetstat: 0x75C96D25 sceIoGetstat2: 0xD6503624 sceIoGetstatAsync: 0x94A5304A @@ -120,7 +123,9 @@ modules: sceIoRmdir: 0x1CC9C634 sceIoRmdirAsync: 0xF5B0B36C sceIoSetPathMappingFunction: 0xCFAECF18 + sceIoSetPriorityForSystem: 0xCCE94599 sceIoSetProcessDefaultPriorityForSystem: 0xABE65071 + sceIoSetThreadDefaultPriorityForSystem: 0x3F0FF9D5 sceIoSync: 0xDDF78594 sceIoSyncAsync: 0x4F9EA8B0 sceIoSyncByFd: 0x338DCD68 diff --git a/nids/360/SceJpegArm.yml b/nids/360/SceJpegArm.yml new file mode 100644 index 0000000..235f5c4 --- /dev/null +++ b/nids/360/SceJpegArm.yml @@ -0,0 +1,13 @@ +modules: + SceJpegArm: + nid: 0xC3ACF942 + libraries: + SceJpegArm: + nid: 0x19F04693 + functions: + sceJpegArmCreateSplitDecoder: 0x9DA48DB6 + sceJpegArmDecodeMJpeg: 0xA4ABFCE3 + sceJpegArmDecodeMJpegYCbCr: 0xE9B1B86F + sceJpegArmDeleteSplitDecoder: 0xE9CB3DFD + sceJpegArmGetOutputInfo: 0x23AE3BEA + sceJpegArmSplitDecodeMJpeg: 0x5D83C606 diff --git a/nids/360/SceKernelThreadMgr.yml b/nids/360/SceKernelThreadMgr.yml index f5d4381..541294c 100644 --- a/nids/360/SceKernelThreadMgr.yml +++ b/nids/360/SceKernelThreadMgr.yml @@ -209,7 +209,6 @@ modules: sceKernelDeleteCallback: 0x3A7E17F6 sceKernelDeleteCond: 0xAEE0D27C sceKernelDeleteEventFlag: 0x71ECB352 - sceKernelDeleteFastMutex: 0x11FE84A1 sceKernelDeleteMsgPipe: 0xB3453F88 sceKernelDeleteMutex: 0x0A912340 sceKernelDeleteSema: 0x16A35E58 @@ -217,7 +216,10 @@ modules: sceKernelEnqueueWorkQueue: 0xE50E1185 sceKernelExitDeleteThread: 0x1D17DECF sceKernelExitThread: 0x0C8A38E1 + sceKernelFinalizeFastMutex: 0x11FE84A1 sceKernelGetCallbackCount: 0x0892D8DF + sceKernelGetFastMutexInfo: 0xD7AF2E58 + sceKernelGetFastMutexInfoById: 0xAF302193 sceKernelGetMutexInfo: 0x69B78A12 sceKernelGetProcessId: 0x9DCB4B7A sceKernelGetProcessIdFromTLS: 0xFA54D49A @@ -239,6 +241,7 @@ modules: sceKernelLockMutex: 0x16AC80C5 sceKernelLockMutexCB_089: 0xD06F2886 sceKernelNotifyCallback: 0xC3E00919 + sceKernelPollEvent: 0xD08C71C6 sceKernelPollEventFlag: 0x76C6555B sceKernelPollSema: 0x4FDDFE24 sceKernelPulseEvent: 0x2427C81B @@ -261,6 +264,7 @@ modules: sceKernelStartThread: 0x21F5419B sceKernelStartTimer: 0x84C4CE4D sceKernelStopTimer: 0x474F214B + sceKernelTryLockFastMutex: 0x741F4707 sceKernelTryLockMutex: 0x270993A6 sceKernelTryLockReadRWLock: 0xFC2B5A50 sceKernelTryLockWriteRWLock: 0xA96F2E5A diff --git a/nids/360/SceLibKernel.yml b/nids/360/SceLibKernel.yml index 37074d2..0316966 100644 --- a/nids/360/SceLibKernel.yml +++ b/nids/360/SceLibKernel.yml @@ -64,7 +64,7 @@ modules: sceIoChstat: 0x29482F7F sceIoChstatAsync: 0x9739A5E2 sceIoChstatByFd: 0x6E903AB2 - sceIoClose2: 0xF5C6F098 + sceIoClose: 0xF5C6F098 sceIoCompleteMultiple: 0xA792C404 sceIoDevctl: 0x04B30CB2 sceIoDevctlAsync: 0x950F78EB @@ -85,7 +85,7 @@ modules: sceIoPreadAsync: 0xA010141E sceIoPwrite: 0x8FFFF5A8 sceIoPwriteAsync: 0xED25BEEF - sceIoRead2: 0x713523E1 + sceIoRead: 0x713523E1 sceIoRemove: 0xE20ED0F3 sceIoRemoveAsync: 0x446A60AC sceIoRename: 0xF737E369 @@ -94,7 +94,7 @@ modules: sceIoRmdirAsync: 0x9694D00F sceIoSync: 0x98ACED6D sceIoSyncAsync: 0xF7C7FBFE - sceIoWrite2: 0x11FED231 + sceIoWrite: 0x11FED231 sceKernelAtomicAddAndGet16: 0x495C52EC sceKernelAtomicAddAndGet32: 0x2E84A93B sceKernelAtomicAddAndGet64: 0xB6CE9B9A @@ -229,6 +229,7 @@ modules: sceKernelGetThreadId: 0x0FB972F9 sceKernelGetThreadInfo: 0x8D9C5461 sceKernelGetThreadRunStatus: 0xD6B01013 + sceKernelGetThreadSpecificInfo: 0x35D20E49 sceKernelGetTimerBase: 0x1F59E04D sceKernelGetTimerEventRemainingTime: 0x75B1EB3E sceKernelGetTimerInfo: 0x7E35E10A @@ -309,3 +310,28 @@ modules: nid: 0xF9AC7CF8 functions: sceKernelGetRandomNumber: 0xB2700165 + SceLibSsp: + nid: 0x8FA98EF1 + functions: + __stack_chk_fail: 0x39AD080B + variables: + __stack_chk_guard: 0x1EA375E6 + SceRtabi: + nid: 0xA941943F + functions: + __aeabi_d2lz: 0x5024AB91 + __aeabi_d2ulz: 0x6BB838EF + __aeabi_f2lz: 0xAA1F1B50 + __aeabi_f2ulz: 0x609CA961 + __aeabi_idiv: 0x38D62D60 + __aeabi_idivmod: 0x67104054 + __aeabi_lasr: 0x21FF67B9 + __aeabi_lcmp: 0x0D4F0635 + __aeabi_ldivmod: 0x6CBB0E84 + __aeabi_llsl: 0xA5DB3A86 + __aeabi_llsr: 0xCBDA815C + __aeabi_lmul: 0x141BC4CE + __aeabi_uidiv: 0xFB311F87 + __aeabi_uidivmod: 0xC33391D1 + __aeabi_ulcmp: 0x317B3774 + __aeabi_uldivmod: 0xCDF7708E diff --git a/nids/360/SceNotificationUtil.yml b/nids/360/SceNotificationUtil.yml new file mode 100644 index 0000000..375bc93 --- /dev/null +++ b/nids/360/SceNotificationUtil.yml @@ -0,0 +1,19 @@ +modules: + SceNotificationUtil: + nid: 0x355BAF61 + libraries: + SceNotificationUtil: + nid: 0xE19097C3 + functions: + sceNotificationUtilCleanHistory: 0xB0FFFB7B + sceNotificationUtilSendNotification: 0xDE6F33F4 + SceNotificationUtilBgApp: + nid: 0xA8AEF7DB + functions: + sceNotificationUtilBgAppInitialize: 0xCBE814C1 + SceNotificationUtilProgress: + nid: 0x75602769 + functions: + sceNotificationUtilProgressBegin: 0xFD0769B0 + sceNotificationUtilProgressFinish: 0x8CD688A1 + sceNotificationUtilProgressUpdate: 0xD9890A65 diff --git a/nids/360/ScePaf.yml b/nids/360/ScePaf.yml index 7743835..4f27a94 100644 --- a/nids/360/ScePaf.yml +++ b/nids/360/ScePaf.yml @@ -2,9 +2,22 @@ modules: ScePaf: nid: 0xCD679177 libraries: + ScePafCommon: + nid: 0x3C1965CD + functions: + scePafCesUtf16CharToUtf8: 0x8E009780 + scePafCesUtf16CharToUtf8WithFlag: 0x5FAAAE1C + scePafCesUtf16ToUtf8: 0x06C015C6 + scePafCesUtf16ToUtf8WithFlag: 0x683BC8E8 + scePafCesUtf8CharToUtf16: 0x950C3AA0 + scePafCesUtf8CharToUtf16WithFlag: 0xA9ED25D9 + scePafCesUtf8ToUtf16: 0x3CFEB1EB + scePafCesUtf8ToUtf16WithFlag: 0x23A39B05 ScePafMisc: nid: 0x3D643CE8 functions: + scePafCesUtf16CharToUtf8WithAlloc: 0xE690F751 + scePafCesUtf8CharToUtf16WithAlloc: 0xA6ABC0B2 sce_paf_misc_does_file_exist: 0x95F14046 ScePafResource: nid: 0x2836DC9B @@ -37,94 +50,97 @@ modules: ScePafStdc: nid: 0xA7D28DAE functions: - sce_paf_private_abs: 0x0F297A5E - sce_paf_private_atexit: 0x9A1D1ED1 - sce_paf_private_atof: 0x9C251354 - sce_paf_private_atoi: 0x5930D99A - sce_paf_private_atol: 0x086AD1FA - sce_paf_private_atoll: 0x47B19A87 - sce_paf_private_bcmp: 0x1076722F - sce_paf_private_bcopy: 0x44C0825D - sce_paf_private_bsearch: 0x78AE1C51 - sce_paf_private_bzero: 0xD21442B4 - sce_paf_private_exit: 0x92BF63C9 - sce_paf_private_fclose: 0xA005E879 - sce_paf_private_fflush: 0x26A0A5F6 - sce_paf_private_fgetc: 0xDEB581B4 - sce_paf_private_fopen: 0x1BCCD0B9 - sce_paf_private_fputc: 0xAF1831DC - sce_paf_private_fread: 0x43A53623 - sce_paf_private_free: 0x1B77082E - sce_paf_private_free2: 0x5C468294 - sce_paf_private_fseek: 0xFC10F9E9 - sce_paf_private_ftell: 0x77CB5E21 - sce_paf_private_fwrite: 0x4D5BB0F8 - sce_paf_private_longjmp: 0x001BFAC2 - sce_paf_private_look_ctype_table: 0x247C19A8 - sce_paf_private_malloc: 0xFC5CD359 - sce_paf_private_malloc2: 0xD8CC1AFE - sce_paf_private_memchr: 0x1D286681 - sce_paf_private_memcmp: 0x79DFA2A2 - sce_paf_private_memcpy: 0x2C5B6F9C - sce_paf_private_memcpy2: 0x5883A6E3 - sce_paf_private_memmove: 0x01566828 - sce_paf_private_memset: 0xE148AF94 - sce_paf_private_memset2: 0x75ECC54E - sce_paf_private_qsort: 0xF7A11753 - sce_paf_private_rand: 0xC9DACD41 - sce_paf_private_setjmp: 0x2105FFAD - sce_paf_private_snprintf: 0x4E0D907E - sce_paf_private_sprintf: 0x19182BDA - sce_paf_private_srand: 0x772DF5A0 - sce_paf_private_strcasecmp: 0x70A459B2 - sce_paf_private_strcat: 0x2344E6F2 - sce_paf_private_strchr: 0x1A22784C - sce_paf_private_strcmp: 0x5CD08A47 - sce_paf_private_strcpy: 0xA523672C - sce_paf_private_strcspn: 0xB429DD2A - sce_paf_private_strlcat: 0x52A68C8D - sce_paf_private_strlcpy: 0x3D1AAC3A - sce_paf_private_strlen: 0xF5A2AA0C - sce_paf_private_strncasecmp: 0xA6014289 - sce_paf_private_strncat: 0xD259BEAF - sce_paf_private_strncmp: 0x1E1EA818 - sce_paf_private_strncpy: 0xE29DA0BF - sce_paf_private_strpbrk: 0xA14AB14F - sce_paf_private_strrchr: 0xFA2C892F - sce_paf_private_strspn: 0xE3F8F3D6 - sce_paf_private_strtof: 0x945EA5EA - sce_paf_private_strtok: 0x15C4B5A4 - sce_paf_private_strtok_r: 0x0D305F0E - sce_paf_private_strtol: 0xDB814C12 - sce_paf_private_strtoll: 0x2F6B94FF - sce_paf_private_strtoul: 0x04FDF238 - sce_paf_private_strtoull: 0xC05A18CA - sce_paf_private_swprintf: 0xF67F76D0 - sce_paf_private_tolower: 0xDAC2EE4D - sce_paf_private_toupper: 0x761184A5 - sce_paf_private_towlower: 0xC8C2CDAC - sce_paf_private_vsnprintf: 0x51C66C6E - sce_paf_private_vsprintf: 0x3079B56B - sce_paf_private_wcscasecmp: 0x92A125F6 - sce_paf_private_wcscat: 0xDDDDD6E0 - sce_paf_private_wcschr: 0x13833CAE - sce_paf_private_wcscmp: 0x822897E3 - sce_paf_private_wcscpy: 0xE9B40477 - sce_paf_private_wcscspn: 0xDE8B2091 - sce_paf_private_wcslen: 0xBED4F3D0 - sce_paf_private_wcsncasecmp: 0x8D65035E - sce_paf_private_wcsncat: 0x49023581 - sce_paf_private_wcsncmp: 0xA41CD38D - sce_paf_private_wcsncpy: 0x21B784DD - sce_paf_private_wcsnlen: 0xDCE80ABB - sce_paf_private_wcspbrk: 0xD7A2DF29 - sce_paf_private_wcsrchr: 0x439EB9D4 - sce_paf_private_wcsspn: 0x85DB686E - sce_paf_private_wmemchr: 0x8236A020 - sce_paf_private_wmemcmp: 0x381B6216 - sce_paf_private_wmemcpy: 0x19B5B91D - sce_paf_private_wmemmove: 0x468A09B1 - sce_paf_private_wmemset: 0x36890967 + sce_paf_abs: 0x0F297A5E + sce_paf_atexit: 0x9A1D1ED1 + sce_paf_atof: 0x9C251354 + sce_paf_atoi: 0x5930D99A + sce_paf_atol: 0x086AD1FA + sce_paf_atoll: 0x47B19A87 + sce_paf_bcmp: 0x1076722F + sce_paf_bcopy: 0x44C0825D + sce_paf_bsearch: 0x78AE1C51 + sce_paf_bzero: 0xD21442B4 + sce_paf_exit: 0x92BF63C9 + sce_paf_fclose: 0xA005E879 + sce_paf_fflush: 0x26A0A5F6 + sce_paf_fgetc: 0xDEB581B4 + sce_paf_fopen: 0x1BCCD0B9 + sce_paf_fputc: 0xAF1831DC + sce_paf_fread: 0x43A53623 + sce_paf_free: 0x1B77082E + sce_paf_free2: 0x5C468294 + sce_paf_fseek: 0xFC10F9E9 + sce_paf_ftell: 0x77CB5E21 + sce_paf_fwrite: 0x4D5BB0F8 + sce_paf_longjmp: 0x001BFAC2 + sce_paf_look_ctype_table: 0x247C19A8 + sce_paf_malloc: 0xFC5CD359 + sce_paf_malloc2: 0xD8CC1AFE + sce_paf_memchr: 0x1D286681 + sce_paf_memcmp: 0x79DFA2A2 + sce_paf_memcpy: 0x2C5B6F9C + sce_paf_memcpy2: 0x5883A6E3 + sce_paf_memmove: 0x01566828 + sce_paf_memset: 0xE148AF94 + sce_paf_memset2: 0x75ECC54E + sce_paf_qsort: 0xF7A11753 + sce_paf_rand: 0xC9DACD41 + sce_paf_setjmp: 0x2105FFAD + sce_paf_snprintf: 0x4E0D907E + sce_paf_sprintf: 0x19182BDA + sce_paf_srand: 0x772DF5A0 + sce_paf_strcasecmp: 0x70A459B2 + sce_paf_strcat: 0x2344E6F2 + sce_paf_strchr: 0x1A22784C + sce_paf_strcmp: 0x5CD08A47 + sce_paf_strcpy: 0xA523672C + sce_paf_strcspn: 0xB429DD2A + sce_paf_strlcat: 0x52A68C8D + sce_paf_strlcpy: 0x3D1AAC3A + sce_paf_strlen: 0xF5A2AA0C + sce_paf_strncasecmp: 0xA6014289 + sce_paf_strncat: 0xD259BEAF + sce_paf_strncmp: 0x1E1EA818 + sce_paf_strncpy: 0xE29DA0BF + sce_paf_strpbrk: 0xA14AB14F + sce_paf_strrchr: 0xFA2C892F + sce_paf_strspn: 0xE3F8F3D6 + sce_paf_strtof: 0x945EA5EA + sce_paf_strtok: 0x15C4B5A4 + sce_paf_strtok_r: 0x0D305F0E + sce_paf_strtol: 0xDB814C12 + sce_paf_strtoll: 0x2F6B94FF + sce_paf_strtoul: 0x04FDF238 + sce_paf_strtoull: 0xC05A18CA + sce_paf_swprintf: 0xF67F76D0 + sce_paf_tolower: 0xDAC2EE4D + sce_paf_toupper: 0x761184A5 + sce_paf_towlower: 0xC8C2CDAC + sce_paf_vsnprintf: 0x51C66C6E + sce_paf_vsnprintf_internal: 0xAE0F3820 + sce_paf_vsprintf: 0x3079B56B + sce_paf_vswprintf: 0xFA5C2193 + sce_paf_vswprintf_internal: 0xAFB23563 + sce_paf_wcscasecmp: 0x92A125F6 + sce_paf_wcscat: 0xDDDDD6E0 + sce_paf_wcschr: 0x13833CAE + sce_paf_wcscmp: 0x822897E3 + sce_paf_wcscpy: 0xE9B40477 + sce_paf_wcscspn: 0xDE8B2091 + sce_paf_wcslen: 0xBED4F3D0 + sce_paf_wcsncasecmp: 0x8D65035E + sce_paf_wcsncat: 0x49023581 + sce_paf_wcsncmp: 0xA41CD38D + sce_paf_wcsncpy: 0x21B784DD + sce_paf_wcsnlen: 0xDCE80ABB + sce_paf_wcspbrk: 0xD7A2DF29 + sce_paf_wcsrchr: 0x439EB9D4 + sce_paf_wcsspn: 0x85DB686E + sce_paf_wmemchr: 0x8236A020 + sce_paf_wmemcmp: 0x381B6216 + sce_paf_wmemcpy: 0x19B5B91D + sce_paf_wmemmove: 0x468A09B1 + sce_paf_wmemset: 0x36890967 ScePafWidget: nid: 0x073F8C68 functions: diff --git a/nids/360/ScePerf.yml b/nids/360/ScePerf.yml index e3d58c9..d9c9f90 100644 --- a/nids/360/ScePerf.yml +++ b/nids/360/ScePerf.yml @@ -5,7 +5,6 @@ modules: ScePerf: nid: 0x447F047D functions: - _pLibPerfCaptureFlagPtr: 0x936A5F31 _sceCpuRazorPopFiberUserMarker: 0x453AED06 _sceCpuRazorPushFiberUserMarker: 0x8F7B522C _sceRazorCpuInit: 0x7AD6AC30 @@ -32,3 +31,5 @@ modules: sceRazorCpuStopCapture: 0x9C2C05C2 sceRazorCpuStopUserMarkerTrace: 0x4B47E144 sceRazorCpuSync: 0x4F1385E3 + variables: + _pLibPerfCaptureFlagPtr: 0x936A5F31 diff --git a/nids/360/SceSas.yml b/nids/360/SceSas.yml index 91af58c..4569f15 100644 --- a/nids/360/SceSas.yml +++ b/nids/360/SceSas.yml @@ -5,36 +5,68 @@ modules: SceSas: nid: 0xEE47EC43 functions: + sceSasCheckGrain: 0x0AEA9963 sceSasCore: 0x7A4672B2 + sceSasCoreInternal: 0x62CCF050 sceSasCoreWithMix: 0xBD496983 sceSasExit: 0xBB7D6790 + sceSasExitInternal: 0x799DD9C0 sceSasGetDryPeak: 0xB6642276 + sceSasGetDryPeakInternal: 0x40ED8367 sceSasGetEndState: 0x007E63E6 + sceSasGetEndStateInternal: 0x0F771045 sceSasGetEnvelope: 0x296A9910 + sceSasGetEnvelopeInternal: 0xE3A5D1D4 sceSasGetGrain: 0x2BEA45BC + sceSasGetGrainInternal: 0x26B2B2A9 sceSasGetNeededMemorySize: 0x180C6824 + sceSasGetNeededMemorySizeInternal: 0x5F82207D sceSasGetOutputmode: 0x2C36E150 + sceSasGetOutputmodeInternal: 0x0B96AF29 sceSasGetPauseState: 0xFD1A0CBF + sceSasGetPauseStateInternal: 0xBEEBC820 sceSasGetPreMasterPeak: 0x1568017A + sceSasGetPreMasterPeakInternal: 0x3D4F37FF sceSasGetWetPeak: 0x4314F0E9 + sceSasGetWetPeakInternal: 0x0DE54FF9 sceSasInit: 0x449B5974 + sceSasInitInternal: 0x5C5250C1 sceSasInitWithGrain: 0x820D5F82 sceSasSetADSR: 0x18A5EFA2 + sceSasSetADSRInternal: 0x44514A50 sceSasSetADSRmode: 0x5207F9D2 + sceSasSetADSRmodeInternal: 0xE9F3944D sceSasSetDistortion: 0x011788BE + sceSasSetDistortionInternal: 0x1744ACD7 sceSasSetEffect: 0xB0444E69 + sceSasSetEffectInternal: 0xE04ACC5A sceSasSetEffectParam: 0xBAD546A0 + sceSasSetEffectParamInternal: 0xCB23EA6D sceSasSetEffectType: 0xCDF2DDD5 + sceSasSetEffectTypeInternal: 0xDAF4773A sceSasSetEffectVolume: 0x55EDDBFA + sceSasSetEffectVolumeInternal: 0x50D722D7 sceSasSetGrain: 0x2B4A207C + sceSasSetGrainInternal: 0xB47D5122 sceSasSetKeyOff: 0x5E42ADAB + sceSasSetKeyOffInternal: 0x4636ACC2 sceSasSetKeyOn: 0xC838DB6F + sceSasSetKeyOnInternal: 0xB26DF4BF sceSasSetNoise: 0xF1C63CB9 + sceSasSetNoiseInternal: 0xBD2907EA sceSasSetOutputmode: 0x44DDB3C4 + sceSasSetOutputmodeInternal: 0x107D1850 sceSasSetPause: 0x59C7A9DF + sceSasSetPauseInternal: 0x79665BCA sceSasSetPitch: 0x2C48A08C + sceSasSetPitchInternal: 0x81AF90AC sceSasSetSL: 0xDE6227B8 + sceSasSetSLInternal: 0xFE263F55 sceSasSetSimpleADSR: 0xECCE0DB8 + sceSasSetSimpleADSRInternal: 0xBF95B455 sceSasSetVoice: 0x2B75F9BC + sceSasSetVoiceInternal: 0x0C294FAF sceSasSetVoicePCM: 0xB1756EFC + sceSasSetVoicePCMInternal: 0xEB6708B0 sceSasSetVolume: 0x0BE8204D + sceSasSetVolumeInternal: 0x868E1C88 diff --git a/nids/360/SceShellSvc.yml b/nids/360/SceShellSvc.yml index 53047a2..d1a12c2 100644 --- a/nids/360/SceShellSvc.yml +++ b/nids/360/SceShellSvc.yml @@ -2,10 +2,25 @@ modules: SceShellSvc: nid: 0x821DC423 libraries: + SceShellSvc: + nid: 0x773242C7 + functions: + sceShellSvcGetSvcObj: 0xB31E7F1C SceShellUtil: nid: 0xD2B1C8AE functions: sceShellUtilInitEvents: 0xE8AD11EC sceShellUtilLock: 0xA9537233 sceShellUtilRegisterEventHandler: 0x7B5EDFE7 + sceShellUtilRequestColdReset: 0x636544FB + sceShellUtilRequestColdResetWithError: 0xBB54D049 + sceShellUtilRequestStandby: 0x8F2F143D + sceShellUtilSetAirplaneIconMode: 0x96BBF91B + sceShellUtilSetBGMMode: 0xB65B60CA + sceShellUtilSetBtIconMode: 0x8B69AD27 + sceShellUtilSetSystemLanguage: 0x040997D6 + sceShellUtilSetTimeText: 0x40DFAC6B + sceShellUtilTextClipboardGetUsedSize: 0xD0DDEDBC + sceShellUtilTextClipboardRead: 0x1B186905 + sceShellUtilTextClipboardWrite: 0xC4810C56 sceShellUtilUnlock: 0x21A6CF54 diff --git a/nids/360/SceSysmem.yml b/nids/360/SceSysmem.yml index 2914100..aba8865 100644 --- a/nids/360/SceSysmem.yml +++ b/nids/360/SceSysmem.yml @@ -145,6 +145,7 @@ modules: sceDebugPrintf2: 0x02B04343 sceDebugPrintfKernelAssertion: 0x821A2D59 sceDebugPrintfKernelPanic: 0x00CCE39C + sceDebugVprintf: 0x411C0733 SceDebugForKernel: nid: 0x88C17370 functions: @@ -278,19 +279,38 @@ modules: SceSysclibForDriver: nid: 0x7EE45391 functions: + __aeabi_idiv: 0x2518CD9E + __aeabi_idivmod: 0xAC86B4BA + __aeabi_lasr: 0x1D89F6C0 + __aeabi_lcmp: 0x709077A1 + __aeabi_ldivmod: 0x7554AB04 + __aeabi_llsl: 0x72D31F9D + __aeabi_llsr: 0xE46C47E6 + __aeabi_lmul: 0xFEE5E751 + __aeabi_uidiv: 0xA9FF1205 + __aeabi_uidivmod: 0xA46CB7DE + __aeabi_ulcmp: 0xFE900DE8 + __aeabi_uldivmod: 0x9D148CDE __memcpy_chk: 0x8A0B0815 __memmove_chk: 0x35DBB110 __memset_chk: 0x1A30BB28 + __snprintf_chk: 0x7DBE7007 __stack_chk_fail: 0xB997493D + __strcat_chk: 0xDE4666F0 + __strcpy_chk: 0x545DA5FD + __strlcat_chk: 0x224BE33F + __strlcpy_chk: 0xCF86EA38 __strncat_chk: 0x33EE298B __strncpy_chk: 0x96268C53 + __vsnprintf_chk: 0xCBF64DF6 + __vsnprintf_internal: 0xE38E7605 look_ctype_table: 0xCDF7F155 memchr: 0x60DAEA30 memcmp: 0xF939E83D + memcmp_consttime: 0xB5A4D745 memcpy: 0x40C88316 memmove: 0x6CC9C1A1 memset: 0x0AB9BF5C - rshift: 0x1D89F6C0 snprintf: 0xAE7A8981 strchr: 0x38463759 strcmp: 0x0B33BC43 @@ -300,6 +320,7 @@ modules: strncat: 0xA1D1C32C strncmp: 0x12CEE649 strncpy: 0x6D286146 + strncpy_fast: 0xFE39AEAC strnlen: 0xCD4BD884 strrchr: 0x7F0E0835 strstr: 0x1304A69D @@ -309,6 +330,8 @@ modules: tolower: 0x0021DAF9 toupper: 0xA685DCB1 vsnprintf: 0x3DDBE2E1 + variables: + __stack_chk_guard: 0x99EEBD1F SceSysmem: nid: 0x37FE725A functions: diff --git a/nids/360/SceTriggerUtil.yml b/nids/360/SceTriggerUtil.yml new file mode 100644 index 0000000..3fe9d71 --- /dev/null +++ b/nids/360/SceTriggerUtil.yml @@ -0,0 +1,18 @@ +modules: + SceTriggerUtil: + nid: 0xDC8CE156 + libraries: + SceTriggerUtil: + nid: 0x1B0302AD + functions: + sceTriggerUtilGetAutoStartStatus: 0xDD2CA8BB + sceTriggerUtilGetDailyEventInfo: 0xDF3ED08E + sceTriggerUtilGetOneTimeEventInfo: 0x912434E0 + sceTriggerUtilGetRegisteredSystemTitleIdList: 0x2A67EF8C + sceTriggerUtilGetRegisteredUserTitleIdList: 0xE2B2D2D0 + sceTriggerUtilGetSystemAppInfo: 0xD659CCB0 + sceTriggerUtilGetUserAppInfo: 0x0ACE6552 + sceTriggerUtilRegisterDailyEvent: 0xA69102DE + sceTriggerUtilRegisterOneTimeEvent: 0x04218D35 + sceTriggerUtilUnregisterDailyEvent: 0x58BF700F + sceTriggerUtilUnregisterOneTimeEvent: 0xAF73E0A8 diff --git a/nids/365/SceExcpmgr.yml b/nids/365/SceExcpmgr.yml new file mode 100644 index 0000000..14e8766 --- /dev/null +++ b/nids/365/SceExcpmgr.yml @@ -0,0 +1,9 @@ +modules: + SceExcpmgr: + nid: 0xF3D9E37C + libraries: + SceExcpmgrForKernel: + nid: 0x1496A5B5 + functions: + sceExcpmgrGetData: 0x96C2869C + sceExcpmgrRegisterHandler: 0x00063675 diff --git a/nids/365/SceKernelModulemgr.yml b/nids/365/SceKernelModulemgr.yml new file mode 100644 index 0000000..4b2a858 --- /dev/null +++ b/nids/365/SceKernelModulemgr.yml @@ -0,0 +1,16 @@ +modules: + SceKernelModulemgr: + nid: 0x726C6635 + libraries: + SceModulemgrForKernel: + nid: 0x92C9FFC2 + functions: + sceKernelGetModuleInfo: 0xDAA90093 + sceKernelGetModuleInternal: 0x37512E29 + sceKernelGetModuleList: 0xB72C75A4 + sceKernelLoadModuleForPid: 0x4E85022D + sceKernelMountBootfs: 0x185FF1BC + sceKernelStartModuleForPid: 0x3FE47DDF + sceKernelStopModuleForPid: 0xBDBD391D + sceKernelUmountBootfs: 0xBD61AD4D + sceKernelUnloadModuleForPid: 0xFCA9FDB1 diff --git a/nids/365/SceKernelThreadMgr.yml b/nids/365/SceKernelThreadMgr.yml new file mode 100644 index 0000000..bf21a84 --- /dev/null +++ b/nids/365/SceKernelThreadMgr.yml @@ -0,0 +1,8 @@ +modules: + SceKernelThreadMgr: + nid: 0x23A1B482 + libraries: + SceThreadmgrForKernel: + nid: 0x7F8593BA + functions: + sceKernelGetFaultingProcess: 0x6C1F092F diff --git a/nids/365/SceProcessmgr.yml b/nids/365/SceProcessmgr.yml new file mode 100644 index 0000000..13740d5 --- /dev/null +++ b/nids/365/SceProcessmgr.yml @@ -0,0 +1,11 @@ +modules: + SceProcessmgr: + nid: 0x7CE857A1 + libraries: + SceProcessmgrForKernel: + nid: 0xEB1F8EF7 + functions: + sceKernelExitProcess: 0x905621F9 + sceKernelGetProcessAuthid: 0x324F2B20 + sceKernelGetProcessKernelBuf: 0xD991C85E + sceKernelLaunchApp: 0x68068618 diff --git a/nids/365/SceSysmem.yml b/nids/365/SceSysmem.yml new file mode 100644 index 0000000..0fa3b00 --- /dev/null +++ b/nids/365/SceSysmem.yml @@ -0,0 +1,36 @@ +modules: + SceSysmem: + nid: 0x3380B323 + libraries: + SceCpuForKernel: + nid: 0xA5195D20 + functions: + sceKernelCpuDcacheInvalidateAll: 0xF9B0B171 + sceKernelCpuDcacheWritebackAll: 0x49180814 + sceKernelCpuDcacheWritebackInvalidateAll: 0x4BBA5C82 + sceKernelCpuDcacheWritebackInvalidateRange: 0x4F442396 + sceKernelCpuIcacheAndL2WritebackInvalidateRange: 0x73E895EA + sceKernelCpuIcacheInvalidateAll: 0x803C84BF + sceKernelCpuIcacheInvalidateRange: 0x2E637B1D + SceDebugForKernel: + nid: 0x13D793B7 + functions: + sceDebugDisableInfoDump: 0xA465A31A + sceDebugGetPutcharHandler: 0x8D474850 + sceDebugPutchar: 0x2AABAEDA + sceDebugRegisterPutcharHandler: 0x22546577 + sceDebugSetHandlers: 0x88AD6D0C + SceSysmemForKernel: + nid: 0x02451F0F + functions: + sceKernelCreateUidObj: 0xFB6390CE + sceKernelFindClassByName: 0x7D87F706 + sceKernelGetMemBlockType: 0xD44FE44B + sceKernelRxMemcpyKernelToUserForPid: 0x2995558D + SceUartForKernel: + nid: 0x1CCD9BA3 + functions: + sceUartInit: 0x4C02AA05 + sceUartRead: 0x4E97D3AD + sceUartReadAvailable: 0x16780BC3 + sceUartWrite: 0x430C48F1 |