diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/battle_ai.h | 8 | ||||
-rw-r--r-- | include/contest.h | 103 | ||||
-rwxr-xr-x | include/contest_ai.h | 16 | ||||
-rwxr-xr-x | include/ewram.h | 4 | ||||
-rw-r--r-- | include/save.h | 83 |
5 files changed, 101 insertions, 113 deletions
diff --git a/include/battle_ai.h b/include/battle_ai.h index c22ca8633..fdad0c7e9 100644 --- a/include/battle_ai.h +++ b/include/battle_ai.h @@ -10,10 +10,10 @@ enum // AI states enum { - AIState_SettingUp, - AIState_Processing, - AIState_FinishedProcessing, - AIState_DoNotProcess + BATTLEAI_SETTING_UP, + BATTLEAI_PROCESSING, + BATTLEAI_FINISHED, + BATTLEAI_DO_NOT_PROCESS }; // battle_ai diff --git a/include/contest.h b/include/contest.h index 6e71358a2..6b1f1f520 100644 --- a/include/contest.h +++ b/include/contest.h @@ -67,6 +67,22 @@ struct ContestPokemon /*0x3C*/ u32 otId; // otId }; // wow +struct ContestAIInfo { + /*0x00*/ u8 aiState; + /*0x02*/ u16 unk2; + /*0x04*/ u8 unk4; + /*0x05*/ u8 unk5[4]; + /*0x09*/ u8 aiAction; + /*0x0A*/ u8 fillerA[0x6]; // TODO: don't know what's here + /*0x10*/ u8 unk10; + /*0x14*/ u32 flags; + /*0x18*/ s16 scriptResult; + /*0x1A*/ s16 scriptArr[3]; + /*0x20*/ u32 stack[8]; + /*0x40*/ u8 unk40; + /*0x41*/ u8 unk41; +}; + extern struct ContestPokemon gContestMons[]; extern const struct ContestMove gContestMoves[]; extern const struct ContestEffect gContestEffects[]; @@ -86,6 +102,7 @@ void sub_80B0F28(u8); bool8 Contest_SaveWinner(u8); u8 sub_80B2C4C(u8, u8); void Contest_ResetWinners(void); +s8 Contest_GetMoveExcitement(u16); // Contest Shared EWRAM @@ -135,48 +152,48 @@ struct Contest struct ContestantStatus { - s16 appeal1; // move appeal? - s16 appeal2; // final appeal after end of turn, maybe? - s16 unk4; - u16 currMove; - u16 prevMove; - u8 moveCategory; - u8 unkB_0:2; - u8 unkB_2:2; - u8 moveRepeatCount:3; - u8 unkB_7:1; // used a one-time move? - u8 unkC_0:1; - u8 unkC_1:2; - s8 unkD; - u8 unkE; - u8 unkF; - u8 unk10_0:1; - u8 unk10_1:1; - u8 unk10_2:1; - u8 unk10_3:1; - u8 unk10_4:2; - u8 unk10_6:2; - u8 unk11_0:2; - u8 unk11_2:1; - u8 unk11_3:1; - u8 unk11_4:1; - u8 unk11_5:1; - u8 unk12; - u8 unk13; // status action? - u8 unk14; - u8 disappointedRepeat:1; - u8 unk15_1:1; - u8 unk15_2:1; - u8 unk15_3:1; - u8 unk15_4:1; - u8 unk15_5:1; - u8 unk15_6:1; - u8 unk16; - u8 unk17; - u8 unk18; - u8 unk19; // turn position - u8 attentionLevel; // How much the Pokemon "stood out" - u8 unk1B; + /*0x00*/ s16 appeal1; // move appeal? + /*0x02*/ s16 appeal2; // final appeal after end of turn, maybe? + /*0x04*/ s16 unk4; + /*0x06*/ u16 currMove; + /*0x08*/ u16 prevMove; + /*0x0A*/ u8 moveCategory; + /*0x0B*/ u8 unkB_0:2; + u8 unkB_2:2; + u8 moveRepeatCount:3; + u8 unkB_7:1; // used a one-time move? + /*0x0C*/ u8 unkC_0:1; + u8 unkC_1:2; + /*0x0D*/ s8 unkD; + /*0x0E*/ u8 unkE; + /*0x0F*/ u8 unkF; + /*0x10*/ u8 unk10_0:1; + u8 unk10_1:1; + u8 unk10_2:1; + u8 unk10_3:1; + u8 unk10_4:2; + u8 unk10_6:2; + /*0x11*/ u8 unk11_0:2; + u8 unk11_2:1; + u8 unk11_3:1; + u8 unk11_4:1; + u8 unk11_5:1; + /*0x12*/ u8 unk12; + /*0x13*/ u8 unk13; // status action? + /*0x14*/ u8 unk14; + /*0x15*/ u8 disappointedRepeat:1; + u8 unk15_1:1; + u8 unk15_2:1; + u8 unk15_3:1; + u8 unk15_4:1; + u8 unk15_5:1; + u8 unk15_6:1; + /*0x16*/ u8 unk16; + /*0x17*/ u8 unk17; + /*0x18*/ u8 unk18; + /*0x19*/ u8 unk19; // turn position + /*0x1A*/ u8 attentionLevel; // How much the Pokemon "stood out" + /*0x1B*/ u8 unk1B; }; struct UnknownContestStruct3 @@ -241,6 +258,7 @@ struct UnknownContestStruct6 s32 unkC; }; +// TODO: Please move these to ewram.h once the defines are settled down and figured out completely. #define shared15800 (gSharedMem + 0x15800) #define shared15DE0 (*(struct ContestWinner *)(gSharedMem + 0x15DE0)) #define shared16800 (gSharedMem + 0x16800) @@ -248,7 +266,6 @@ struct UnknownContestStruct6 #define shared18004 ((u16 *)(gSharedMem + 0x18004)) #define sContest (*(struct Contest *)(gSharedMem + 0x19204)) #define sContestantStatus ((struct ContestantStatus *)(gSharedMem + 0x19260)) -#define shared192D0 (*(struct UnknownContestStruct7 *)(gSharedMem + 0x192D0)) #define shared192E4 (gSharedMem + 0x192E4) #define shared19328 (*(struct UnknownContestStruct5 *)(gSharedMem + 0x19328)) #define shared19338 ((struct UnknownContestStruct4 *)(gSharedMem + 0x19338)) diff --git a/include/contest_ai.h b/include/contest_ai.h new file mode 100755 index 000000000..da143b541 --- /dev/null +++ b/include/contest_ai.h @@ -0,0 +1,16 @@ +#ifndef GUARD_CONTESTAI_H +#define GUARD_CONTESTAI_H + +// AI states +enum +{ + CONTESTAI_SETTING_UP, + CONTESTAI_PROCESSING, + CONTESTAI_FINISHED, + CONTESTAI_DO_NOT_PROCESS +}; + +void ContestAI_ResetAI(u8); +u8 ContestAI_GetActionToUse(void); + +#endif diff --git a/include/ewram.h b/include/ewram.h index 809d4ff66..36081dd2a 100755 --- a/include/ewram.h +++ b/include/ewram.h @@ -20,7 +20,7 @@ extern u8 gSharedMem[]; #define eBrendanSprite (gSharedMem + 0x0) #define ewram0_6 (u32)(&gSharedMem[0]) #define ewram0_7 (&gSharedMem[0]) -#define eSaveSection (struct SaveSection *)(gSharedMem + 0x0) +#define eSaveSection (struct SaveSector *)(gSharedMem + 0x0) #define ewram0arr ((u8 (*)[32])gSharedMem) #define eVoidSharedArr (void *)(ewram_addr + 0x0) #define eVoidSharedArr2 (u32)(ewram_addr) // ew(ram) @@ -234,6 +234,8 @@ extern u8 gSharedMem[]; #define eCableCar2 ((struct CableCarEwramStruct2 *)(gSharedMem + 0x19000)) #define ePokedexView3 (struct PokedexView *)(gSharedMem + 0x19000) #define eRoulette ((struct Roulette *)(gSharedMem + 0x19000)) +#define shared192D0 (*(struct UnknownContestStruct7 *)(gSharedMem + 0x192D0)) +#define eContestAI ((struct ContestAIInfo *)(gSharedMem + 0x192E4)) #define EWRAM_19348 (*(u16 *)(gSharedMem + 0x19348)) #define ewram19800 (&gSharedMem[0x19800]) #define ePokedexView4 (struct PokedexView *)(gSharedMem + 0x19800) diff --git a/include/save.h b/include/save.h index c35ad547a..13e07d06a 100644 --- a/include/save.h +++ b/include/save.h @@ -1,85 +1,38 @@ #ifndef GUARD_SAVE_H #define GUARD_SAVE_H -struct SaveSectionLocation -{ - u8 *data; - u16 size; -}; - -struct SaveSection -{ - u8 data[0xFF4]; - u16 id; - u16 checksum; - u32 security; - u32 counter; -}; // size is 0x1000 - -// headless save section? -struct UnkSaveSection -{ - u8 data[0xFF4]; - u32 security; -}; // size is 0xFF8 - // Ruby/Sapphire's save data is Flash 128K, which is 32 save sectors. #define NUM_SECTORS 32 // defined in agb_flash but not in a header -#define UNKNOWN_CHECK_VALUE 0x8012025 +#define SAVE_STATUS_EMPTY 0 +#define SAVE_STATUS_OK 1 +#define SAVE_STATUS_NO_FLASH 4 +#define SAVE_STATUS_ERROR 0xFF -// SetDamagedSectorBits states -enum -{ - ENABLE, - DISABLE, - CHECK // unused -}; +extern u16 gSaveFileStatus; + +void Save_EraseAllData(void); +void Save_ResetSaveCounters(void); -// Do save types enum { - NORMAL_SAVE, - LINK_SAVE, - EREADER_SAVE, // mossdeep event - HOF_SAVE, - DIFFERENT_FILE_SAVE, - HOF_DELETE_SAVE // unused + SAVE_NORMAL, + SAVE_LINK, + SAVE_EREADER, + SAVE_HALL_OF_FAME, + SAVE_OVERWRITE_DIFFERENT_FILE, + SAVE_HALL_OF_FAME_ERASE_BEFORE, // unused }; -void ClearSaveData(void); -void ResetSaveCounters(void); -bool32 ManipulateSectorBits(u8 op, u8 bit); -u8 save_write_to_flash(u16 a1, const struct SaveSectionLocation *a2); -u8 HandleWriteSector(u16, const struct SaveSectionLocation *); -u8 HandleWriteSectorNBytes(u8 sector, u8 *data, u16 size); -u8 TryWriteSector(u8, u8 *); -u32 RestoreSaveBackupVarsAndIncrement(const struct SaveSectionLocation *location); -u32 RestoreSaveBackupVars(const struct SaveSectionLocation *location); -u8 sub_812550C(u16 a1, const struct SaveSectionLocation *location); -u8 sub_812556C(u16 a1, const struct SaveSectionLocation *location); -u8 sub_81255B8(u16, const struct SaveSectionLocation *location); -u8 sub_8125758(u16 a1, const struct SaveSectionLocation *location); -u8 sub_81257F0(u16 a1, const struct SaveSectionLocation *location); -u8 sub_812587C(u16 a1, const struct SaveSectionLocation *location); -u8 sub_81258BC(u16, const struct SaveSectionLocation *location); -u8 GetSaveValidStatus(const struct SaveSectionLocation *location); -u8 sub_8125B88(u8 a1, u8 *data, u16 size); -u8 DoReadFlashWholeSection(u8, struct SaveSection *); -u16 CalculateChecksum(void *, u16); -u8 HandleSavingData(u8 saveType); -u8 TrySavingData(u8 saveType); +u8 Save_WriteDataInternal(u8 saveType); +u8 Save_WriteData(u8 saveType); + u8 sub_8125D80(void); bool8 sub_8125DA8(void); u8 sub_8125DDC(void); u8 sub_8125E04(void); u8 sub_8125E2C(void); bool8 sub_8125E6C(void); -u8 sub_8125EC8(u8 a1); -bool8 unref_sub_8125F4C(struct UnkSaveSection *a1); -u8 unref_sub_8125FA0(void); -u8 unref_sub_8125FF0(u8 *data, u16 size); -u8 unref_sub_8126068(u8 sector, u8 *data, u32 size); -u8 unref_sub_8126080(u8 sector, u8 *data); +u8 Save_LoadGameData(u8 a1); #endif // GUARD_SAVE_H |