}
static long PADreadPort2(PadDataS *pad, int pad_index) {
- pad->controllerType = in_type[pad_index];
+ /* Temporary hack to avoid segfault when pad_index is a crazy number */
+ if (pad_index <= 1 || pad_index > 8) {
+ pad_index = 1;
+ }
+
+ pad->controllerType = in_type[pad_index];
pad->buttonStatus = ~in_keystate[pad_index];
if(multitap2==1){
pad->portMultitap=2;
\r
//PadDataS padd1, padd2;\r
unsigned char _PADstartPollMultitap(PadDataS padd[4]) {\r
- int i=0;\r
- int decallage=2;\r
+ int i=0;\r
+ int decallage=2;\r
bufc = 0;\r
PadDataS pad;\r
for(i=0;i<4;i++){\r
return _PADstartPoll(&padd);\r
}else{\r
//a multitap is plugged : refresh all pad.\r
- int i=pad_index;\r
+ int i=0;\r
PadDataS padd[4];\r
for(i=0;i<4;i++){\r
PAD2_readPort2(&padd[i],i+pad_index);\r