sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
Loading...
Searching...
No Matches
main.c
1
#include <
stdio.h
>
2
#include <
string.h
>
3
#include <
kernel.h
>
4
#include <
loadfile.h
>
5
#include <
sbv_patches.h
>
6
#include <sifrpc.h>
7
8
extern
int
kputs(
char
*s);
9
10
static
void
say(
char
*s)
11
{
12
kputs(s);
13
printf(
"%s"
, s);
14
}
15
16
#define MOD(name, skip) extern unsigned char name##_irx[]; extern unsigned int size_##name##_irx;
17
#include "modules.def"
18
#undef MOD
19
20
struct
module
{
21
const
char
*name;
22
unsigned
char
*irx;
23
unsigned
int
*size;
24
const
char
*skip;
25
};
26
27
#define MOD(name, skip) {#name, name##_irx, &size_##name##_irx, skip},
28
static
const
struct
module
modules[] = {
29
#include "modules.def"
30
};
31
#undef MOD
32
33
static
int
test_main(
void
) {
34
int
loaded = 0, failed = 0, skipped = 0;
35
char
line[96];
36
SifInitRpc(0);
37
sbv_patch_enable_lmb
();
38
for
(
unsigned
i = 0; i <
sizeof
(modules) /
sizeof
(modules[0]); i++) {
39
const
struct
module
*m = &modules[i];
40
if
(m->skip) {
41
skipped++;
42
snprintf(line,
sizeof
(line),
"iop-boot: SKIP %s (%s)\n"
, m->name, m->skip);
43
say(line);
44
continue
;
45
}
46
snprintf(line,
sizeof
(line),
"iop-boot: loading %s\n"
, m->name);
47
say(line);
48
int
result = 0;
49
int
id
=
SifExecModuleBuffer
(m->irx, *m->size, 0, NULL, &result);
50
if
(
id
< 0) {
51
failed++;
52
snprintf(line,
sizeof
(line),
"iop-boot: module %s failed to load (%d)\n"
, m->name,
id
);
53
say(line);
54
}
else
{
55
loaded++;
56
}
57
}
58
snprintf(line,
sizeof
(line),
"iop-boot: %d loaded, %d skipped, %d failed\n"
, loaded, skipped, failed);
59
say(line);
60
return
failed;
61
}
62
63
int
main(
void
) {
64
int
failed = test_main();
65
say(failed ?
"iop-boot: FAIL\n"
:
"iop-boot: PASS\n"
);
66
printf(
"[ps2rig] exit=%d\n"
, failed ? 1 : 0);
67
SleepThread();
68
return
0;
69
}
SifExecModuleBuffer
int SifExecModuleBuffer(void *ptr, u32 size, u32 arg_len, const char *args, int *mod_res)
Definition
loadfile.c:314
kernel.h
loadfile.h
sbv_patches.h
sbv_patch_enable_lmb
int sbv_patch_enable_lmb(void)
Definition
patch_enable_lmb.c:68
stdio.h
string.h
module
Definition
main.c:20
tests
iop-boot
src
main.c
Generated by
1.18.0