forked from mbacker80/-PS2-LiveDebug-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqwerty.c
267 lines (248 loc) · 6.34 KB
/
qwerty.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
u8 send_buffer2[16] __attribute__((aligned(16)));
u8 memsend[512] __attribute__((aligned(16)));
int iop_heap_dma_upload(void *src,u32 dst,int size)
{
int i=0,len=0,size2;
u8 *pkt;
int ret=0;
int ret2=0;
int p=0;
int cont1=0;
while(size>0) // send data with src unaligned
{
if(size>512) size2=512; else size2=size;
memcpy2(memsend,((char *) src)+p,size2);
do
{
FlushCache(0);
/* build packet */
pkt = send_buffer2;
PUSHDATA( u32, pkt, (u32)memsend, i);
pkt += i; len += i;
PUSHDATA( u32, pkt, dst, i);
pkt += i; len += i;
PUSHDATA( int, pkt, size2, i);
pkt += i; len += i;
PUSHDATA( int, pkt, 0, i);
pkt += i; len += i;
ret = SifSetDma(send_buffer2,1);
if(ret==0) {nopdelay();cont1++;}
if(ret==0 && cont1>=3) {cont1=0;SifSetDChain();}
}while(ret==0); // modificado por Hermes
while((ret2 = SifDmaStat(ret))>=0);
FlushCache(0);
size-=size2;
p+=size2;
dst+=size2;
}
return (ret2 < -1);
}
int loadmodulemem(char *buf,int len,int lenarg,char *arg)
{
unsigned iopmem=0;
int ret=0;
SifInitIopHeap();
iopmem=SifAllocIopHeap(len+15);
if(iopmem==0) {return -1;}
if(iop_heap_dma_upload(buf, iopmem,len+15)<0) {SifFreeIopHeap(iopmem);return -1;}
if(SifLoadModuleBuffer(iopmem,lenarg, arg)<0) {SifFreeIopHeap(iopmem);return -1;}
return ret;
}
void memcpy2(unsigned char *dest,unsigned char *org,int ndata)
{
int n;
for(n=0;n<ndata;n++) dest[n]=org[n];
}
void memset2(unsigned char *dest,unsigned char val,int ndata)
{
int n;
for(n=0;n<ndata;n++) dest[n]=val;
}
char iopmod[1865] ={
127,69,76,70,1,1,1,
0,0,0,0,0,0,0,0,0,128,
255,8,0,1,0,0,0,172,0,0,
0,52,0,0,0,200,4,0,0,1,
0,0,0,52,0,32,0,2,0,40,
0,10,0,7,0,128,0,0,112,116,
0,0,0,0,0,0,0,0,0,0,
0,27,0,0,0,0,0,0,0,4,
0,0,0,4,0,0,0,1,0,0,
0,144,0,0,0,0,0,0,0,0,
0,0,0,240,3,0,0,80,4,0,
0,7,0,0,0,16,0,0,0,255,
255,255,255,172,0,0,0,240,131,0,
0,224,3,0,0,16,0,0,0,96,
0,0,0,0,0,0,0,8,0,224,
3,0,0,0,0,232,255,189,39,16,
0,176,175,33,128,160,0,20,0,191,
175,0,0,3,130,99,0,2,36,7,
0,98,20,114,0,2,36,103,0,0,
12,33,32,0,0,111,0,0,12,33,
32,0,0,0,0,3,130,114,0,2,
36,3,0,98,20,0,0,0,0,115,
0,0,12,33,32,0,0,0,0,3,
130,115,0,2,36,5,0,98,20,116,
0,2,36,119,0,0,12,0,0,0,
0,0,0,3,130,116,0,2,36,6,
0,98,20,255,255,2,36,113,0,0,
12,0,0,0,0,255,0,67,48,0,
255,2,60,37,16,98,0,20,0,191,
143,16,0,176,143,8,0,224,3,24,
0,189,39,8,0,224,3,0,0,0,
0,8,0,224,3,255,255,2,36,232,
255,189,39,16,0,191,175,215,0,0,
12,33,32,0,0,0,0,7,60,164,
0,231,36,15,0,6,36,60,0,5,
36,0,0,3,60,240,3,99,36,0,
0,4,60,224,3,132,36,16,0,2,
36,4,0,98,172,1,0,2,36,8,
0,98,172,0,0,2,60,8,4,66,
36,0,0,100,172,12,0,100,172,16,
0,98,172,0,0,1,60,33,8,37,
0,8,4,39,172,255,255,198,36,251,
255,193,4,252,255,165,36,0,0,4,
60,224,3,132,36,0,0,2,60,8,
4,66,36,0,0,3,60,156,0,99,
36,0,0,67,172,0,0,3,60,8,
0,99,36,185,0,0,12,12,0,67,
172,0,0,4,60,240,3,132,36,183,
0,0,12,0,0,0,0,16,0,191,
143,33,16,0,0,8,0,224,3,24,
0,189,39,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,224,65,0,
0,0,0,1,1,0,0,99,100,118,
100,109,97,110,0,8,0,224,3,4,
0,0,36,8,0,224,3,5,0,0,
36,8,0,224,3,6,0,0,36,8,
0,224,3,7,0,0,36,8,0,224,
3,8,0,0,36,8,0,224,3,9,
0,0,36,8,0,224,3,10,0,0,
36,8,0,224,3,11,0,0,36,8,
0,224,3,12,0,0,36,8,0,224,
3,13,0,0,36,8,0,224,3,14,
0,0,36,8,0,224,3,15,0,0,
36,8,0,224,3,16,0,0,36,8,
0,224,3,17,0,0,36,8,0,224,
3,21,0,0,36,8,0,224,3,22,
0,0,36,8,0,224,3,24,0,0,
36,8,0,224,3,28,0,0,36,8,
0,224,3,37,0,0,36,0,0,0,
8,38,0,0,36,8,0,224,3,39,
0,0,36,8,0,224,3,44,0,0,
36,8,0,224,3,66,0,0,36,8,
0,224,3,75,0,0,36,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,224,65,0,0,0,0,2,1,0,
0,105,111,109,97,110,0,0,0,8,
0,224,3,4,0,0,36,8,0,224,
3,5,0,0,36,8,0,224,3,6,
0,0,36,8,0,224,3,7,0,0,
36,8,0,224,3,8,0,0,36,8,
0,224,3,9,0,0,36,8,0,224,
3,10,0,0,36,8,0,224,3,11,
0,0,36,8,0,224,3,12,0,0,
36,8,0,224,3,13,0,0,36,8,
0,224,3,14,0,0,36,8,0,224,
3,15,0,0,36,8,0,224,3,16,
0,0,36,8,0,224,3,17,0,0,
36,8,0,224,3,18,0,0,36,8,
0,224,3,20,0,0,36,8,0,224,
3,21,0,0,36,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,224,65,0,
0,0,0,1,1,0,0,115,105,102,
99,109,100,0,0,8,0,224,3,4,
0,0,36,8,0,224,3,5,0,0,
36,8,0,224,3,6,0,0,36,8,
0,224,3,7,0,0,36,8,0,224,
3,8,0,0,36,8,0,224,3,10,
0,0,36,8,0,224,3,11,0,0,
36,8,0,224,3,12,0,0,36,8,
0,224,3,13,0,0,36,8,0,224,
3,14,0,0,36,8,0,224,3,15,
0,0,36,8,0,224,3,16,0,0,
36,8,0,224,3,17,0,0,36,8,
0,224,3,18,0,0,36,8,0,224,
3,19,0,0,36,8,0,224,3,20,
0,0,36,8,0,224,3,21,0,0,
36,8,0,224,3,22,0,0,36,8,
0,224,3,23,0,0,36,8,0,224,
3,24,0,0,36,8,0,224,3,25,
0,0,36,8,0,224,3,32,0,0,
36,8,0,224,3,33,0,0,36,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,113,
119,101,114,116,121,0,0,0,0,0,
0,0,0,0,0,0,46,115,121,109,
116,97,98,0,46,115,116,114,116,97,
98,0,46,115,104,115,116,114,116,97,
98,0,46,105,111,112,109,111,100,0,
46,116,101,120,116,0,46,114,101,108,
46,116,101,120,116,0,46,114,111,100,
97,116,97,0,46,100,97,116,97,0,
46,98,115,115,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0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