for(i = 0; i < 12; i++) { int dev = (joypad[i] >> 12); int b = joypad[i] & 0xfff; if(dev) { dev--;  if((dev == which) && (b >= 128) && (b == (button+128))) { sdlButtons[i] = pressed;
for(int j = 0; j < 4; j++) { for(i = 0; i < 12; i++) { int dev = (joypad[j][i] >> 12); int b = joypad[j][i] & 0xfff; if(dev) { dev--;  if((dev == which) && (b >= 128) && (b == (button+128))) { sdlButtons[j][i] = pressed; }
void sdlUpdateJoyButton(int which,                        int button,                        bool pressed){  int i;  for(i = 0; i < 12; i++) {    int dev = (joypad[i] >> 12);    int b = joypad[i] & 0xfff;    if(dev) {      dev--;      if((dev == which) && (b >= 128) && (b == (button+128))) {        sdlButtons[i] = pressed;      }    }  }  for(i = 0; i < 4; i++) {    int dev = (motion[i] >> 12);    int b = motion[i] & 0xfff;    if(dev) {      dev--;      if((dev == which) && (b >= 128) && (b == (button+128))) {        sdlMotionButtons[i] = pressed;      }    }  }  }