#include "menu.h" #if defined(__GP2X__) #include "usbjoy.h" static struct usbjoy *joys[4]; static char joyCount = 0; static int buttonMap[4][32]; #endif struct INPUT Inp; static int repeatCounter = 0; int InputInit() { memset(&Inp,0,sizeof(Inp)); #if defined(__GP2X__) int i; for (i=1; i<5; i++) { struct usbjoy *joy = joy_open(i); if(joy != NULL) { joys[joyCount] = joy; memset(buttonMap[joyCount],0,sizeof(buttonMap[joyCount])); buttonMap[joyCount][0] = (1<numbuttons<10) { buttonMap[joyCount][6] = (1<=0x80) held&=0xbf; // Keep looping around Inp.held[i]=held; } // Work out some key repeat values: for (i=0;i<32;i++) { char rep=0; int held=Inp.held[i]; if (held==1) { // Key has just been pressed again, so set repeat by default rep=1; } else { // Now make sure key has been held for a period of time // before auto toggling the repeat flag if (held>=0x20) { repeatCounter++; if(repeatCounter>15) { rep=1; repeatCounter=0; } } } Inp.repeat[i]=rep; } return 0; }