Enforce structs to enforce save block order for modern toolchains.
This commit is contained in:
@@ -1,9 +1,33 @@
|
||||
#ifndef GUARD_LOAD_SAVE_H
|
||||
#define GUARD_LOAD_SAVE_H
|
||||
|
||||
extern struct SaveBlock1 gSaveblock1;
|
||||
extern struct SaveBlock2 gSaveblock2;
|
||||
extern struct PokemonStorage gPokemonStorage;
|
||||
#include "pokemon_storage_system.h"
|
||||
|
||||
#define SAVEBLOCK_MOVE_RANGE 128
|
||||
|
||||
/**
|
||||
* These structs are to prevent them from being reordered on newer or modern
|
||||
* toolchains. If this is not done, the ClearSav functions will end up erasing
|
||||
* the wrong memory leading to various glitches.
|
||||
*/
|
||||
struct SaveBlock2DMA {
|
||||
struct SaveBlock2 block;
|
||||
u8 dma[SAVEBLOCK_MOVE_RANGE];
|
||||
};
|
||||
|
||||
struct SaveBlock1DMA {
|
||||
struct SaveBlock1 block;
|
||||
u8 dma[SAVEBLOCK_MOVE_RANGE];
|
||||
};
|
||||
|
||||
struct PokemonStorageDMA {
|
||||
struct PokemonStorage block;
|
||||
u8 dma[SAVEBLOCK_MOVE_RANGE];
|
||||
};
|
||||
|
||||
extern struct SaveBlock1DMA gSaveblock1;
|
||||
extern struct SaveBlock2DMA gSaveblock2;
|
||||
extern struct PokemonStorageDMA gPokemonStorage;
|
||||
|
||||
extern bool32 gFlashMemoryPresent;
|
||||
extern struct SaveBlock1 *gSaveBlock1Ptr;
|
||||
|
||||
Reference in New Issue
Block a user