Skip to main content
pokeemerald saves to a 128 KB flash chip organized as 32 sectors of 4 KB each. The save system rotates between two save slots for corruption protection and stores trainer data, bag contents, Pokémon party, PC storage, Hall of Fame records, and more.

Flash layout

The 32 sectors are divided into fixed-purpose regions. Sector numbers are defined in include/save.h. SECTORS_COUNT = 32; NUM_SECTORS_PER_SLOT = 14.

Sector structure

Each 4 KB sector is split into a data region and a footer:
Key constants from include/save.h:
The game uses approximately 96% of available flash capacity. SaveBlock1 has roughly 84 bytes of headroom and SaveBlock2 has roughly 120 bytes before you must reorganize the sector layout.

Dual-slot rotation

NUM_SAVE_SLOTS = 2. Sectors 0–13 are Save Slot 1 and sectors 14–27 are Save Slot 2. On every normal save the game writes to the slot with the lower counter value. If a write is interrupted the other slot still holds a valid copy, preventing total save loss.

Save types

Save status codes

The current status is stored in gSaveFileStatus (extern u16 gSaveFileStatus).

Key functions

For link-cable trades and the Battle Frontier, SaveBlock1 is written incrementally across multiple frames using a task:
Do not expand SaveBlock1 or SaveBlock2 beyond their headroom without updating gRamSaveSectorLocations and auditing every sector’s size field. Exceeding SECTOR_DATA_SIZE (3968 bytes) per sector silently truncates data.