2 Copyright 2009-2010, Ifcaro, jimmikaelkael & Polo
3 Copyright 2006-2008 Polo
4 Licenced under Academic Free License version 3.0
5 Review Open-Ps2-Loader README & LICENSE files for further details.
7 Some parts of the code are taken from HD Project by Polo
15 /*******************************************************
33 static u32 padPortOpenpattern0
[] = {
34 0x27bdff50, // addiu sp, sp, $ff50
35 0xffb40050, // sd s4, $0050(sp)
36 0xffb30040, // sd s3, $0040(sp)
37 0x00c0a02d, // daddu s4, a2, zero
38 0xffb20030, // sd s2, $0030(sp)
39 0x0080982d, // daddu s3, a0, zero
40 0xffbf00a0, // sd ra, $00a0(sp)
41 0x00a0902d, // daddu s2, a1, zero
42 0xffbe0090, // sd fp, $0090(sp)
43 0x3282003f, // andi v0, s4, $003f
44 0xffb70080, // sd s7, $0080(sp)
45 0xffb60070, // sd s6, $0070(sp)
46 0xffb50060, // sd s5, $0060(sp)
47 0xffb10020, // sd s1, $0020(sp)
48 0x10400000, // beq v0, zero, $XXXXXXXX
49 0xffb00010, // sd s0, $0010(sp)
50 0x3c020000, // lui v0, $XXXX
51 0x8c430000, // lw v1, $XXXX(v0)
52 0x10600000, // beq v1, zero, $XXXXXXXX
53 0x3c040000, // lui a0, $XXXX
54 0x0280282d, // daddu a1, s4, zero
55 0x0c000000 // jal scePrintf
57 static u32 padPortOpenpattern0_mask
[] = {
82 /*******************************************************
87 static u32 padPortOpenpattern1
[] = {
88 0x27bdff50, // addiu sp, sp, $ff50
89 0xffb20030, // sd s2, $0030(sp)
90 0xffb40050, // sd s4, $0050(sp)
91 0x00c0902d, // daddu s2, a2, zero
92 0xffb30040, // sd s3, $0040(sp)
93 0x00a0a02d, // daddu s4, a1, zero
94 0xffbf00a0, // sd ra, $00a0(sp)
95 0x0080982d, // daddu s3, a0, zero
96 0xffbe0090, // sd fp, $0090(sp)
97 0x3242003f, // andi v0, s2, $003f
98 0xffb70080, // sd s7, $0080(sp)
99 0xffb60070, // sd s6, $0070(sp)
100 0xffb50060, // sd s5, $0060(sp)
101 0xffb10020, // sd s1, $0020(sp)
102 0x10400000, // beq v0, zero, $XXXXXXXX
103 0xffb00010, // sd s0, $0010(sp)
104 0x3c040000, // lui a0, $XXXX
105 0x0240282d, // daddu a1, s2, zero
106 0x0c000000 // jal kprintf
108 static u32 padPortOpenpattern1_mask
[] = {
130 /*******************************************************
136 static u32 padPortOpenpattern2
[] = {
137 0x27bdff60, // addiu sp, sp, $ff60
138 0xffb20030, // sd s2, $0030(sp)
139 0xffb70080, // sd s7, $0080(sp)
140 0x00c0902d, // daddu s2, a2, zero
141 0xffb60070, // sd s6, $0070(sp)
142 0x0080b82d, // daddu s7, a0, zero
143 0xffbf0090, // sd ra, $0090(sp)
144 0x00a0b02d, // daddu s6, a1, zero
145 0xffb50060, // sd s5, $0060(sp)
146 0x3242003f, // andi v0, s2, $003f
147 0xffb40050, // sd s4, $0050(sp)
148 0xffb30040, // sd s3, $0040(sp)
149 0xffb10020, // sd s1, $0020(sp)
150 0x10400000, // beq v0, zero, $XXXXXXXX
151 0xffb00010, // sd s0, $0010(sp)
152 0x3c040000, // lui a0, $XXXX
153 0x0240282d, // daddu a1, s2, zero
154 0x0c000000 // jal printf
156 static u32 padPortOpenpattern2_mask
[] = {
177 /*******************************************************
182 static u32 padPortOpenpattern3
[] = {
183 0x27bdff70, // addiu sp, sp, $ff70
184 0xffb20030, // sd s2, $0030(sp)
185 0xffb50060, // sd s5, $0060(sp)
186 0x00c0902d, // daddu s2, a2, zero
187 0xffb40050, // sd s4, $0050(sp)
188 0x0080a82d, // daddu s5, a0, zero
189 0xffbf0080, // sd ra, $0080(sp)
190 0x00a0a02d, // daddu s4, a1, zero
191 0xffb60070, // sd s6, $0070(sp)
192 0x3242000f, // andi v0, s2, $000f
193 0xffb30040, // sd s3, $0040(sp)
194 0xffb10020, // sd s1, $0020(sp)
195 0x10400000, // beq v0, zero, $XXXXXXXX
196 0xffb00010, // sd s0, $0010(sp)
197 0x3c040000, // lui a0, $XXXX
198 0x0c000000 // jal printf
200 static u32 padPortOpenpattern3_mask
[] = {
219 /**************************************************************************
220 * For libpad2 support
227 static u32 pad2CreateSocketpattern0
[] = {
228 0x27bdff90, // addiu sp, sp, $ff90
229 0x0080302d, // daddu a2, a0, zero
230 0xffb10040, // sd s1, $0040(sp)
231 0x00a0882d, // daddu s1, a1, zero
232 0xffbf0060, // sd ra, $0060(sp)
233 0xffb20050, // sd s2, $0050(sp)
234 0x3222003f, // andi v0, s1, $003f
235 0x10400000, // beq v0, zero, $XXXXXXXX
236 0xffb00030, // sd s0, $0030(sp)
237 0x3c040000, // lui a0, $XXXX
238 0x0c000000, // jal scePrintf
239 0x24840000, // addiu a0, a0, $XXXX
240 0x10000000, // beq zero, zero, $XXXXXXXX
241 0x2402ffff, // addiu v0, zero, $ffff
242 0x50c00000, // beql a2, zero, $XXXXXXXX
243 0xafa00000, // sw zero, $0000(sp)
244 0x8cc20000, // lw v0, $0000(a2)
245 0x8cc30004, // lw v1, $0004(a2)
246 0x8cc40008, // lw a0, $0008(a2)
247 0x8cc5000c, // lw a1, $000c(a2)
248 0xafa20000, // sw v0, $0000(sp)
249 0xafa30008, // sw v1, $0008(sp)
250 0xafa4000c, // sw a0, $000c(sp)
251 0xafa50010 // sw a1, $0010(sp)
253 static u32 pad2CreateSocketpattern0_mask
[] = {
280 /**************************************************************************
281 * For libpad2 support
285 static u32 pad2CreateSocketpattern1
[] = {
286 0x27bdff70, // addiu sp, sp, $ff70
287 0x0080302d, // daddu a2, a0, zero
288 0xffb30060, // sd s3, $0060(sp)
289 0x00a0982d, // daddu s3, a1, zero
290 0xffbf0080, // sd ra, $0080(sp)
291 0xffb40070, // sd s4, $0070(sp)
292 0x3262003f, // andi v0, s3, $003f
293 0xffb20050, // sd s2, $0050(sp)
294 0xffb10040, // sd s1, $0040(sp)
295 0x10400000, // beq v0, zero, $XXXXXXXX
296 0xffb00030, // sd s0, $0030(sp)
297 0x3c040000, // lui a0, $XXXX
298 0x0c000000, // jal scePrintf
299 0x24840000, // addiu a0, a0, $XXXX
300 0x10000000, // beq zero, zero, $XXXXXXXX
301 0x2402ffff, // addiu v0, zero, $ffff
302 0x50c00000, // beql a2, zero, $XXXXXXXX
303 0xafa00000, // sw zero, $0000(sp)
304 0x8cc20000, // lw v0, $0000(a2)
305 0x8cc30004, // lw v1, $0004(a2)
306 0x8cc40008, // lw a0, $0008(a2)
307 0x8cc5000c, // lw a1, $000c(a2)
308 0xafa20000, // sw v0, $0000(sp)
309 0xafa30008, // sw v1, $0008(sp)
310 0xafa4000c // sw a0, $000c(sp)
312 static u32 pad2CreateSocketpattern1_mask
[] = {
340 /**************************************************************************
341 * For libpad2 support
345 static u32 pad2CreateSocketpattern2
[] = {
346 0x27bdff70, // addiu sp, sp, $ff70
347 0x0080302d, // daddu a2, a0, zero
348 0xffb30060, // sd s3, $0060(sp)
349 0x00a0982d, // daddu s3, a1, zero
350 0xffbf0080, // sd ra, $0080(sp)
351 0xffb40070, // sd s4, $0070(sp)
352 0x3262003f, // andi v0, s3, $003f
353 0xffb20050, // sd s2, $0050(sp)
354 0xffb10040, // sd s1, $0040(sp)
355 0x10400000, // beq v0, zero, $XXXXXXXX
356 0xffb00030, // sd s0, $0030(sp)
357 0x10000000, // beq zero, zero, $XXXXXXXX
358 0x2402ffff, // addiu v0, zero, $ffff
359 0x50c00000, // beql a2, zero, $XXXXXXXX
360 0xafa00000, // sw zero, $0000(sp)
361 0x8cc20000, // lw v0, $0000(a2)
362 0x8cc30004, // lw v1, $0004(a2)
363 0x8cc40008, // lw a0, $0008(a2)
364 0x8cc5000c, // lw a1, $000c(a2)
365 0xafa20000, // sw v0, $0000(sp)
366 0xafa30008, // sw v1, $0008(sp)
367 0xafa4000c, // sw a0, $000c(sp)
368 0xafa50010 // sw a1, $0010(sp)
370 static u32 pad2CreateSocketpattern2_mask
[] = {
396 #endif /* PADPATTERNS */