libpad with 2 controllers
Posted: Wed May 18, 2005 9:32 pm
Ok. I making an arcade-y type thing, with 1up, 2up or 2 player, depending on who's pressed start. And i'm up to the bit where i set up the pads (ie at the beginning!). So.
Based on the libpad sample, i noticed that when calling initializePad when none inserted hangs. Then i found code in the turnips source that must have been pulled out that chekcs for pad's existence: (cheers to pukko!)So i stuck that at the start and now initializePad returns quietly when none is pulgged in. So far so good.
The problem is that this only seems to work with dualshock (1 and 2) If i have a old digi pad or (more importantly) my remote IR-dongle the above loop goes for ever.(both have 0 modes and identify as a vanilla digital pad) However to find the type i have to do other stuff, which dies when no pad is inserted.
So now i just have to know at compile time what type of pad, rather than if there is one or not.
There has to be a way to achieve this, but i'm yet to find any source to assist.
All ideas are welcome!
thanks - cheriff
Based on the libpad sample, i noticed that when calling initializePad when none inserted hangs. Then i found code in the turnips source that must have been pulled out that chekcs for pad's existence: (cheers to pukko!)
Code: Select all
while((ret=padGetState(port, slot)) != PAD_STATE_STABLE) {
if(ret==0) {
// No pad connected!
printf("Pad(%d, %d) is disconnected\n", port, slot);
return 0;
}
printf("looping\n");
}
The problem is that this only seems to work with dualshock (1 and 2) If i have a old digi pad or (more importantly) my remote IR-dongle the above loop goes for ever.(both have 0 modes and identify as a vanilla digital pad) However to find the type i have to do other stuff, which dies when no pad is inserted.
So now i just have to know at compile time what type of pad, rather than if there is one or not.
There has to be a way to achieve this, but i'm yet to find any source to assist.
All ideas are welcome!
thanks - cheriff