Next Generation Emulation banner

1 - 2 of 2 Posts

·
Registered
Joined
·
3 Posts
Discussion Starter #1
Question for any VBA techies out there regarding VBA save states (F1-F10). All of the VBA save state files seem to be ~723K uncompressed. In a previous post Forgotten stated "It (a save state) keeps a lot of internal state of the emulator in the file." I am wondering if anyone has taken the time to decode exactly what format these files are in? In the memory map of the GBA we have the BIOS, WRAM, I(W)RAM, I/O, PALLETTE, VRAM, OAM, and the ROM. Most of those memory areas (except ROM) would probably have to be saved in this file as well as some of the state of the emulator. I am trying to find out where some (or all) of those begin and end. I am trying to determine which parts of the save state are related to the actual GBA running state and which are the parts of the EMU software that get saved.

Any and all info would be appreciated.

Thanks,

Vm
 

·
Registered
Joined
·
36 Posts
Peruse the source code:

GBA.cpp:
Code:
static bool CPUWriteState(gzFile gzFile)
{
  utilWriteInt(gzFile, SAVE_GAME_VERSION);

  utilGzWrite(gzFile, &rom[0xa0], 16);

  utilWriteInt(gzFile, useBios);
  
  utilGzWrite(gzFile, &reg[0], sizeof(reg));

  utilWriteData(gzFile, saveGameStruct);

  // new to version 0.7.1
  utilWriteInt(gzFile, stopState);
  // new to version 0.8
  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);

  // version 1.5
  rtcSaveGame(gzFile);
  
  return true;
}
 
1 - 2 of 2 Posts
Top