From 0ba08333691a1dd12bb1e826ff622637122646c5 Mon Sep 17 00:00:00 2001 From: GrayJack Date: Wed, 28 Jan 2026 05:50:00 -0300 Subject: [PATCH] feat: Add `SceModuleMgrParam` to `pspmodulemgr_kernel.h` --- src/kernel/pspmodulemgr_kernel.h | 93 +++++++++++++++++++++++++++----- src/user/pspmodulemgr.h | 2 + 2 files changed, 82 insertions(+), 13 deletions(-) diff --git a/src/kernel/pspmodulemgr_kernel.h b/src/kernel/pspmodulemgr_kernel.h index 1f3b46129d..6c9f84f60b 100644 --- a/src/kernel/pspmodulemgr_kernel.h +++ b/src/kernel/pspmodulemgr_kernel.h @@ -19,8 +19,75 @@ #include /** @defgroup ModuleMgrKern Kernel Module Manager Library - * This module contains the imports for the kernel's module management routines. - */ + * This module contains the imports for the kernel's module management routines. + */ + +enum SceModuleMgrExecModes { + MODULE_EXEC_CMD_LOAD, + MODULE_EXEC_CMD_RELOCATE, + MODULE_EXEC_CMD_START, + MODULE_EXEC_CMD_STOP, + MODULE_EXEC_CMD_UNLOAD, +}; + +/** + * Structure used internally for many `sceModuleManager` module functions. + * + * Also seems to be passed to `sceKernelStartThread` eventually by those internal functions. + * */ +typedef struct { + /** The Operation to start on. One of the `SceModuleMgrExecModes` modes. */ + u8 mode_start; + /** The Operation to finish on. One of the `SceModuleMgrExecModes` modes. */ + u8 mode_finish; + /** The module placement policy in memory. One of `PspSysMemBlockTypes`. */ + u8 position; + u8 access; + SceUID *result; + SceUID *new_block_id; + /** The module in memory. */ + SceModule *mod; + /** The executable information of the module. */ + SceLoadCoreExecFileInfo *exec_info; + /** The API type of the module. */ + u32 api_type; + /** The file ID for module file. */ + SceUID fd; + /** The module thread priority. */ + s32 thread_priority; + /** The module thread attributes. */ + u32 thread_attr; + /** The memory partition where the program of the module will be stored. */ + SceUID mpid_text; + /** The memory partition where the data of the module will be stored. */ + SceUID mpid_data; + SceUID thread_mpid_stack; + SceSize stack_size; + /** The module ID. */ + SceUID mod_id; + SceUID caller_mod_id; + SceSize mod_size; + void *file_base; + SceSize arg_size; + void *argp; + u32 unk1; + u32 unk2; + s32 *status; + SceUID event_id; + u32 unk3; + u32 unk4; + u32 unk5; + SceUID extern_mem_block_id_kernel; + SceUID extern_mem_block_partition_id; + SceSize extern_mem_block_size; + u32 unk6; + void *block_gzip; + u32 unk7; + char secure_install_id[SCE_SECURE_INSTALL_ID_LEN]; + SceUID extern_mem_block_id_user; + u32 unk8; + SceOff mem_block_offset; +} SceModuleMgrParam; #ifdef __cplusplus extern "C" { @@ -30,20 +97,20 @@ extern "C" { /**@{*/ /** - * Gets the current module list. - * - * @param readbufsize - The size of the read buffer. - * @param readbuf - Pointer to a buffer to store the IDs - * - * @return < 0 on error. - */ + * Gets the current module list. + * + * @param readbufsize - The size of the read buffer. + * @param readbuf - Pointer to a buffer to store the IDs + * + * @return < 0 on error. + */ int sceKernelGetModuleList(int readbufsize, SceUID *readbuf); /** - * Get the number of loaded modules. - * - * @return The number of loaded modules. - */ + * Get the number of loaded modules. + * + * @return The number of loaded modules. + */ int sceKernelModuleCount(void); /** diff --git a/src/user/pspmodulemgr.h b/src/user/pspmodulemgr.h index eb0d8c17ab..6f51664dbb 100644 --- a/src/user/pspmodulemgr.h +++ b/src/user/pspmodulemgr.h @@ -35,6 +35,8 @@ extern "C" { #define PSP_MEMORY_PARTITION_KERNEL 1 #define PSP_MEMORY_PARTITION_USER 2 +#define SCE_SECURE_INSTALL_ID_LEN (16) + typedef struct SceKernelLMOption { SceSize size; SceUID mpidtext;