diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/battle.h | 31 | ||||
-rw-r--r-- | include/battle_controllers.h | 2 | ||||
-rw-r--r-- | include/battle_util.h | 5 | ||||
-rw-r--r-- | include/constants/flags.h | 7 | ||||
-rw-r--r-- | include/constants/items.h | 3 | ||||
-rw-r--r-- | include/constants/pokemon.h | 80 | ||||
-rw-r--r-- | include/global.h | 72 | ||||
-rw-r--r-- | include/link.h | 2 | ||||
-rw-r--r-- | include/load_save.h | 4 | ||||
-rw-r--r-- | include/malloc.h | 1 | ||||
-rw-r--r-- | include/pokemon.h | 16 | ||||
-rw-r--r-- | include/save.h | 102 |
12 files changed, 250 insertions, 75 deletions
diff --git a/include/battle.h b/include/battle.h index f98b2231a..ee707f78b 100644 --- a/include/battle.h +++ b/include/battle.h @@ -28,7 +28,7 @@ #define SIDE_OPPONENT 0x1 #define GET_BANK_IDENTITY(bank)((gBanksByIdentity[bank])) -#define GET_BANK_SIDE(bank)((GetBankIdentity(bank) & BIT_SIDE)) +#define GET_BANK_SIDE(bank)((GetBattlerPosition(bank) & BIT_SIDE)) #define GET_BANK_SIDE2(bank)((GET_BANK_IDENTITY(bank) & BIT_SIDE)) #define BATTLE_TYPE_DOUBLE 0x0001 @@ -47,7 +47,7 @@ #define BATTLE_TYPE_LEGENDARY 0x2000 #define BATTLE_TYPE_REGI 0x4000 #define BATTLE_TYPE_TWO_OPPONENTS 0x8000 -#define BATTLE_TYPE_DOME 0x10000 +#define BATTLE_TYPE_DOME 0x10000 // this is used in pokemon.c, but its clearly not the correct name for FR/LG. TODO: Fix these #define BATTLE_TYPE_PALACE 0x20000 #define BATTLE_TYPE_ARENA 0x40000 #define BATTLE_TYPE_FACTORY 0x80000 @@ -210,7 +210,7 @@ struct TrainerMonNoItemDefaultMoves }; u8 AbilityBattleEffects(u8 caseID, u8 bank, u8 ability, u8 special, u16 moveArg); -u8 GetBankSide(u8 bank); +u8 GetBattlerSide(u8 bank); struct TrainerMonItemDefaultMoves { @@ -545,7 +545,7 @@ struct BattleStruct u8 field_46; u8 field_47; u8 focusPunchBank; - u8 field_49; + u8 battlerPreventingSwitchout; u8 moneyMultiplier; u8 savedTurnActionNumber; u8 switchInAbilitiesCounter; @@ -598,7 +598,7 @@ struct BattleStruct u8 field_A7; u16 hpOnSwitchout[2]; u32 savedBattleTypeFlags; - u8 field_B0; + u8 abilityPreventingSwitchout; u8 hpScale; u8 synchronizeMoveEffect; u8 field_B3; @@ -646,6 +646,9 @@ extern struct BattleStruct* gBattleStruct; typeArg = gBattleMoves[move].type; \ } +#define IS_TYPE_PHYSICAL(moveType)(moveType < TYPE_MYSTERY) +#define IS_TYPE_SPECIAL(moveType)(moveType > TYPE_MYSTERY) + #define MOVE_EFFECT_SLEEP 0x1 #define MOVE_EFFECT_POISON 0x2 #define MOVE_EFFECT_BURN 0x3 @@ -847,9 +850,9 @@ enum }; // rom_80A5C6C -u8 GetBankSide(u8 bank); -u8 GetBankIdentity(u8 bank); -u8 GetBankByIdentity(u8 bank); +u8 GetBattlerSide(u8 bank); +u8 GetBattlerPosition(u8 bank); +u8 GetBattlerAtPosition(u8 bank); struct BattleSpriteInfo { @@ -961,5 +964,17 @@ extern u16 gLastUsedItem; extern u32 gBattleTypeFlags; extern struct MonSpritesGfx* gMonSpritesGfxPtr; extern u16 gTrainerBattleOpponent_A; +extern u16 gMoveToLearn; +extern u16 gBattleMovePower; +extern struct BattleEnigmaBerry gEnigmaBerries[MAX_BATTLERS_COUNT]; +extern u16 gCurrentMove; +extern u8 gCritMultiplier; +extern u16 gBattleWeather; +extern u8 gLastUsedAbility; +extern u8 gBattlerInMenuId; +extern u8 gPotentialItemEffectBattler; +extern u8 gBattlersCount; +extern u16 gBattlerPartyIndexes[MAX_BATTLERS_COUNT]; +extern s32 gBattleMoveDamage; #endif // GUARD_BATTLE_H diff --git a/include/battle_controllers.h b/include/battle_controllers.h index c69cb1017..66984b453 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -181,7 +181,7 @@ void sub_8033648(void); void PrepareBufferDataTransferLink(u8 bufferId, u16 size, u8 *data); // emitters -void EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck); +void BtlController_EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck); void EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes); // unused void EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data); void EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data); // unused diff --git a/include/battle_util.h b/include/battle_util.h index 81eb85dc7..25e26719b 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -30,6 +30,10 @@ #define ABILITYEFFECT_CHECK_ON_FIELD 0x13 #define ABILITYEFFECT_SWITCH_IN_WEATHER 0xFF +#define ABILITY_ON_OPPOSING_FIELD(battlerId, abilityId)(AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, battlerId, abilityId, 0, 0)) +#define ABILITY_ON_FIELD(abilityId)(AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, abilityId, 0, 0)) +#define ABILITY_ON_FIELD2(abilityId)(AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, abilityId, 0, 0)) + #define ITEMEFFECT_ON_SWITCH_IN 0x0 #define WEATHER_HAS_EFFECT ((!AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, ABILITY_CLOUD_NINE, 0, 0) && !AbilityBattleEffects(ABILITYEFFECT_CHECK_ON_FIELD, 0, ABILITY_AIR_LOCK, 0, 0))) @@ -80,5 +84,6 @@ void ClearFuryCutterDestinyBondGrudge(u8 bank); void HandleAction_RunBattleScript(void); u8 GetMoveTarget(u16 move, u8 useMoveTarget); u8 IsMonDisobedient(void); +void MarkBufferBankForExecution(u8 battlerId); #endif // GUARD_BATTLE_UTIL_H diff --git a/include/constants/flags.h b/include/constants/flags.h index ac9730884..ea2d7d8bc 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -1288,6 +1288,13 @@ #define TRAINERS_FLAG_NO 0x356 #define CODE_FLAGS (FLAG_TRAINER_FLAG_START + TRAINERS_FLAG_NO + 0xA) // 0x860 +// TODO: Find what these are +#define FLAG_UNK820 0x820 +#define FLAG_UNK824 0x824 +#define FLAG_UNK826 0x826 + +#define FLAG_UNK843 0x843 + // SYSTEM FLAGS // 0x860 diff --git a/include/constants/items.h b/include/constants/items.h index 6135b8d6f..dd2b4c4ed 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -390,4 +390,7 @@ #define NUM_TECHNICAL_MACHINES 50 #define NUM_HIDDEN_MACHINES 8 +// Check if the item is one that can be used on a Pokemon. +#define IS_POKEMON_ITEM(item) ((item) >= ITEM_POTION && (item) <= ITEM_0B2) + #endif // GUARD_CONSTANTS_ITEMS_H diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h new file mode 100644 index 000000000..78c1583b4 --- /dev/null +++ b/include/constants/pokemon.h @@ -0,0 +1,80 @@ +#ifndef GUARD_CONSTANTS_POKEMON_H +#define GUARD_CONSTANTS_POKEMON_H + +// Pokemon types +#define TYPE_NORMAL 0x00 +#define TYPE_FIGHTING 0x01 +#define TYPE_FLYING 0x02 +#define TYPE_POISON 0x03 +#define TYPE_GROUND 0x04 +#define TYPE_ROCK 0x05 +#define TYPE_BUG 0x06 +#define TYPE_GHOST 0x07 +#define TYPE_STEEL 0x08 +#define TYPE_MYSTERY 0x09 +#define TYPE_FIRE 0x0a +#define TYPE_WATER 0x0b +#define TYPE_GRASS 0x0c +#define TYPE_ELECTRIC 0x0d +#define TYPE_PSYCHIC 0x0e +#define TYPE_ICE 0x0f +#define TYPE_DRAGON 0x10 +#define TYPE_DARK 0x11 +#define NUMBER_OF_MON_TYPES 0x12 + +// Pokemon egg groups +#define EGG_GROUP_NONE 0 +#define EGG_GROUP_MONSTER 1 +#define EGG_GROUP_WATER_1 2 +#define EGG_GROUP_BUG 3 +#define EGG_GROUP_FLYING 4 +#define EGG_GROUP_FIELD 5 +#define EGG_GROUP_FAIRY 6 +#define EGG_GROUP_GRASS 7 +#define EGG_GROUP_HUMAN_LIKE 8 +#define EGG_GROUP_WATER_3 9 +#define EGG_GROUP_MINERAL 10 +#define EGG_GROUP_AMORPHOUS 11 +#define EGG_GROUP_WATER_2 12 +#define EGG_GROUP_DITTO 13 +#define EGG_GROUP_DRAGON 14 +#define EGG_GROUP_UNDISCOVERED 15 + +// Pokemon natures +#define NATURE_HARDY 0 +#define NATURE_LONELY 1 +#define NATURE_BRAVE 2 +#define NATURE_ADAMANT 3 +#define NATURE_NAUGHTY 4 +#define NATURE_BOLD 5 +#define NATURE_DOCILE 6 +#define NATURE_RELAXED 7 +#define NATURE_IMPISH 8 +#define NATURE_LAX 9 +#define NATURE_TIMID 10 +#define NATURE_HASTY 11 +#define NATURE_SERIOUS 12 +#define NATURE_JOLLY 13 +#define NATURE_NAIVE 14 +#define NATURE_MODEST 15 +#define NATURE_MILD 16 +#define NATURE_QUIET 17 +#define NATURE_BASHFUL 18 +#define NATURE_RASH 19 +#define NATURE_CALM 20 +#define NATURE_GENTLE 21 +#define NATURE_SASSY 22 +#define NATURE_CAREFUL 23 +#define NATURE_QUIRKY 24 + +// Pokemon Stats +#define STAT_HP 0 +#define STAT_ATK 1 +#define STAT_DEF 2 +#define STAT_SPEED 3 +#define STAT_SPATK 4 +#define STAT_SPDEF 5 +#define STAT_ACC 6 // only in battles +#define STAT_EVASION 7 // only in battles + +#endif // GUARD_CONSTANTS_POKEMON_H diff --git a/include/global.h b/include/global.h index 11a79ebe8..b05c87d88 100644 --- a/include/global.h +++ b/include/global.h @@ -28,9 +28,13 @@ char* strcpy(char *dst0, const char *src0); // Converts a number to Q4.12 fixed-point format #define Q_4_12(n) ((s16)((n) * 4096)) +#define POKEMON_SLOTS_NUMBER 412 #define POKEMON_NAME_LENGTH 10 #define OT_NAME_LENGTH 7 +#define min(a, b) ((a) < (b) ? (a) : (b)) +#define max(a, b) ((a) >= (b) ? (a) : (b)) + // There are many quirks in the source code which have overarching behavioral differences from // a number of other files. For example, diploma.c seems to declare rodata before each use while // other files declare out of order and must be at the beginning. There are also a number of @@ -75,6 +79,12 @@ enum LanguageId { #define GAME_LANGUAGE (LANGUAGE_ENGLISH) +#define BAG_ITEMS_COUNT 42 +#define BAG_KEYITEMS_COUNT 30 +#define BAG_POKEBALLS_COUNT 13 +#define BAG_TMHM_COUNT 58 +#define BAG_BERRIES_COUNT 43 + enum { MALE, @@ -239,6 +249,18 @@ struct SaveBlock2 extern struct SaveBlock2 *gSaveBlock2Ptr; +#define PARTY_SIZE 6 + +struct SecretBaseParty +{ + u32 personality[PARTY_SIZE]; + u16 moves[PARTY_SIZE * 4]; + u16 species[PARTY_SIZE]; + u16 heldItems[PARTY_SIZE]; + u8 levels[PARTY_SIZE]; + u8 EVs[PARTY_SIZE]; +}; + struct SecretBaseRecord { /*0x1A9C*/ u8 secretBaseId; @@ -246,7 +268,7 @@ struct SecretBaseRecord /*0x1A9D*/ u8 gender:1; /*0x1A9D*/ u8 sbr_field_1_5:1; /*0x1A9D*/ u8 sbr_field_1_6:2; - /*0x1A9E*/ u8 trainerName[OT_NAME_LENGTH]; + /*0x1A9E*/ u8 trainerName[7]; // TODO: Change PLAYER_NAME_LENGTH to 7 /*0x1AA5*/ u8 trainerId[4]; // byte 0 is used for determining trainer class /*0x1AA9*/ u8 language; /*0x1AAA*/ u16 sbr_field_e; @@ -254,12 +276,7 @@ struct SecretBaseRecord /*0x1AAD*/ u8 sbr_field_11; /*0x1AAE*/ u8 decorations[16]; /*0x1ABE*/ u8 decorationPos[16]; - /*0x1AD0*/ u32 partyPersonality[6]; - /*0x1AE8*/ u16 partyMoves[6 * 4]; - /*0x1B18*/ u16 partySpecies[6]; - /*0x1B24*/ u16 partyHeldItems[6]; - /*0x1B2E*/ u8 partyLevels[6]; - /*0x1B34*/ u8 partyEVs[6]; + /*0x1AD0*/ struct SecretBaseParty party; }; #include "constants/game_stat.h" @@ -482,24 +499,41 @@ struct MysteryEventStruct struct SaveBlock1 { - /*0x0000*/ u8 filler[0x4]; + /*0x0000*/ struct Coords16 pos; /*0x0004*/ struct WarpData location; - /*0x0C*/ struct WarpData warp1; - /*0x14*/ struct WarpData warp2; - /*0x1C*/ struct WarpData lastHealLocation; - /*0x24*/ struct WarpData warp4; - /*0x002C*/ u8 filler2C[0x60C]; - /*0x638*/ u8 trainerRematchStepCounter; - u8 filler_639; - /*0x63a*/ u8 trainerRematches[100]; - /*0x06A0*/ struct MapObject mapObjects[MAP_OBJECTS_COUNT]; - /*0x08E0*/ struct MapObjectTemplate mapObjectTemplates[64]; - /*0x0EE0*/ u8 fillerEE0[0x2580]; + /*0x000C*/ struct WarpData warp1; + /*0x0014*/ struct WarpData warp2; + /*0x001C*/ struct WarpData lastHealLocation; + /*0x0024*/ struct WarpData warp4; + /*0x002C*/ u8 filler2C[0x8]; + /*0x0034*/ u8 playerPartyCount; + /*0x0038*/ struct Pokemon playerParty[PARTY_SIZE]; + /*0x0290*/ u32 money; + /*0x0294*/ u16 coins; + /*0x0296*/ u8 filler296[0x7A]; + /*0x0310*/ struct ItemSlot bagPocket_Items[BAG_ITEMS_COUNT]; + struct ItemSlot bagPocket_KeyItems[BAG_KEYITEMS_COUNT]; + struct ItemSlot bagPocket_PokeBalls[BAG_POKEBALLS_COUNT]; + struct ItemSlot bagPocket_TMHM[BAG_TMHM_COUNT]; + struct ItemSlot bagPocket_Berries[BAG_BERRIES_COUNT]; + u8 filler5F8[0x40]; + /*0x0638*/ u8 trainerRematchStepCounter; + u8 filler_639; + /*0x063a*/ u8 trainerRematches[100]; + /*0x06A0*/ struct MapObject mapObjects[MAP_OBJECTS_COUNT]; + /*0x08E0*/ struct MapObjectTemplate mapObjectTemplates[64]; + /*0x0EE0*/ u8 fillerEE0[0x1DF0]; + /*0x2CD0*/ struct MailStruct mail[MAIL_COUNT]; + u8 filler2F10[0x1DA]; + /*0x30EA*/ struct EnigmaBerry enigmaBerry; + /*0x3120*/ u8 filler3120[0x340]; /*0x3460*/ struct MysteryEventStruct unk_3460; /*0x3464*/ u8 filler_3464[0x1b8]; /*0x361C*/ struct RamScript ramScript; /*0x3A08*/ u8 filler3A08[0x44]; /*0x3A4C*/ u8 rivalName[PLAYER_NAME_LENGTH]; + /*0x3A54*/ u8 filler3A54[0x2E4]; + u32 unkArray[4][3]; }; extern struct SaveBlock1* gSaveBlock1Ptr; diff --git a/include/link.h b/include/link.h index 1f91ebfeb..352386523 100644 --- a/include/link.h +++ b/include/link.h @@ -69,7 +69,7 @@ struct LinkPlayer /* 0x08 */ u8 name[11]; /* 0x13 */ u8 gender; /* 0x14 */ u32 linkType; - /* 0x18 */ u16 lp_field_18; // battle bank in battles + /* 0x18 */ u16 id; // battle bank in battles /* 0x1A */ u16 language; }; diff --git a/include/load_save.h b/include/load_save.h index 1f406bbad..b3e9fe49c 100644 --- a/include/load_save.h +++ b/include/load_save.h @@ -18,7 +18,9 @@ void SaveSerializedGame(void); void LoadSerializedGame(void); void LoadPlayerBag(void); void SavePlayerBag(void); -void SetSaveBlocksPointers(u16); +void SetSaveBlocksPointers(void); void MoveSaveBlocks_ResetHeap(void); +void ApplyNewEncryptionKeyToAllEncryptedData(u32 encryptionKey); +void ApplyNewEncryptionKeyToBagItems(u32 encryptionKey); #endif // GUARD_LOAD_SAVE_H diff --git a/include/malloc.h b/include/malloc.h index 003ee1f03..6efa8fbef 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -1,6 +1,7 @@ #ifndef GUARD_MALLOC_H #define GUARD_MALLOC_H +#define HEAP_SIZE 0x1C000 #define malloc Alloc #define calloc(ct, sz) AllocZeroed((ct) * (sz)) #define free Free diff --git a/include/pokemon.h b/include/pokemon.h index 480c8d9b9..e15172dd5 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -511,23 +511,22 @@ struct Evolution #define EVOS_PER_MON 5 -struct EvolutionData -{ - struct Evolution evolutions[EVOS_PER_MON]; -}; - extern u8 gPlayerPartyCount; extern struct Pokemon gPlayerParty[PARTY_SIZE]; extern u8 gEnemyPartyCount; extern struct Pokemon gEnemyParty[PARTY_SIZE]; extern const struct BaseStats gBaseStats[]; extern const u8 *const gItemEffectTable[]; -extern const struct EvolutionData gEvolutionTable[]; +extern const struct Evolution gEvolutionTable[][EVOS_PER_MON]; +extern const u8 gStatStageRatios[][2]; +extern struct SpriteTemplate gMultiuseSpriteTemplate; extern struct PokemonStorage* gPokemonStoragePtr; extern const u32 gExperienceTables[][MAX_MON_LEVEL + 1]; extern const u16 *const gLevelUpLearnsets[]; +extern const u8 gFacilityClassToPicIndex[]; +extern const u8 gFacilityClassToTrainerClass[]; -u8 CountAliveMonsInBattle(u8 caseId); +u8 CountAliveMons(u8 caseId); #define BATTLE_ALIVE_EXCEPT_ACTIVE 0 #define BATTLE_ALIVE_ATK_SIDE 1 #define BATTLE_ALIVE_DEF_SIDE 2 @@ -558,6 +557,8 @@ void GiveMonInitialMoveset(struct Pokemon *mon); void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon); void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, u16 move); void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move); +bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex); +bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex, u8 e); u8 GetMonGender(struct Pokemon *mon); u8 GetBoxMonGender(struct BoxPokemon *boxMon); @@ -653,6 +654,7 @@ u8 GetSecretBaseTrainerPicIndex(void); bool8 TryIncrementMonLevel(struct Pokemon *mon); void BoxMonToMon(struct BoxPokemon *srcMon, struct Pokemon *dstMon); u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves); +bool8 HealStatusConditions(struct Pokemon *mon, u32 battlePartyId, u32 healMask, u8 battlerId); #include "sprite.h" diff --git a/include/save.h b/include/save.h index 3bd1ff8cf..38ad63170 100644 --- a/include/save.h +++ b/include/save.h @@ -1,11 +1,27 @@ #ifndef GUARD_SAVE_H #define GUARD_SAVE_H -extern u16 gSaveFileStatus; +#define NUM_SECTORS 32 // defined in agb_flash but not in a header + +#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 -struct SaveSectionLocation +enum { - void *data; + SAVE_NORMAL, + SAVE_LINK, + SAVE_EREADER, + SAVE_HALL_OF_FAME, + SAVE_OVERWRITE_DIFFERENT_FILE, + SAVE_HALL_OF_FAME_ERASE_BEFORE, // unused +}; + +struct SaveBlockChunk +{ + u8 *data; u16 size; }; @@ -14,7 +30,7 @@ struct SaveSection u8 data[0xFF4]; u16 id; u16 checksum; - u32 security; + u32 signature; u32 counter; }; // size is 0x1000 @@ -22,21 +38,21 @@ struct SaveSection struct UnkSaveSection { u8 data[0xFF4]; - u32 security; + u32 signature; }; // size is 0xFF8 struct SaveSectionOffsets { - u16 toAdd; - u16 size; + u16 toAdd; + u16 size; }; // Emerald changes this definition to be the sectors per slot. -#define NUM_SECTORS_PER_SLOT 16 // move to save.h +#define NUM_SECTORS_PER_SAVE_SLOT 14 // Number of sectors occupied by a save slot #define UNKNOWN_CHECK_VALUE 0x8012025 -// SetDamagedSectorBits states +// SetSectorDamagedStatus states enum { ENABLE, @@ -49,49 +65,59 @@ enum { NORMAL_SAVE, LINK_SAVE, - //EREADER_SAVE, // depreciated in Emerald - LINK2_SAVE, // unknown 2nd link save + EREADER_SAVE, HOF_SAVE, DIFFERENT_FILE_SAVE, HOF_DELETE_SAVE // unused }; -#define SECTION_ID_RECORDED_BATTLE 31 +extern u16 gFirstSaveSector; +extern u32 gPrevSaveCounter; +extern u16 gLastKnownGoodSector; +extern u32 gDamagedSaveSectors; +extern u32 gSaveCounter; +extern struct SaveSection *gFastSaveSection; // the pointer is in fast IWRAM but may sometimes point to the slower EWRAM. +extern u16 gUnknown_3005398; +extern u16 gSaveUnusedVar; +extern u16 gSaveFileStatus; +extern void (*gGameContinueCallback)(void); +extern struct SaveBlockChunk gRamSaveSectionLocations[0xE]; +extern u16 gUnknown_3005420; + +extern struct SaveSection gSaveDataBuffer; void ClearSaveData(void); -void ResetSaveCounters(void); -bool32 SetDamagedSectorBits(u8 op, u8 bit); -u8 save_write_to_flash(u16 a1, const struct SaveSectionLocation *location); -u8 HandleWriteSector(u16 a1, const struct SaveSectionLocation *location); +void Save_ResetSaveCounters(void); +bool32 SetSectorDamagedStatus(u8 op, u8 bit); +u8 save_write_to_flash(u16 a1, const struct SaveBlockChunk *location); +u8 HandleWriteSector(u16 a1, const struct SaveBlockChunk *location); u8 HandleWriteSectorNBytes(u8 sector, u8 *data, u16 size); u8 TryWriteSector(u8 sector, u8 *data); -u32 RestoreSaveBackupVarsAndIncrement(const struct SaveSectionLocation *location); -u32 RestoreSaveBackupVars(const struct SaveSectionLocation *location); -u8 sub_81529D4(u16 a1, const struct SaveSectionLocation *location); -u8 sub_8152A34(u16 a1, const struct SaveSectionLocation *location); -u8 ClearSaveData_2(u16 a1, const struct SaveSectionLocation *location); -u8 sav12_xor_get(u16 a1, const struct SaveSectionLocation *location); -u8 sub_8152CAC(u16 a1, const struct SaveSectionLocation *location); -u8 sub_8152D44(u16 a1, const struct SaveSectionLocation *location); -u8 sub_8152DD0(u16 a1, const struct SaveSectionLocation *location); -u8 sub_8152E10(u16 a1, const struct SaveSectionLocation *location); -u8 GetSaveValidStatus(const struct SaveSectionLocation *location); -u8 sub_81530DC(u8 a1, u8 *data, u16 size); +u32 RestoreSaveBackupVarsAndIncrement(const struct SaveBlockChunk *location); +u32 RestoreSaveBackupVars(const struct SaveBlockChunk *location); +u8 sub_80D9AA4(u16 a1, const struct SaveBlockChunk *location); +u8 sub_80D9B04(u16 a1, const struct SaveBlockChunk *location); +u8 ClearSaveData_2(u16 a1, const struct SaveBlockChunk *location); +u8 sav12_xor_get(u16 a1, const struct SaveBlockChunk *location); +u8 sub_80D9D88(u16 a1, const struct SaveBlockChunk *location); +u8 sub_80D9E14(u16 a1, const struct SaveBlockChunk *location); +u8 sub_80D9E54(u16 a1, const struct SaveBlockChunk *location); +u8 GetSaveValidStatus(const struct SaveBlockChunk *location); +u8 sub_80DA120(u8 a1, u8 *data, u16 size); u8 DoReadFlashWholeSection(u8 sector, struct SaveSection *section); u16 CalculateChecksum(void *data, u16 size); void UpdateSaveAddresses(void); u8 HandleSavingData(u8 saveType); u8 TrySavingData(u8 saveType); -u8 sub_8153380(void); -bool8 sub_81533AC(void); -u8 sub_81533E0(void); -u8 sub_8153408(void); -u8 sub_8153430(void); -bool8 sub_8153474(void); -u8 sub_81534D0(u8 a1); -u16 sub_815355C(void); +u8 sub_80DA3AC(void); +bool8 sub_80DA3D8(void); +u8 sub_80DA40C(void); +u8 sub_80DA434(void); +u8 sub_80DA45C(void); +bool8 sub_80DA4A0(void); +u8 Save_LoadGameData(u8 a1); u32 TryCopySpecialSaveSection(u8 sector, u8* dst); -u32 sub_8153634(u8 sector, u8* src); -void sub_8153688(u8 taskId); +u32 sub_80DA5E0(u8 sector, u8* src); +void sub_80DA634(u8 taskId); #endif // GUARD_SAVE_H |