From 34a49a726c6c42803950fc993394be8b96492c71 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Tue, 14 Nov 2017 22:00:53 -0800 Subject: More pokemon_summary_screen decompilation --- include/pokemon.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/pokemon.h b/include/pokemon.h index 7fc8e181f..20a2d6d43 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -612,5 +612,7 @@ bool8 IsPokeSpriteNotFlipped(u16); u8 GetLevelUpMovesBySpecies(u16, u16 *); u8 TryIncrementMonLevel(struct Pokemon *); +struct Sprite *sub_80F7920(u16, u16, const u16 *); + #endif // GUARD_POKEMON_H -- cgit v1.2.3 From 5a8cd94046983f15eaf6d414d5f431cb296abdc3 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Thu, 23 Nov 2017 13:47:44 -0800 Subject: Lots more pokemon_summary_screen decompilation --- include/learn_move.h | 15 +++++++++++++++ include/party_menu.h | 1 + include/pokemon.h | 2 ++ 3 files changed, 18 insertions(+) (limited to 'include') diff --git a/include/learn_move.h b/include/learn_move.h index 85fbf046e..7a05ea60b 100644 --- a/include/learn_move.h +++ b/include/learn_move.h @@ -1,6 +1,21 @@ #ifndef GUARD_LEARN_MOVE_H #define GUARD_LEARN_MOVE_H +struct ContestMove +{ + u8 effect; + u8 contestCategory:3; + u8 comboStarterId; + u8 comboMoves[4]; +}; + +struct ContestEffect +{ + u8 effectType; + u8 appeal; + u8 jam; +}; + void sub_8132670(void); #endif // GUARD_LEARN_MOVE_H diff --git a/include/party_menu.h b/include/party_menu.h index 304389e78..3998054da 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -216,5 +216,6 @@ void PartyMenuTryGiveMonMail(u8 taskId, TaskFunc func); void sub_806D668(u8 monIndex); void TaughtMove(u8 taskId); void StopTryingToTeachMove_806F588(u8 taskId); +bool8 IsHMMove(u16 move); #endif // GUARD_PARTY_MENU_H diff --git a/include/pokemon.h b/include/pokemon.h index 20a2d6d43..a1c30f1f3 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -578,6 +578,7 @@ void MonRestorePP(struct Pokemon *); u8 *sub_803F378(u16 itemId); +u16 SpeciesToPokedexNum(u16 species); u16 NationalPokedexNumToSpecies(u16 nationalNum); u16 NationalToHoennOrder(u16); u16 SpeciesToNationalPokedexNum(u16); @@ -611,6 +612,7 @@ const struct CompressedSpritePalette *GetMonSpritePalStruct(struct Pokemon *); bool8 IsPokeSpriteNotFlipped(u16); u8 GetLevelUpMovesBySpecies(u16, u16 *); u8 TryIncrementMonLevel(struct Pokemon *); +bool8 IsShiny(struct Pokemon *mon); struct Sprite *sub_80F7920(u16, u16, const u16 *); -- cgit v1.2.3 From 00f85341a6d769cc23c4dfbf5fca8ad02835956c Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sat, 25 Nov 2017 14:40:48 -0800 Subject: Mostly done decompiling pokemon_summary_screen --- include/gba/macro.h | 16 ++++++++++++++++ include/pokemon_summary_screen.h | 41 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 54 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/gba/macro.h b/include/gba/macro.h index 1e0254806..a0edf2a49 100644 --- a/include/gba/macro.h +++ b/include/gba/macro.h @@ -103,6 +103,22 @@ } \ } +#define DmaClearLarge(dmaNum, dest, size, block, bit) \ +{ \ + u32 _size = size; \ + while (1) \ + { \ + DmaFill##bit(dmaNum, 0, dest, (block)); \ + dest += (block); \ + _size -= (block); \ + if (_size <= (block)) \ + { \ + DmaFill##bit(dmaNum, 0, dest, _size); \ + break; \ + } \ + } \ +} + #define DmaCopyLarge16(dmaNum, src, dest, size, block) DmaCopyLarge(dmaNum, src, dest, size, block, 16) #define DmaCopyLarge32(dmaNum, src, dest, size, block) DmaCopyLarge(dmaNum, src, dest, size, block, 32) diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index c1b99c367..d5978b83e 100644 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -1,11 +1,45 @@ #ifndef GUARD_POKEMON_SUMMARY_SCREEN_H #define GUARD_POKEMON_SUMMARY_SCREEN_H +#include "main.h" +#include "task.h" + extern const u8 *const gNatureNames[]; -void ShowPokemonSummaryScreen(struct Pokemon *, u8, u8, void (*)(void), int); -void sub_809D9F0(struct Pokemon *party, u8, u8, void *, u32); -void sub_809D9F0(struct Pokemon *, u8, u8, void *, u32); +struct SummaryScreenStruct +{ + /*0x00*/ union { + struct Pokemon *partyMons; + struct BoxPokemon *boxMons; + } unk0; + /*0x04*/ MainCallback unk4; + /*0x08*/ u8 unk8; + /*0x09*/ u8 unk9; + /*0x0A*/ u8 unkA; + /*0x0B*/ u8 unkB; + /*0x0C*/ u8 unkC; + /*0x0D*/ u8 unkD; + /*0x0E*/ u8 unkE; + /*0x0F*/ u8 unkF; + /*0x10*/ struct Pokemon unk10; + /*0x74*/ u8 unk74; + /*0x75*/ u8 unk75; + /*0x76*/ u8 unk76; + /*0x77*/ u8 unk77; + /*0x78*/ u8 unk78; + /*0x79*/ u8 unk79; + /*0x7A*/ u8 unk7A; + /*0x7B*/ u8 unk7B; + /*0x7C*/ u16 unk7C; + /*0x7E*/ u8 unk7E; + /*0x7F*/ u8 unk7F; + /*0x80*/ u8 unk80; + /*0x81*/ u8 filler81; + /*0x84*/ TaskFunc unk84; +}; + +void ShowPokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u8); +void sub_809D9F0(struct Pokemon *, u8, u8, MainCallback, u16); u8 sub_809FA30(void); u8 pokemon_ailments_get_primary(u32); u8 GetMonStatusAndPokerus(); @@ -14,4 +48,5 @@ u8 *PokemonSummaryScreen_CopyPokemonLevel(u8 *dest, u8 level); u8 PokemonSummaryScreen_CheckOT(struct Pokemon *pokemon); bool8 CheckPartyPokerus(struct Pokemon *, u8); + #endif // GUARD_POKEMON_SUMMARY_SCREEN_H -- cgit v1.2.3 From b81a94c1edb86459187288ac7f005f4cf1a6c051 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sat, 25 Nov 2017 18:26:45 -0800 Subject: Label the PokemonSummaryScreenStruct structs members --- include/pokemon_summary_screen.h | 66 ++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 23 deletions(-) (limited to 'include') diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index d5978b83e..187948d8a 100644 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -6,35 +6,55 @@ extern const u8 *const gNatureNames[]; -struct SummaryScreenStruct +// The Pokemon Summary Screen can operate in different modes. Certain features, +// such as move re-ordering, are available in the different modes. +enum PokemonSummaryScreenMode +{ + PSS_MODE_NORMAL, + PSS_MODE_MOVES_ONLY, + PSS_MODE_SELECT_MOVE, + PSS_MODE_UNKNOWN, // TODO: this mode might be used by pokemon_storage_system + PSS_MODE_NO_MOVE_ORDER_EDIT, + PSS_MODE_PC_NORMAL, + PSS_MODE_PC_MOVES_ONLY, +}; + +enum PokemonSummaryScreenPage +{ + PSS_PAGE_INFO, + PSS_PAGE_SKILLS, + PSS_PAGE_BATTLE_MOVES, + PSS_PAGE_CONTEST_MOVES, +}; + +struct PokemonSummaryScreenStruct { /*0x00*/ union { struct Pokemon *partyMons; struct BoxPokemon *boxMons; - } unk0; - /*0x04*/ MainCallback unk4; - /*0x08*/ u8 unk8; - /*0x09*/ u8 unk9; - /*0x0A*/ u8 unkA; - /*0x0B*/ u8 unkB; - /*0x0C*/ u8 unkC; - /*0x0D*/ u8 unkD; - /*0x0E*/ u8 unkE; - /*0x0F*/ u8 unkF; - /*0x10*/ struct Pokemon unk10; - /*0x74*/ u8 unk74; - /*0x75*/ u8 unk75; - /*0x76*/ u8 unk76; + } monList; + /*0x04*/ MainCallback callback; + /*0x08*/ u8 mode; // see enum PokemonSummaryScreenMode + /*0x09*/ u8 monIndex; + /*0x0A*/ u8 maxMonIndex; + /*0x0B*/ u8 page; // enum PokemonSummaryScreenPage + /*0x0C*/ u8 monSpriteId; + /*0x0D*/ u8 ballSpriteId; + /*0x0E*/ bool8 usingPC; + /*0x0F*/ u8 inputHandlingTaskId; + /*0x10*/ struct Pokemon loadedMon; + /*0x74*/ u8 loadGfxState; + /*0x75*/ u8 firstPage; + /*0x76*/ u8 lastPage; /*0x77*/ u8 unk77; /*0x78*/ u8 unk78; - /*0x79*/ u8 unk79; - /*0x7A*/ u8 unk7A; - /*0x7B*/ u8 unk7B; - /*0x7C*/ u16 unk7C; - /*0x7E*/ u8 unk7E; - /*0x7F*/ u8 unk7F; - /*0x80*/ u8 unk80; - /*0x81*/ u8 filler81; + /*0x79*/ u8 selectedMoveIndex; + /*0x7A*/ u8 switchMoveIndex; + /*0x7B*/ bool8 disableMoveOrderEditing; + /*0x7C*/ u16 moveToLearn; + /*0x7E*/ u8 headerTextId; // used as index into gUnknown_083C1068 + /*0x7F*/ u8 headerActionTextId; // used as index into gUnknown_083C1068 + /*0x80*/ u8 bgToggle; /*0x84*/ TaskFunc unk84; }; -- cgit v1.2.3 From 8ad0f966993f4b87fcf30ddc217400164550f193 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sun, 26 Nov 2017 12:51:11 -0800 Subject: Move summary_screen data into src --- include/pokemon_summary_screen.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index 187948d8a..99af37f69 100644 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -52,8 +52,8 @@ struct PokemonSummaryScreenStruct /*0x7A*/ u8 switchMoveIndex; /*0x7B*/ bool8 disableMoveOrderEditing; /*0x7C*/ u16 moveToLearn; - /*0x7E*/ u8 headerTextId; // used as index into gUnknown_083C1068 - /*0x7F*/ u8 headerActionTextId; // used as index into gUnknown_083C1068 + /*0x7E*/ u8 headerTextId; // used as index into sPageHeaderTexts + /*0x7F*/ u8 headerActionTextId; // used as index into sPageHeaderTexts /*0x80*/ u8 bgToggle; /*0x84*/ TaskFunc unk84; }; -- cgit v1.2.3 From 1829f7e7195575e872eb378722a56b344e2a1cd7 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sun, 26 Nov 2017 13:35:08 -0800 Subject: Cleanup pokemon_summary_screen --- include/ewram.h | 1 + include/pokemon_summary_screen.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/ewram.h b/include/ewram.h index 06ea513a3..eacc02cab 100755 --- a/include/ewram.h +++ b/include/ewram.h @@ -207,6 +207,7 @@ extern u8 gSharedMem[]; #define eEggHatchData (struct EggHatchData*)(&gSharedMem[0x18000]) #define ePokedexView1 (struct PokedexView *)(gSharedMem + 0x18000) #define UNK_2018000_STRUCT (*(struct UnknownStruct2018000 *)(gSharedMem + 0x18000)) +#define pssData (*(struct PokemonSummaryScreenStruct *)(gSharedMem + 0x18000)) #define ewram18300 ((u16 *)(gSharedMem + 0x18300)) #define ewram18800 (&gSharedMem[0x18800]) #define ePokedexView2 (struct PokedexView *)(gSharedMem + 0x18800) diff --git a/include/pokemon_summary_screen.h b/include/pokemon_summary_screen.h index 99af37f69..945e810a3 100644 --- a/include/pokemon_summary_screen.h +++ b/include/pokemon_summary_screen.h @@ -59,7 +59,7 @@ struct PokemonSummaryScreenStruct }; void ShowPokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u8); -void sub_809D9F0(struct Pokemon *, u8, u8, MainCallback, u16); +void ShowSelectMovePokemonSummaryScreen(struct Pokemon *, u8, u8, MainCallback, u16); u8 sub_809FA30(void); u8 pokemon_ailments_get_primary(u32); u8 GetMonStatusAndPokerus(); -- cgit v1.2.3