-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmoduleloader.c
146 lines (137 loc) · 3.3 KB
/
moduleloader.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#include "moduleloader.h"
#include <libmc.h>
#include <libpad.h>
#include <kernel.h>
#include <debug.h>
#include <netman.h>
#include <loadfile.h>
#include <iopheap.h>
#include <sifrpc.h>
extern unsigned char ps2dev9_irx[];
extern unsigned int size_ps2dev9_irx;
extern unsigned char smap_irx[];
extern unsigned int size_smap_irx;
extern unsigned char netman_irx[];
extern unsigned int size_netman_irx;
void ps2IOPinit()
{
// Reboot IOP
SifInitRpc(0);
while (!SifIopReset("", 0))
{
};
while (!SifIopSync())
{
};
// Initialize SIF services
SifInitRpc(0);
SifLoadFileInit();
SifInitIopHeap();
sbv_patch_enable_lmb();
}
void ps2mcInitModules()
{
int ret;
scr_printf(" >");
scr_printf(" SIO2MAN.IRX");
ret = SifLoadModule("rom0:SIO2MAN", 0, NULL);
if (ret < 0)
{
scr_printf(" #\n");
scr_printf("sifLoadModule sio failed: %d\n", ret);
SleepThread();
}
scr_printf(" MCMAN.IRX");
ret = SifLoadModule("rom0:MCMAN", 0, NULL);
if (ret < 0)
{
scr_printf(" #\n");
scr_printf("sifLoadModule mcman failed: %d\n", ret);
SleepThread();
}
scr_printf(" MCSERV.IRX");
ret = SifLoadModule("rom0:MCSERV", 0, NULL);
if (ret < 0)
{
scr_printf(" #\n");
scr_printf("sifLoadModule mcserv failed: %d\n", ret);
SleepThread();
}
scr_printf(" mcInit(MC_TYPE_MC);");
if (mcInit(MC_TYPE_MC) >= 0)
scr_printf(" <\n");
else
{
scr_printf(" #\n");
scr_printf("Failed to initialise memcard server!\n");
SleepThread();
}
}
void ps2padInitModules()
{
int ret;
scr_printf(" >");
scr_printf(" SIO2MAN.IRX");
ret = SifLoadModule("rom0:SIO2MAN", 0, NULL);
if (ret < 0)
{
scr_printf(" #\n");
scr_printf("sifLoadModule sio failed: %d\n", ret);
SleepThread();
}
scr_printf(" PADMAN.IRX");
ret = SifLoadModule("rom0:PADMAN", 0, NULL);
if (ret < 0)
{
scr_printf(" #\n");
scr_printf("sifLoadModule pad failed: %d\n", ret);
SleepThread();
}
scr_printf(" padInit(0);");
if (padInit(0) == 1)
scr_printf(" <\n");
else
{
scr_printf(" #\n");
scr_printf("Failed to initialise gamepad server!\n");
SleepThread();
}
}
void ps2ipInitModules()
{
int ret;
scr_printf(" >");
scr_printf(" DEV9.IRX");
ret = SifExecModuleBuffer(ps2dev9_irx, size_ps2dev9_irx, 0, NULL, NULL);
if (ret < 0)
{
scr_printf(" #\n");
scr_printf("sifLoadModule dev9 failed: %d\n", ret);
SleepThread();
}
scr_printf(" NETMAN.IRX");
ret = SifExecModuleBuffer(netman_irx, size_netman_irx, 0, NULL, NULL);
if (ret < 0)
{
scr_printf(" #\n");
scr_printf("sifLoadModule netman failed: %d\n", ret);
SleepThread();
}
scr_printf(" SMAP.IRX");
ret = SifExecModuleBuffer(smap_irx, size_smap_irx, 0, NULL, NULL);
if (ret < 0)
{
scr_printf(" #\n");
scr_printf("sifLoadModule smap failed: %d\n", ret);
SleepThread();
}
scr_printf(" NetManInit();");
if (NetManInit() >= 0)
scr_printf(" <\n");
else
{
scr_printf(" #\n");
scr_printf("Failed to initialise network manager!\n");
SleepThread();
}
}