cheatsAdd(code, desc, 0, 0, 256, 0,true);
cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 256, UNKNOWN_CODE,true);
void cheatsAddGSACode(char *code, char *desc, bool v3){  if(strlen(code) != 16) {    // wrong cheat    systemMessage(MSG_INVALID_GSA_CODE,                  "Invalid GSA code. Format is XXXXXXXXYYYYYYYY");    return;  }  cheatsToUpper(code);    int i;  for(i = 0; i < 16; i++) {    if(!CHEAT_IS_HEX(code[i])) {      // wrong cheat      systemMessage(MSG_INVALID_GSA_CODE,                    "Invalid GSA code. Format is XXXXXXXXYYYYYYYY");      return;    }  }    char buffer[10];  strncpy(buffer, code, 8);  buffer[8] = 0;  u32 address;  sscanf(buffer, "%x", &address);  strncpy(buffer, &code[8], 8);  buffer[8] = 0;  u32 value;  sscanf(buffer, "%x", &value);  cheatsDecryptGSACode(address, value, v3);  if(value == 0x1DC0DE) {    u32 gamecode = *((u32 *)&rom[0xac]);    if(gamecode != address) {      char buffer[5];      *((u32 *)buffer) = address;      buffer[4] = 0;      char buffer2[5];      *((u32 *)buffer2) = *((u32 *)&rom[0xac]);      buffer2[4] = 0;      systemMessage(MSG_GBA_CODE_WARNING, "Warning: cheats are for game %s. Current game is %s.\nCodes may not work correctly.",                    buffer, buffer2);    }    cheatsAdd(code, desc, 0, 0, 256, 0,true);    return;  }  if(isMultilineCode(cheatsNumber-1)) {    cheatsAdd(code, desc, address, value, 256, UNKNOWN_CODE, false);    return;  }  if(v3) {    int type = (address >> 25) & 127;    u32 addr = (address & 0x00F00000) << 4 | (address & 0x0003FFFF);    switch(type) {    case 0x00:      if(address == 0) {        type = (value >> 25) & 127;        addr = (value & 0x00F00000) << 4 | (value & 0x0003FFFF);        switch(type) {        case 0x08:          cheatsAdd(code, desc, addr, 0, 256, GSA_8_BIT_GS_WRITE2, true);          break;        case 0x09:          cheatsAdd(code, desc, addr, 0, 256, GSA_16_BIT_GS_WRITE2, true);          break;        case 0x0a:          cheatsAdd(code, desc, addr, 0, 256, GSA_32_BIT_GS_WRITE2, true);          break;        case 0x0c:        case 0x0d:        case 0x0e:        case 0x0f:          cheatsAdd(code, desc, value & 0x00FFFFFF, 0xFFFFFFFF, 256, GSA_16_BIT_ROM_PATCH2, true);          break;        case 0x40:          cheatsAdd(code, desc, addr, 0, 256, GSA_8_BIT_SLIDE, true);          break;        case 0x41:          cheatsAdd(code, desc, addr, 0, 256, GSA_16_BIT_SLIDE, true);          break;        case 0x42:          cheatsAdd(code, desc, addr, 0, 256, GSA_32_BIT_SLIDE, true);          break;        default:          cheatsAdd(code, desc, address & 0x00FFFFFF, value, 256, UNKNOWN_CODE,                    false);          break;        }      } else        cheatsAdd(code, desc, addr, value, 256, GSA_8_BIT_FILL, true);      break;    case 0x01:      cheatsAdd(code, desc, addr, value, 256, GSA_16_BIT_FILL, true);      break;    case 0x02:      cheatsAdd(code, desc, addr, value, 256, INT_32_BIT_WRITE, true);      break;    case 0x04:      cheatsAdd(code, desc, addr, value, 256, GSA_8_BIT_IF_TRUE, true);      break;    case 0x05:      cheatsAdd(code, desc, addr, value, 256, CBA_IF_TRUE, true);      break;    case 0x06:      cheatsAdd(code, desc, addr, value, 256, GSA_32_BIT_IF_TRUE, true);      break;    case 0x08:      cheatsAdd(code, desc, addr, value, 256, GSA_8_BIT_IF_FALSE, true);      break;    case 0x09:      cheatsAdd(code, desc, addr, value, 256, CBA_IF_FALSE, true);      break;    case 0x0a:      cheatsAdd(code, desc, addr, value, 256, GSA_32_BIT_IF_FALSE, true);      break;    case 0x24:      cheatsAdd(code, desc, addr, value, 256, GSA_8_BIT_IF_TRUE2, true);      break;    case 0x25:      cheatsAdd(code, desc, addr, value, 256, GSA_16_BIT_IF_TRUE2, true);      break;    case 0x26:      cheatsAdd(code, desc, addr, value, 256, GSA_32_BIT_IF_TRUE2, true);      break;    case 0x28:      cheatsAdd(code, desc, addr, value, 256, GSA_8_BIT_IF_FALSE2, true);      break;    case 0x29:      cheatsAdd(code, desc, addr, value, 256, GSA_16_BIT_IF_FALSE2, true);      break;    case 0x2a:      cheatsAdd(code, desc, addr, value, 256, GSA_32_BIT_IF_FALSE2, true);      break;    default:      cheatsAdd(code, desc, addr, value, 256, UNKNOWN_CODE, false);      break;    }  } else {    int type = (address >> 28) & 15;      switch(type) {    case 0:    case 1:    case 2:      cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 256, type,true);      break;    case 6:      address <<= 1;      type = (address >> 28) & 15;      if(type == 0x0c) {        cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 256,                   GSA_16_BIT_ROM_PATCH, true);        break;      }      // unsupported code      cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 256,                 UNKNOWN_CODE, false);      break;    case 8:      switch((address >> 20) & 15) {      case 1:        cheatsAdd(code, desc, address & 0x0F0FFFFF, value, 256,                   GSA_8_BIT_GS_WRITE, false);        break;      case 2:        cheatsAdd(code, desc, address & 0x0F0FFFFF, value, 256,                   GSA_16_BIT_GS_WRITE, false);        break;      case 3:        cheatsAdd(code, desc, address & 0x0F0FFFFF, value, 256,                   GSA_32_BIT_GS_WRITE, false);      default:        // unsupported code        cheatsAdd(code, desc, address & 0x0F0FFFFF, value, 256,                   UNKNOWN_CODE, false);        break;      }      break;    case 0x0d:      if(address != 0xDEADFACE) {        cheatsAdd(code, desc, address & 0x0FFFFFFF, value, 256,                   CBA_IF_TRUE, false);      } else        cheatsAdd(code, desc, address & 0x0F0FFFFF, value, 256,                   UNKNOWN_CODE, false);      break;    default:      // unsupported code      cheatsAdd(code, desc, address & 0x0F0FFFFF, value, 256,                 UNKNOWN_CODE, false);      break;    }  }}