sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
xmodload.h
Go to the documentation of this file.
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7# Licenced under Academic Free License version 2.0
8# Review ps2sdk README & LICENSE files for further details.
9*/
10
16
17#ifndef __XMODLOAD_H__
18#define __XMODLOAD_H__
19
20#include <modload.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26// The following was introduced in export version 1.3 (around SDK 2.3)
27extern int GetModuleIdList(int *readbuf, int readbufsize, int *modulecount);
28
29typedef struct {
30 char name[56];
31 u16 version;
32 u16 flags;
33 int id;
34 u32 entry_addr;
35 u32 gp_value;
36 u32 text_addr;
37 u32 text_size;
38 u32 data_size;
39 u32 bss_size;
40 u32 lreserve[2];
42
43extern int ReferModuleStatus(int modid, ModuleStatus *status);
44extern int GetModuleIdListByName(const char *name, int *readbuf, int readbufsize, int *modulecount);
45
46typedef struct {
47 int (*beforeOpen)(void *opt, const char *filename, int flag);
48 int (*afterOpen)(void *opt, int fd);
49 int (*close)(void *opt, int fd);
50 int (*setBufSize)(void *opt, int fd, size_t nbyte);
51 int (*beforeRead)(void *opt, int fd, size_t nbyte);
52 int (*read)(void *opt, int fd, void *buf, size_t nbyte);
53 int (*lseek)(void *opt, int fd, long offset, int whence);
54 int (*getfsize)(void *opt, int fd);
56
57typedef struct {
58 char position;
59 char access;
60 char creserved[2];
61 void *distaddr;
62 int distoffset;
63 LDfilefunc *functable;
64 void *funcopt;
65 int ireserved[3];
67
68extern int LoadModuleWithOption(const char *filename, const LMWOoption *option);
69extern int StopModule(int modid, int arglen, const char *args, int *result);
70extern int UnloadModule(int modid);
71extern int SearchModuleByName(const char *name);
72extern int SearchModuleByAddress(const void *addr);
73extern int SelfStopModule(int arglen, const char *args, int *result);
74extern void SelfUnloadModule(void);
75
76// The following was introduced in export version 1.5 (around SDK 2.3.4)
77extern void *AllocLoadMemory(int type, unsigned int size, void *addr);
78extern int FreeLoadMemory(void *area);
79
80// The following was introduced in export version 1.6 (around SDK 2.5)
81extern int SetModuleFlags(int modid, int flag);
82
83#define xmodload_IMPORTS_start DECLARE_IMPORT_TABLE(modload, 1, 7)
84#define xmodload_IMPORTS_end END_IMPORT_TABLE
85
86#define I_GetModuleIdList DECLARE_IMPORT(16, GetModuleIdList)
87#define I_ReferModuleStatus DECLARE_IMPORT(17, ReferModuleStatus)
88#define I_GetModuleIdListByName DECLARE_IMPORT(18, GetModuleIdListByName)
89#define I_LoadModuleWithOption DECLARE_IMPORT(19, LoadModuleWithOption)
90#define I_StopModule DECLARE_IMPORT(20, StopModule)
91#define I_UnloadModule DECLARE_IMPORT(21, UnloadModule)
92#define I_SearchModuleByName DECLARE_IMPORT(22, SearchModuleByName)
93#define I_SearchModuleByAddress DECLARE_IMPORT(23, SearchModuleByAddress)
94#define I_SelfStopModule DECLARE_IMPORT(26, SelfStopModule)
95#define I_SelfUnloadModule DECLARE_IMPORT(27, SelfUnloadModule)
96#define I_AllocLoadMemory DECLARE_IMPORT(28, AllocLoadMemory)
97#define I_FreeLoadMemory DECLARE_IMPORT(29, FreeLoadMemory)
98#define I_SetModuleFlags DECLARE_IMPORT(30, SetModuleFlags)
99
100#ifdef __cplusplus
101}
102#endif
103
104#endif /* __XMODLOAD_H__ */