Static assertion for size of save structs
This commit is contained in:
@@ -73,6 +73,12 @@ struct
|
||||
SAVEBLOCK_CHUNK(struct PokemonStorage, 8), // SECTOR_ID_PKMN_STORAGE_END
|
||||
};
|
||||
|
||||
// These will produce an error if a save struct is larger than the space
|
||||
// alloted for it in the flash.
|
||||
STATIC_ASSERT(sizeof(struct SaveBlock2) <= SECTOR_DATA_SIZE, SaveBlock2FreeSpace);
|
||||
STATIC_ASSERT(sizeof(struct SaveBlock1) <= SECTOR_DATA_SIZE * (SECTOR_ID_SAVEBLOCK1_END - SECTOR_ID_SAVEBLOCK1_START + 1), SaveBlock1FreeSpace);
|
||||
STATIC_ASSERT(sizeof(struct PokemonStorage) <= SECTOR_DATA_SIZE * (SECTOR_ID_PKMN_STORAGE_END - SECTOR_ID_PKMN_STORAGE_START + 1), PokemonStorageFreeSpace);
|
||||
|
||||
u16 gLastWrittenSector;
|
||||
u32 gLastSaveCounter;
|
||||
u16 gLastKnownGoodSector;
|
||||
|
||||
Reference in New Issue
Block a user