joypad[KEY_BUTTON_START] = sdlFromHex(value);
joypad[0][KEY_BUTTON_START] = sdlFromHex(value);
void sdlReadPreferences(FILE *f){  char buffer[2048];    while(1) {    char *s = fgets(buffer, 2048, f);    if(s == NULL)      break;    char *p  = strchr(s, '#');        if(p)      *p = 0;        char *token = strtok(s, " \t\n\r=");    if(!token)      continue;    if(strlen(token) == 0)      continue;    char *key = token;    char *value = strtok(NULL, "\t\n\r");    if(value == NULL) {      fprintf(stderr, "Empty value for key %s\n", key);      continue;    }    if(!strcmp(key,"Joy0_Left")) {      joypad[KEY_LEFT] = sdlFromHex(value);    } else if(!strcmp(key, "Joy0_Right")) {      joypad[KEY_RIGHT] = sdlFromHex(value);    } else if(!strcmp(key, "Joy0_Up")) {      joypad[KEY_UP] = sdlFromHex(value);    } else if(!strcmp(key, "Joy0_Down")) {      joypad[KEY_DOWN] = sdlFromHex(value);    } else if(!strcmp(key, "Joy0_A")) {      joypad[KEY_BUTTON_A] = sdlFromHex(value);    } else if(!strcmp(key, "Joy0_B")) {      joypad[KEY_BUTTON_B] = sdlFromHex(value);    } else if(!strcmp(key, "Joy0_L")) {      joypad[KEY_BUTTON_L] = sdlFromHex(value);    } else if(!strcmp(key, "Joy0_R")) {      joypad[KEY_BUTTON_R] = sdlFromHex(value);    } else if(!strcmp(key, "Joy0_Start")) {      joypad[KEY_BUTTON_START] = sdlFromHex(value);    } else if(!strcmp(key, "Joy0_Select")) {      joypad[KEY_BUTTON_SELECT] = sdlFromHex(value);    } else if(!strcmp(key, "Joy0_Speed")) {      joypad[KEY_BUTTON_SPEED] = sdlFromHex(value);    } else if(!strcmp(key, "Joy0_Capture")) {      joypad[KEY_BUTTON_CAPTURE] = sdlFromHex(value);    } else if(!strcmp(key, "Motion_Left")) {      motion[KEY_LEFT] = sdlFromHex(value);    } else if(!strcmp(key, "Motion_Right")) {      motion[KEY_RIGHT] = sdlFromHex(value);    } else if(!strcmp(key, "Motion_Up")) {      motion[KEY_UP] = sdlFromHex(value);    } else if(!strcmp(key, "Motion_Down")) {      motion[KEY_DOWN] = sdlFromHex(value);    } else if(!strcmp(key, "frameSkip")) {      frameSkip = sdlFromHex(value);      if(frameSkip < 0 || frameSkip > 9)        frameSkip = 2;    } else if(!strcmp(key, "gbFrameSkip")) {      gbFrameSkip = sdlFromHex(value);      if(gbFrameSkip < 0 || gbFrameSkip > 9)        gbFrameSkip = 0;          } else if(!strcmp(key, "video")) {      sizeOption = sdlFromHex(value);      if(sizeOption < 0 || sizeOption > 3)        sizeOption = 1;    } else if(!strcmp(key, "fullScreen")) {      fullscreen = sdlFromHex(value) ? 1 : 0;    } else if(!strcmp(key, "useBios")) {      useBios = sdlFromHex(value) ? true : false;    } else if(!strcmp(key, "biosFile")) {      strcpy(biosFileName, value);    } else if(!strcmp(key, "filter")) {      filter = sdlFromHex(value);      if(filter < 0 || filter > 10)        filter = 0;    } else if(!strcmp(key, "disableStatus")) {      disableStatusMessages = sdlFromHex(value) ? true : false;    } else if(!strcmp(key, "borderOn")) {      gbBorderOn = sdlFromHex(value) ? true : false;    } else if(!strcmp(key, "emulatorType")) {      gbEmulatorType = sdlFromHex(value);      if(gbEmulatorType < 0 || gbEmulatorType > 4)        gbEmulatorType = 1;    } else if(!strcmp(key, "colorOption")) {      gbColorOption = sdlFromHex(value) ? true : false;    } else if(!strcmp(key, "captureDir")) {      sdlCheckDirectory(value);      strcpy(captureDir, value);    } else if(!strcmp(key, "saveDir")) {      sdlCheckDirectory(value);      strcpy(saveDir, value);    } else if(!strcmp(key, "batteryDir")) {      sdlCheckDirectory(value);      strcpy(batteryDir, value);    } else if(!strcmp(key, "captureFormat")) {      captureFormat = sdlFromHex(value);    } else if(!strcmp(key, "soundQuality")) {      soundQuality = sdlFromHex(value);      switch(soundQuality) {      case 1:      case 2:      case 4:        break;      default:        fprintf(stderr, "Unknown sound quality %d. Defaulting to 22Khz\n", soundQuality);        soundQuality = 2;        break;      }    } else if(!strcmp(key, "soundEcho")) {      soundEcho = sdlFromHex(value) ? true : false;    } else if(!strcmp(key, "soundLowPass")) {      soundLowPass = sdlFromHex(value) ? true : false;    } else if(!strcmp(key, "soundReverse")) {      soundReverse = sdlFromHex(value) ? true : false;    } else if(!strcmp(key, "soundVolume")) {      soundVolume = sdlFromHex(value);      if(soundVolume < 0 || soundVolume > 3)        soundVolume = 0;    } else if(!strcmp(key, "removeIntros")) {      removeIntros = sdlFromHex(value) ? true : false;    } else if(!strcmp(key, "saveType")) {      cpuSaveType = sdlFromHex(value);      if(cpuSaveType < 0 || cpuSaveType > 4)        cpuSaveType = 0;    } else if(!strcmp(key, "flashSize")) {      sdlFlashSize = sdlFromHex(value);      if(sdlFlashSize != 0 && sdlFlashSize != 1)        sdlFlashSize = 0;    } else if(!strcmp(key, "ifbType")) {      ifbType = sdlFromHex(value);      if(ifbType < 0 || ifbType > 2)        ifbType = 0;    } else if(!strcmp(key, "showSpeed")) {      showSpeed = sdlFromHex(value);      if(showSpeed < 0 || showSpeed > 2)        showSpeed = 1;    } else if(!strcmp(key, "showSpeedTransparent")) {      showSpeedTransparent = sdlFromHex(value);    } else if(!strcmp(key, "autoFrameSkip")) {      autoFrameSkip = sdlFromHex(value);    } else if(!strcmp(key, "disableMMX")) {#ifdef MMX      cpu_mmx = sdlFromHex(value) ? false : true;#endif    } else {      fprintf(stderr, "Unknown configuration key %s\n", key);    }  }}