utilGzClose(gzFile);
utilWriteData(gzFile, saveGameStruct);   utilWriteInt(gzFile, stopState);  utilWriteInt(gzFile, intState);  utilGzWrite(gzFile, internalRAM, 0x8000); utilGzWrite(gzFile, paletteRAM, 0x400); utilGzWrite(gzFile, workRAM, 0x40000); utilGzWrite(gzFile, vram, 0x20000); utilGzWrite(gzFile, oam, 0x400); utilGzWrite(gzFile, pix, 4*241*162); utilGzWrite(gzFile, ioMem, 0x400);  eepromSaveGame(gzFile); flashSaveGame(gzFile); soundSaveGame(gzFile);  cheatsSaveGame(gzFile);   rtcSaveGame(gzFile);
bool CPUWriteState(char *file){  gzFile gzFile = utilGzOpen(file, "wb");  if(gzFile == NULL) {    systemMessage(MSG_ERROR_CREATING_FILE, "Error creating file %s", file);    return false;  }    bool res = CPUWriteState(gzFile);  utilGzClose(gzFile);    return res;}