From b3551bc2f328c286c6ecc45ea288665d46b44260 Mon Sep 17 00:00:00 2001 From: camthesaxman Date: Sat, 6 Jan 2018 12:27:27 -0600 Subject: fix some code and formatting anomalies --- include/contest.h | 167 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) (limited to 'include/contest.h') diff --git a/include/contest.h b/include/contest.h index 10392c00e..6e71358a2 100644 --- a/include/contest.h +++ b/include/contest.h @@ -87,4 +87,171 @@ bool8 Contest_SaveWinner(u8); u8 sub_80B2C4C(u8, u8); void Contest_ResetWinners(void); +// Contest Shared EWRAM + +struct Shared18000 +{ + /*0x18000*/ u8 unk18000; + /*0x18001*/ u8 filler18001[3]; + /*0x18004*/ u16 unk18004[16][16]; + /*0x18204*/ u16 unk18204[0x200]; + /*0x18604*/ u16 unk18604[0x200]; + /*0x18A04*/ u8 unk18A04[0x800]; +}; + +struct Contest +{ + /*0x19204*/ u8 playerMoveChoice; + /*0x19205*/ u8 turnNumber; + /*0x19206*/ u8 unk19206[4]; // seems to only be used by an unref function + /*0x1920A*/ u16 unk1920A_0:1; // Task active flags? + u16 unk1920A_1:1; + u16 unk1920A_2:1; + u16 unk1920A_3:1; + u16 unk1920A_4:1; + u16 unk1920A_5:1; + u16 unk1920A_6:1; + u16 unk1920A_7:1; + /*0x1920B*/ u16 unk1920B_0:1; + u16 unk1920B_1:1; + u16 unk1920B_2:1; + /*0x1920C*/ u8 mainTaskId; + /*0x1920D*/ u8 unk1920D[4]; + /*0x19211*/ u8 unk19211; + /*0x19212*/ u8 unk19212; + /*0x19213*/ u8 filler19213; + /*0x19214*/ u8 unk19214; + /*0x19215*/ u8 unk19215; + /*0x19216*/ u8 unk19216; // sprite ID + /*0x19217*/ s8 applauseLevel; + /*0x19218*/ u8 unk19218[4]; + /*0x1921C*/ u32 unk1921C; // saved RNG value? + u16 unk19220[5][4]; // move history? + u8 unk19248[5][4]; // excitement history + u8 applauseMeterSpriteId; // sprite ID + /*0x1925D*/ u8 unk1925D; + /*0x1925E*/ u8 unk1925E; +}; + +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; +}; + +struct UnknownContestStruct3 +{ + u8 unk0; + u8 unk1; + //u8 unk2_0:1; + //u8 unk2_1:1; + u8 unk2; // maybe a bitfield + u8 filler3; +}; + +// possibly the same as UnknownContestStruct3? +struct UnknownContestStruct4 +{ + u8 unk0; // sprite ID + u8 unk1; // sprite ID + u8 unk2_0:1; + u8 unk2_1:1; + u8 unk2_2:1; + u8 filler3; +}; + +struct UnknownContestStruct5 +{ + s8 bits_0; // current move excitement? + u8 bits_8:1; + u8 bits_9:3; + u8 bits_C:4; + s8 unk2; + u8 filler3; +}; + +struct UnknownContestStruct7 +{ + u8 unk0[4]; + u16 unk4; + u16 unk6; + u8 filler8[0xD-8]; + u8 unkD[4]; + u8 unk11; + u8 filler12[2]; +}; + +struct UnknownContestStruct8 +{ + u16 unk0; + u16 unk2; + u8 unk4_0:1; + u8 unk5; + u8 filler6[2]; + u32 unk8; + u32 unkC; + u32 unk10; +}; + +struct UnknownContestStruct6 +{ + s32 unk0; + s32 unk4; + s32 unk8; + s32 unkC; +}; + +#define shared15800 (gSharedMem + 0x15800) +#define shared15DE0 (*(struct ContestWinner *)(gSharedMem + 0x15DE0)) +#define shared16800 (gSharedMem + 0x16800) +#define shared18000 (*(struct Shared18000 *)(gSharedMem + 0x18000)) +#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)) +#define shared19348 (*(struct UnknownContestStruct8 *)(gSharedMem + 0x19348)) + #endif // GUARD_CONTEST_H -- cgit v1.2.3 From 5d393adfcc1a994f9885a2720f3a0bb29afd5a6e Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Fri, 12 Jan 2018 18:16:52 -0500 Subject: start decompiling contest_ai --- include/contest.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'include/contest.h') diff --git a/include/contest.h b/include/contest.h index 6e71358a2..a1d2ec9e0 100644 --- a/include/contest.h +++ b/include/contest.h @@ -67,6 +67,23 @@ struct ContestPokemon /*0x3C*/ u32 otId; // otId }; // wow +struct ContestAIInfo { + /*0x00*/ u8 aiState; + /*0x01*/ u8 filler1[1]; // padding? + /*0x02*/ u16 unk2; + /*0x04*/ u8 unk4; + /*0x05*/ u8 unk5[4]; + /*0x09*/ u8 aiAction; + /*0x0A*/ u8 fillerA[0x6]; + /*0x10*/ u8 unk10; + /*0x11*/ u8 filler11[0x3]; // padding? + /*0x14*/ u32 flags; + /*0x18*/ u8 filler18[0x28]; + /*0x40*/ u8 unk40; + /*0x41*/ u8 unk41; + /*0x42*/ u8 filler42[0x2]; // padding? +}; + extern struct ContestPokemon gContestMons[]; extern const struct ContestMove gContestMoves[]; extern const struct ContestEffect gContestEffects[]; @@ -248,7 +265,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)) -- cgit v1.2.3 From fdeee269791ba9e163f32522d44526b0e2b58f29 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Fri, 12 Jan 2018 20:44:49 -0500 Subject: up to ContestAICmd_unk_14 --- include/contest.h | 87 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 44 insertions(+), 43 deletions(-) (limited to 'include/contest.h') diff --git a/include/contest.h b/include/contest.h index a1d2ec9e0..32da9703a 100644 --- a/include/contest.h +++ b/include/contest.h @@ -78,7 +78,8 @@ struct ContestAIInfo { /*0x10*/ u8 unk10; /*0x11*/ u8 filler11[0x3]; // padding? /*0x14*/ u32 flags; - /*0x18*/ u8 filler18[0x28]; + /*0x18*/ u16 scriptResult; + /*0x1A*/ u8 filler1A[0x26]; /*0x40*/ u8 unk40; /*0x41*/ u8 unk41; /*0x42*/ u8 filler42[0x2]; // padding? @@ -152,48 +153,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 -- cgit v1.2.3 From e33a9b2b535b401a47455065dd4cb9364ed9c9f7 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Fri, 12 Jan 2018 22:48:47 -0500 Subject: up to ContestAICmd_unk_2C --- include/contest.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/contest.h') diff --git a/include/contest.h b/include/contest.h index 32da9703a..9a211bbf5 100644 --- a/include/contest.h +++ b/include/contest.h @@ -104,6 +104,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 -- cgit v1.2.3 From bc2abc39f6a8b47e844136a43fbc729eb5568833 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sun, 14 Jan 2018 04:46:09 -0500 Subject: up to ContestAICmd_unk_7E --- include/contest.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/contest.h') diff --git a/include/contest.h b/include/contest.h index 9a211bbf5..c8c1a2901 100644 --- a/include/contest.h +++ b/include/contest.h @@ -79,7 +79,7 @@ struct ContestAIInfo { /*0x11*/ u8 filler11[0x3]; // padding? /*0x14*/ u32 flags; /*0x18*/ u16 scriptResult; - /*0x1A*/ u8 filler1A[0x26]; + /*0x1A*/ u16 scriptArr[19]; // TODO: are there more variables after the array? /*0x40*/ u8 unk40; /*0x41*/ u8 unk41; /*0x42*/ u8 filler42[0x2]; // padding? -- cgit v1.2.3 From 99d4f3c24a600af8dadfe921f127f68d0bd4f2c3 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sun, 14 Jan 2018 12:48:52 -0500 Subject: finish decompiling contest_ai.c --- include/contest.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/contest.h') diff --git a/include/contest.h b/include/contest.h index c8c1a2901..2c53c3490 100644 --- a/include/contest.h +++ b/include/contest.h @@ -79,7 +79,8 @@ struct ContestAIInfo { /*0x11*/ u8 filler11[0x3]; // padding? /*0x14*/ u32 flags; /*0x18*/ u16 scriptResult; - /*0x1A*/ u16 scriptArr[19]; // TODO: are there more variables after the array? + /*0x1A*/ u16 scriptArr[3]; // TODO: are there more variables after the array? + /*0x20*/ u32 stack[8]; /*0x40*/ u8 unk40; /*0x41*/ u8 unk41; /*0x42*/ u8 filler42[0x2]; // padding? -- cgit v1.2.3 From 8990b10732827087e04a2a02632769b252baaff6 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sun, 14 Jan 2018 13:19:30 -0500 Subject: move rodata to C --- include/contest.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'include/contest.h') diff --git a/include/contest.h b/include/contest.h index 2c53c3490..509f63758 100644 --- a/include/contest.h +++ b/include/contest.h @@ -69,21 +69,18 @@ struct ContestPokemon struct ContestAIInfo { /*0x00*/ u8 aiState; - /*0x01*/ u8 filler1[1]; // padding? /*0x02*/ u16 unk2; /*0x04*/ u8 unk4; /*0x05*/ u8 unk5[4]; /*0x09*/ u8 aiAction; - /*0x0A*/ u8 fillerA[0x6]; + /*0x0A*/ u8 fillerA[0x6]; // TODO: don't know what's here /*0x10*/ u8 unk10; - /*0x11*/ u8 filler11[0x3]; // padding? /*0x14*/ u32 flags; /*0x18*/ u16 scriptResult; /*0x1A*/ u16 scriptArr[3]; // TODO: are there more variables after the array? /*0x20*/ u32 stack[8]; /*0x40*/ u8 unk40; /*0x41*/ u8 unk41; - /*0x42*/ u8 filler42[0x2]; // padding? }; extern struct ContestPokemon gContestMons[]; @@ -261,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) -- cgit v1.2.3 From e769bb92568d732429645cfceb9c18fb49858431 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sun, 14 Jan 2018 13:21:02 -0500 Subject: comment --- include/contest.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/contest.h') diff --git a/include/contest.h b/include/contest.h index 509f63758..956f4d02b 100644 --- a/include/contest.h +++ b/include/contest.h @@ -77,7 +77,7 @@ struct ContestAIInfo { /*0x10*/ u8 unk10; /*0x14*/ u32 flags; /*0x18*/ u16 scriptResult; - /*0x1A*/ u16 scriptArr[3]; // TODO: are there more variables after the array? + /*0x1A*/ u16 scriptArr[3]; /*0x20*/ u32 stack[8]; /*0x40*/ u8 unk40; /*0x41*/ u8 unk41; -- cgit v1.2.3 From d7d947c6913d1a2a7a6401b8aac2041d536ad978 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sun, 14 Jan 2018 13:59:12 -0500 Subject: formatting and clean up --- include/contest.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/contest.h') diff --git a/include/contest.h b/include/contest.h index 956f4d02b..b7cb46810 100644 --- a/include/contest.h +++ b/include/contest.h @@ -76,7 +76,7 @@ struct ContestAIInfo { /*0x0A*/ u8 fillerA[0x6]; // TODO: don't know what's here /*0x10*/ u8 unk10; /*0x14*/ u32 flags; - /*0x18*/ u16 scriptResult; + /*0x18*/ s16 scriptResult; /*0x1A*/ u16 scriptArr[3]; /*0x20*/ u32 stack[8]; /*0x40*/ u8 unk40; -- cgit v1.2.3 From a5403f03dd49711f8c2f719e8bfa8a83f427563c Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sun, 14 Jan 2018 14:16:40 -0500 Subject: scriptArr to s16 --- include/contest.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/contest.h') diff --git a/include/contest.h b/include/contest.h index b7cb46810..6b1f1f520 100644 --- a/include/contest.h +++ b/include/contest.h @@ -77,7 +77,7 @@ struct ContestAIInfo { /*0x10*/ u8 unk10; /*0x14*/ u32 flags; /*0x18*/ s16 scriptResult; - /*0x1A*/ u16 scriptArr[3]; + /*0x1A*/ s16 scriptArr[3]; /*0x20*/ u32 stack[8]; /*0x40*/ u8 unk40; /*0x41*/ u8 unk41; -- cgit v1.2.3 From fc504ce61b8698bc4777bbd37a8766b8c35a5814 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 22 Jan 2018 15:51:57 -0500 Subject: through (nonmatching) sub_80C86A0 --- include/contest.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/contest.h') diff --git a/include/contest.h b/include/contest.h index 6b1f1f520..e8e68f0e6 100644 --- a/include/contest.h +++ b/include/contest.h @@ -271,4 +271,7 @@ struct UnknownContestStruct6 #define shared19338 ((struct UnknownContestStruct4 *)(gSharedMem + 0x19338)) #define shared19348 (*(struct UnknownContestStruct8 *)(gSharedMem + 0x19348)) +extern u8 gContestPlayerMonIndex; +extern u8 gIsLinkContest; + #endif // GUARD_CONTEST_H -- cgit v1.2.3 From 84769240d2002281c7bc274f18aab76fbe908483 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 22 Jan 2018 18:04:04 -0500 Subject: sub_80C88AC --- include/contest.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/contest.h') diff --git a/include/contest.h b/include/contest.h index e8e68f0e6..dfa0e38da 100644 --- a/include/contest.h +++ b/include/contest.h @@ -273,5 +273,6 @@ struct UnknownContestStruct6 extern u8 gContestPlayerMonIndex; extern u8 gIsLinkContest; +extern u32 gContestRngValue; #endif // GUARD_CONTEST_H -- cgit v1.2.3 From cbab0f740349cbeece60f2155537c2a9870d2318 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 22 Jan 2018 20:24:02 -0500 Subject: sub_80C8AD0 --- include/contest.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/contest.h') diff --git a/include/contest.h b/include/contest.h index dfa0e38da..a15ca67e6 100644 --- a/include/contest.h +++ b/include/contest.h @@ -274,5 +274,10 @@ struct UnknownContestStruct6 extern u8 gContestPlayerMonIndex; extern u8 gIsLinkContest; extern u32 gContestRngValue; +extern s16 gUnknown_02038678[4]; +extern s16 gUnknown_02038680[4]; +extern u16 gUnknown_02038688[4]; +extern u8 gContestFinalStandings[4]; +extern u8 gUnknown_0203869B; #endif // GUARD_CONTEST_H -- cgit v1.2.3 From 399856bc7ead101718891712dd20dd85e138e640 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 22 Jan 2018 20:30:31 -0500 Subject: sub_80C8C80 --- include/contest.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/contest.h') diff --git a/include/contest.h b/include/contest.h index a15ca67e6..f8fceae79 100644 --- a/include/contest.h +++ b/include/contest.h @@ -278,6 +278,7 @@ extern s16 gUnknown_02038678[4]; extern s16 gUnknown_02038680[4]; extern u16 gUnknown_02038688[4]; extern u8 gContestFinalStandings[4]; +extern u8 gUnknown_02038696[4]; extern u8 gUnknown_0203869B; #endif // GUARD_CONTEST_H -- cgit v1.2.3 From c723b341c50df19f8951353a7efd4ab83bf56833 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 22 Jan 2018 20:52:41 -0500 Subject: through sub_80C8F34 --- include/contest.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/contest.h') diff --git a/include/contest.h b/include/contest.h index f8fceae79..b0bdd7f61 100644 --- a/include/contest.h +++ b/include/contest.h @@ -274,6 +274,8 @@ struct UnknownContestStruct6 extern u8 gContestPlayerMonIndex; extern u8 gIsLinkContest; extern u32 gContestRngValue; +extern u8 gUnknown_02038696[4]; +extern s16 gUnknown_02038670[4]; extern s16 gUnknown_02038678[4]; extern s16 gUnknown_02038680[4]; extern u16 gUnknown_02038688[4]; -- cgit v1.2.3