extern int CALLBACK SPUplayCDDAchannel(short *, int);
/* PAD */
-static long PADreadPort1(PadDataS *pad, int pad_index) {
+static long PADreadPort1(PadDataS *pad) {
+ int pad_index = pad->requestPadIndex;
pad->controllerType = in_type[pad_index];
pad->buttonStatus = ~in_keystate[pad_index];
if (multitap1 == 1)
return 0;
}
-static long PADreadPort2(PadDataS *pad, int pad_index) {
- /* Temporary hack to avoid segfault when pad_index is a crazy number */
- if (pad_index <= 1 || pad_index > 8) {
- pad_index = 1;
- }
-
+static long PADreadPort2(PadDataS *pad) {
+ int pad_index = pad->requestPadIndex;
+
pad->controllerType = in_type[pad_index];
pad->buttonStatus = ~in_keystate[pad_index];
if (multitap2 ==1 )
\r
#define LoadGpuSym1(dest, name) \\r
LoadSym(GPU_##dest, GPU##dest, name, TRUE);\r
-\r
+
#define LoadGpuSym0(dest, name) \\r
LoadSym(GPU_##dest, GPU##dest, name, FALSE); \\r
if (GPU_##dest == NULL) GPU_##dest = (GPU##dest) GPU__##dest;\r
static int multitap1 = -1;\r
static int multitap2 = -1;\r
\r
-static unsigned char buf[512];\r
+static unsigned char buf[256];\r
unsigned char stdpar[10] = { 0x00, 0x41, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };\r
unsigned char mousepar[8] = { 0x00, 0x12, 0x5a, 0xff, 0xff, 0xff, 0xff };\r
unsigned char analogpar[9] = { 0x00, 0xff, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };\r
// first call the pad provide if a multitap is connected between the psx and himself\r
if(multitap1 == -1)\r
{\r
- PadDataS padd;\r
- PAD1_readPort1(&padd, 0);\r
+ PadDataS padd;
+ padd.requestPadIndex = 0;\r
+ PAD1_readPort1(&padd);\r
multitap1 = padd.portMultitap;\r
}\r
// just one pad is on port 1 : NO MULTITAP\r
if (multitap1 == 0)\r
{\r
- PadDataS padd;\r
- PAD1_readPort1(&padd, 0);\r
+ PadDataS padd;
+ padd.requestPadIndex = 0;\r
+ PAD1_readPort1(&padd);\r
return _PADstartPoll(&padd);\r
} else {\r
// a multitap is plugged : refresh all pad.\r
int i=0;\r
PadDataS padd[4];\r
- for(i = 0; i < 4; i++) {\r
- PAD1_readPort1(&padd[i], i);\r
+ for(i = 0; i < 4; i++) {
+ padd[i].requestPadIndex = i;\r
+ PAD1_readPort1(&padd[i]);\r
}\r
return _PADstartPollMultitap(padd);\r
}\r
}\r
//first call the pad provide if a multitap is connected between the psx and himself\r
if(multitap2 == -1){\r
- PadDataS padd;\r
- PAD2_readPort2(&padd,pad_index);\r
+ PadDataS padd;
+ padd.requestPadIndex = pad_index;\r
+ PAD2_readPort2(&padd);\r
multitap2 = padd.portMultitap;\r
}\r
\r
// just one pad is on port 2 : NO MULTITAP\r
if (multitap2 == 0){\r
- PadDataS padd;\r
- PAD2_readPort2(&padd,pad_index);\r
+ PadDataS padd;
+ padd.requestPadIndex = pad_index;\r
+ PAD2_readPort2(&padd);\r
return _PADstartPoll(&padd);\r
}else{\r
//a multitap is plugged : refresh all pad.\r
int i=0;\r
PadDataS padd[4];\r
- for(i=0;i<4;i++){\r
- PAD2_readPort2(&padd[i],i+pad_index);\r
+ for(i=0;i<4;i++){
+ padd[i].requestPadIndex = i+pad_index;\r
+ PAD2_readPort2(&padd[i]);\r
}\r
return _PADstartPollMultitap(padd);\r
}\r
typedef long (CALLBACK* PADtest)(void); \r
typedef long (CALLBACK* PADclose)(void);\r
typedef long (CALLBACK* PADquery)(void);\r
-typedef long (CALLBACK* PADreadPort1)(PadDataS*, int pad_index);\r
-typedef long (CALLBACK* PADreadPort2)(PadDataS*, int pad_index);\r
+typedef long (CALLBACK* PADreadPort1)(PadDataS*);\r
+typedef long (CALLBACK* PADreadPort2)(PadDataS*);\r
typedef long (CALLBACK* PADkeypressed)(void);\r
typedef unsigned char (CALLBACK* PADstartPoll)(int);\r
typedef unsigned char (CALLBACK* PADpoll)(unsigned char);\r