0
|
1 /*
|
|
2 * $Id$
|
|
3 */
|
|
4 #include "libps2.h"
|
|
5 #include "ps2util.h"
|
|
6 #include "controler.h"
|
|
7
|
|
8 SGO_PAD pad;
|
|
9
|
|
10 #ifdef DEMO_CREATE
|
|
11 extern void setPadValue(int pad);
|
|
12 #endif
|
|
13 extern int getPadValue();
|
|
14
|
|
15 Bool
|
|
16 padCheck()
|
|
17 {
|
|
18 int pad1;
|
|
19
|
|
20 pad1 = sjoy_get_ps2_button( JOYPAD_1 );
|
|
21
|
|
22 if (pad1 & SJOY_PS2_START) {
|
2
|
23 pad.st += (pad.st < 2) ? 1 : 0;
|
0
|
24 } else {
|
|
25 pad.st = 0;
|
|
26 }
|
|
27
|
|
28 if (pad1 & SJOY_PS2_SELECT) {
|
2
|
29 pad.se += (pad.se < 2) ? 1 : 0;
|
0
|
30 } else {
|
|
31 pad.se = 0;
|
|
32 }
|
|
33 if (pad1 & SJOY_PS2_LEFT) {
|
2
|
34 pad.left += (pad.left < 2) ? 1 : 0;
|
0
|
35 } else {
|
|
36 pad.left = 0;
|
|
37 }
|
|
38 if (pad1 & SJOY_PS2_RIGHT) {
|
2
|
39 pad.right += (pad.right < 2) ? 1 : 0;
|
0
|
40 } else {
|
|
41 pad.right = 0;
|
|
42 }
|
|
43 if (pad1 & SJOY_PS2_UP) {
|
2
|
44 pad.up += (pad.up < 2) ? 1 : 0;
|
0
|
45 } else {
|
|
46 pad.up = 0;
|
|
47 }
|
|
48 if (pad1 & SJOY_PS2_DOWN) {
|
2
|
49 pad.down += (pad.down < 2) ? 1 : 0;
|
0
|
50 } else {
|
|
51 pad.down = 0;
|
|
52 }
|
|
53 if (pad1 & SJOY_PS2_R1) {
|
2
|
54 pad.r1 += (pad.r1 < 2) ? 1 : 0;
|
0
|
55 } else {
|
|
56 pad.r1 = 0;
|
|
57 }
|
|
58 if (pad1 & SJOY_PS2_R2) {
|
2
|
59 pad.r2 += (pad.r2 < 2) ? 1 : 0;
|
0
|
60 } else {
|
|
61 pad.r2 = 0;
|
|
62 }
|
|
63 if (pad1 & SJOY_PS2_L1) {
|
2
|
64 pad.l1 += (pad.l1 < 2) ? 1 : 0;
|
0
|
65 } else {
|
|
66 pad.l1 = 0;
|
|
67 }
|
|
68 if (pad1 & SJOY_PS2_L2) {
|
2
|
69 pad.l2 += (pad.l2 < 2) ? 1 : 0;
|
0
|
70 } else {
|
|
71 pad.l2 = 0;
|
|
72 }
|
|
73 if (pad1 & SJOY_PS2_CROSS) {
|
2
|
74 pad.cross += (pad.cross < 2) ? 1 : 0;
|
0
|
75 } else {
|
|
76 pad.cross = 0;
|
|
77 }
|
|
78 if (pad1 & SJOY_PS2_CIRCLE) {
|
2
|
79 pad.circle += (pad.circle < 2) ? 1 : 0;
|
0
|
80 } else {
|
|
81 pad.circle = 0;
|
|
82 }
|
|
83 if (pad1 & SJOY_PS2_TRIANGLE) {
|
2
|
84 pad.triangle += (pad.triangle < 2) ? 1 : 0;
|
0
|
85 } else {
|
|
86 pad.triangle = 0;
|
|
87 }
|
|
88 if (pad1 & SJOY_PS2_SQUARE) {
|
2
|
89 pad.square += (pad.square < 2) ? 1 : 0;
|
0
|
90 } else {
|
|
91 pad.square = 0;
|
|
92 }
|
|
93
|
|
94 if ( (pad1 & SJOY_PS2_SELECT) && (pad1 & SJOY_PS2_START) &&
|
|
95 (pad1 & SJOY_PS2_L1) && (pad1 & SJOY_PS2_R1) &&
|
|
96 (pad1 & SJOY_PS2_L2) && (pad1 & SJOY_PS2_R2)) {
|
|
97 return FALSE;
|
|
98 }
|
|
99
|
|
100 return TRUE;
|
|
101 }
|