pokeemerald/include/load_save.h

59 lines
1.6 KiB
C
Raw Normal View History

2017-09-04 18:26:39 +02:00
#ifndef GUARD_LOAD_SAVE_H
#define GUARD_LOAD_SAVE_H
#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.
*/
2022-09-07 14:37:03 +02:00
struct SaveBlock2ASLR {
struct SaveBlock2 block;
2022-09-07 14:37:03 +02:00
u8 aslr[SAVEBLOCK_MOVE_RANGE];
};
2022-09-07 14:37:03 +02:00
struct SaveBlock1ASLR {
struct SaveBlock1 block;
2022-09-07 14:37:03 +02:00
u8 aslr[SAVEBLOCK_MOVE_RANGE];
};
2022-09-07 14:37:03 +02:00
struct PokemonStorageASLR {
struct PokemonStorage block;
2022-09-07 14:37:03 +02:00
u8 aslr[SAVEBLOCK_MOVE_RANGE];
};
2022-09-07 14:37:03 +02:00
extern struct SaveBlock1ASLR gSaveblock1;
extern struct SaveBlock2ASLR gSaveblock2;
extern struct PokemonStorageASLR gPokemonStorage;
2017-09-04 18:26:39 +02:00
2018-04-29 14:21:59 +02:00
extern bool32 gFlashMemoryPresent;
extern struct SaveBlock1 *gSaveBlock1Ptr;
extern struct SaveBlock2 *gSaveBlock2Ptr;
extern struct PokemonStorage *gPokemonStoragePtr;
void CheckForFlashMemory(void);
2017-09-07 19:45:32 +02:00
void ClearSav2(void);
void ClearSav1(void);
2018-04-29 14:21:59 +02:00
void SetSaveBlocksPointers(u16 offset);
2017-09-04 18:26:39 +02:00
void MoveSaveBlocks_ResetHeap(void);
2018-12-27 23:30:47 +01:00
u32 UseContinueGameWarp(void);
void ClearContinueGameWarpStatus(void);
void SetContinueGameWarpStatus(void);
void SetContinueGameWarpStatusToDynamicWarp(void);
void ClearContinueGameWarpStatus2(void);
2017-09-04 18:26:39 +02:00
void SavePlayerParty(void);
void LoadPlayerParty(void);
void SaveObjectEvents(void);
void LoadObjectEvents(void);
2021-10-29 04:54:41 +02:00
void CopyPartyAndObjectsToSave(void);
void CopyPartyAndObjectsFromSave(void);
2017-09-04 18:26:39 +02:00
void LoadPlayerBag(void);
void SavePlayerBag(void);
2018-04-29 14:21:59 +02:00
void ApplyNewEncryptionKeyToHword(u16 *hWord, u32 newKey);
void ApplyNewEncryptionKeyToWord(u32 *word, u32 newKey);
2017-09-04 18:26:39 +02:00
#endif // GUARD_LOAD_SAVE_H