Sync save sector checks
This commit is contained in:
@@ -129,6 +129,10 @@ extern u8 gStringVar4[];
|
||||
#define NUM_FLAG_BYTES ROUND_BITS_TO_BYTES(FLAGS_COUNT)
|
||||
#define NUM_ADDITIONAL_PHRASE_BYTES ROUND_BITS_TO_BYTES(NUM_ADDITIONAL_PHRASES)
|
||||
|
||||
// This produces an error at compile-time if expr is zero.
|
||||
// It looks like file.c:line: size of array `id' is negative
|
||||
#define STATIC_ASSERT(expr, id) typedef char id[(expr) ? 1 : -1];
|
||||
|
||||
struct Coords8
|
||||
{
|
||||
s8 x;
|
||||
|
||||
+12
-7
@@ -9,7 +9,10 @@
|
||||
#define SECTOR_FOOTER_SIZE 128
|
||||
#define SECTOR_SIZE (SECTOR_DATA_SIZE + SECTOR_FOOTER_SIZE)
|
||||
|
||||
#define FILE_SIGNATURE 0x08012025 // signature value to determine if a sector is in use
|
||||
#define NUM_SAVE_SLOTS 2
|
||||
|
||||
// If the sector's signature field is not this value then the sector is either invalid or empty.
|
||||
#define SECTOR_SIGNATURE 0x08012025
|
||||
|
||||
#define SPECIAL_SECTOR_SENTINEL 0xB39D
|
||||
|
||||
@@ -26,12 +29,19 @@
|
||||
#define SECTOR_ID_TRAINER_TOWER_2 31
|
||||
#define SECTORS_COUNT 32
|
||||
|
||||
#define NUM_HOF_SECTORS 2
|
||||
|
||||
#define SAVE_STATUS_EMPTY 0
|
||||
#define SAVE_STATUS_OK 1
|
||||
#define SAVE_STATUS_INVALID 2
|
||||
#define SAVE_STATUS_NO_FLASH 4
|
||||
#define SAVE_STATUS_ERROR 0xFF
|
||||
|
||||
// Special sector id value for certain save functions
|
||||
// to indicate that all sectors should be used
|
||||
// instead of a specific sector.
|
||||
#define FULL_SAVE_SLOT 0xFFFF
|
||||
|
||||
enum
|
||||
{
|
||||
SAVE_NORMAL,
|
||||
@@ -58,16 +68,11 @@ struct SaveSector
|
||||
u16 checksum;
|
||||
u32 signature;
|
||||
u32 counter;
|
||||
}; // size is 0x1000
|
||||
}; // size is SECTOR_SIZE (0x1000)
|
||||
|
||||
#define SECTOR_SIGNATURE_OFFSET offsetof(struct SaveSector, signature)
|
||||
#define SECTOR_COUNTER_OFFSET offsetof(struct SaveSector, counter)
|
||||
|
||||
// Special sector id value for certain save functions
|
||||
// to indicate that all sectors should be used
|
||||
// instead of a specific sector.
|
||||
#define FULL_SAVE_SLOT 0xFFFF
|
||||
|
||||
// operations for SetDamagedSectorBits
|
||||
enum
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user