Merge pull request #329 from camthesaxman/decompile_choose_party

decompile choose_party
This commit is contained in:
yenatch 2017-06-25 00:02:59 -04:00 committed by GitHub
commit 45b4b7ed85
17 changed files with 1202 additions and 2658 deletions

View File

@ -16,7 +16,7 @@ BufferStringBattle: @ 8120AA8
lsls r0, 16
lsrs r7, r0, 16
movs r6, 0
ldr r5, _08120B70 @ =gBufferedMoves
ldr r5, _08120B70 @ =gSelectedOrderFromParty
ldr r4, _08120B74 @ =gActiveBank
ldrb r1, [r4]
lsls r1, 9
@ -73,7 +73,7 @@ _08120B10:
movs r2, 0
ldr r0, _08120B9C @ =gBattleTextBuff1
mov r8, r0
ldr r3, _08120B70 @ =gBufferedMoves
ldr r3, _08120B70 @ =gSelectedOrderFromParty
ldr r1, _08120BA4 @ =gBattleTextBuff2
mov r12, r1
ldr r5, _08120BA8 @ =gBattleTextBuff3
@ -111,7 +111,7 @@ _08120B64:
ldr r0, [r0]
mov pc, r0
.align 2, 0
_08120B70: .4byte gBufferedMoves
_08120B70: .4byte gSelectedOrderFromParty
_08120B74: .4byte gActiveBank
_08120B78: .4byte gUnknown_02023A64
_08120B7C: .4byte gLastUsedItem
@ -414,7 +414,7 @@ _08120DE4: .4byte gUnknown_08400622
_08120DE8:
mov r0, r10
bl sub_8121D1C
ldr r0, _08120E14 @ =gBufferedMoves
ldr r0, _08120E14 @ =gSelectedOrderFromParty
ldr r2, [r0]
ldrh r1, [r2]
movs r0, 0xB1
@ -433,7 +433,7 @@ _08120DE8:
bl StringCopy
b _08120E38
.align 2, 0
_08120E14: .4byte gBufferedMoves
_08120E14: .4byte gSelectedOrderFromParty
_08120E18: .4byte gBattleTextBuff2
_08120E1C: .4byte gUnknown_08401674
_08120E20: .4byte 0x02000000
@ -1368,7 +1368,7 @@ _081215E8:
.align 2, 0
_081215F4: .4byte gBattlePartyID
_081215F8:
ldr r0, _08121610 @ =gBufferedMoves
ldr r0, _08121610 @ =gSelectedOrderFromParty
ldr r2, [r0]
ldrh r1, [r2]
movs r0, 0xB1
@ -1380,14 +1380,14 @@ _081215F8:
adds r0, r2
b _08121634
.align 2, 0
_08121610: .4byte gBufferedMoves
_08121610: .4byte gSelectedOrderFromParty
_08121614: .4byte 0x02000000
_08121618: .4byte 0x000160a0
_0812161C:
ldrh r1, [r2]
b _08121652
_08121620:
ldr r0, _08121640 @ =gBufferedMoves
ldr r0, _08121640 @ =gSelectedOrderFromParty
ldr r2, [r0]
ldrh r1, [r2, 0x2]
movs r0, 0xB1
@ -1404,7 +1404,7 @@ _08121634:
adds r4, r0, r1
b _081219E6
.align 2, 0
_08121640: .4byte gBufferedMoves
_08121640: .4byte gSelectedOrderFromParty
_08121644: .4byte 0x02000000
_08121648: .4byte 0x000160a0
_0812164C: .4byte gUnknown_08401674
@ -2274,7 +2274,7 @@ sub_8121D1C: @ 8121D1C
push {r4,r5,lr}
adds r4, r0, 0
movs r2, 0
ldr r5, _08121D50 @ =gBufferedMoves
ldr r5, _08121D50 @ =gSelectedOrderFromParty
ldr r3, _08121D54 @ =gUnknown_084016BC
_08121D26:
cmp r2, 0x4
@ -2299,7 +2299,7 @@ _08121D3C:
bl StringCopy
b _08121D68
.align 2, 0
_08121D50: .4byte gBufferedMoves
_08121D50: .4byte gSelectedOrderFromParty
_08121D54: .4byte gUnknown_084016BC
_08121D58: .4byte gUnknown_08400E5E
_08121D5C:
@ -2329,7 +2329,7 @@ _08121D7E:
cmp r0, 0xFF
bne _08121D7C
ldr r1, _08121DB4 @ =gUnknown_084016BC
ldr r5, _08121DB8 @ =gBufferedMoves
ldr r5, _08121DB8 @ =gSelectedOrderFromParty
movs r0, 0
lsls r0, 1
adds r2, r0, r1
@ -2356,7 +2356,7 @@ _08121DA8:
mov pc, r0
.align 2, 0
_08121DB4: .4byte gUnknown_084016BC
_08121DB8: .4byte gBufferedMoves
_08121DB8: .4byte gSelectedOrderFromParty
_08121DBC: .4byte _08121DC0
.align 2, 0
_08121DC0:

View File

@ -2324,7 +2324,7 @@ _08135750: .4byte 0x00000564
_08135754:
movs r2, 0
ldr r4, _0813576C @ =gSaveBlock2 + 0x565
ldr r3, _08135770 @ =gBufferedMoves
ldr r3, _08135770 @ =gSelectedOrderFromParty
_0813575A:
adds r0, r2, r4
adds r1, r2, r3
@ -2336,7 +2336,7 @@ _0813575A:
b _0813589A
.align 2, 0
_0813576C: .4byte gSaveBlock2 + 0x565
_08135770: .4byte gBufferedMoves
_08135770: .4byte gSelectedOrderFromParty
_08135774:
ldr r3, _081357C0 @ =0x00000564
adds r0, r5, r3
@ -2665,7 +2665,7 @@ _08135A10: .4byte 0x00000554
sub_8135A14: @ 8135A14
push {r4,lr}
movs r2, 0
ldr r4, _08135A34 @ =gBufferedMoves
ldr r4, _08135A34 @ =gSelectedOrderFromParty
ldr r3, _08135A38 @ =gSaveBlock2 + 0x565
_08135A1C:
adds r0, r2, r4
@ -2680,7 +2680,7 @@ _08135A1C:
pop {r0}
bx r0
.align 2, 0
_08135A34: .4byte gBufferedMoves
_08135A34: .4byte gSelectedOrderFromParty
_08135A38: .4byte gSaveBlock2 + 0x565
thumb_func_end sub_8135A14

File diff suppressed because it is too large Load Diff

View File

@ -1,56 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnknown_084017B0:: @ 84017B0
.4byte OtherText_Summary, sub_812265C
.4byte OtherText_Enter2, sub_8122694
.4byte OtherText_NoEntry, sub_8122770
.4byte gUnknownText_Exit, sub_8122838
gUnknown_084017D0:: @ 84017D0
.byte 1, 0, 3
gUnknown_084017D3: @ 84017D3
.byte 2, 0, 3
gUnknown_084017D6: @ 84017D6
.byte 0, 3
.align 2
gUnknown_084017D8:: @ 84017D8
.byte 3, 9
.space 2
.4byte gUnknown_084017D0
.byte 3, 9
.space 2
.4byte gUnknown_084017D3
.byte 2, 9
.space 2
.4byte gUnknown_084017D6
.align 2
gUnknown_084017F0:: @ 84017F0
.4byte OtherText_Store, sub_8122F70
.4byte OtherText_Summary, sub_81230BC
.4byte gUnknownText_Exit, sub_81230F4
gUnknown_08401808:: @ 8401808
.byte 0, 1, 2
gUnknown_0840180B:: @ 840180B
.byte 1, 2
.align 2
gUnknown_08401810:: @ 8401810
.byte 3, 9
.space 2
.4byte gUnknown_08401808
.byte 2, 9
.space 2
.4byte gUnknown_0840180B

View File

@ -1,26 +1,9 @@
#ifndef GUARD_BATTLE_PARTY_MENU_H
#define GUARD_BATTLE_PARTY_MENU_H
#include "task.h"
// TODO: Unify all of the 0x0201B000 structs
struct Struct201B000
{
u8 filler0[0x259];
u8 unk259;
u8 filler25A[6];
u8 unk260;
u8 filler261[1];
u8 unk262;
s16 unk264;
s16 unk266;
};
extern u8 unk_2000000[];
#define EWRAM_1609D unk_2000000[0x1609D]
void SetUpBattlePokemonMenu(u8);
#define EWRAM_1609D unk_2000000[0x1609D]
#define EWRAM_1B000 (*(struct Struct201B000 *)(unk_2000000 + 0x1B000))
#endif

View File

@ -3,6 +3,11 @@
void sub_8121E10(void);
void sub_8121E34(void);
void sub_8123138(u8);
bool8 sub_8121E78(void);
void sub_81222B0(u8 taskId);
bool8 sub_8122854(void);
void sub_8122A48(u8 taskId);
void sub_8122E0C(u8 taskId);
void sub_8123138(u8 taskId);
#endif // GUARD_CHOOSE_PARTY_H

View File

@ -625,10 +625,11 @@ struct Pokedex
struct SaveBlock2_Sub
{
/*0x0000, 0x00A4*/ u8 filler_000[0x3D8];
/*0x0000, 0x00A8*/ u8 filler_000[0x3D8];
/*0x03D8, 0x0480*/ u16 var_480;
/*0x03DA, 0x0482*/ u16 var_482;
/*0x03DC, 0x0484*/ u8 filler_3DC[0xD1];
/*0x03DC, 0x0484*/ u8 filler_3DC[0xD0];
/*0x04AC, 0x0554*/ u8 var_4AC;
/*0x04AD, 0x0555*/ u8 var_4AD;
/*0x04AE, 0x0556*/ u8 var_4AE;
/*0x04AF, 0x0557*/ u8 var_4AF;

View File

@ -16,6 +16,44 @@ struct PartyPopupMenu
const u8 *unk4;
};
// TODO: Unify these two structs
#define DATA_COUNT (6)
struct Unk201B000
{
//u8 filler0[0x260];
struct Pokemon unk0[6];
u8 filler258[1];
u8 unk259;
u8 filler25A[6];
u8 unk260;
u8 unk261;
u8 unk262;
u8 unk263;
s16 unk264[DATA_COUNT * 2]; // This may be a union
u8 filler27C[2];
s16 unk27E;
s16 unk280;
s16 unk282;
};
struct Struct201B000
{
u8 filler0[0x259];
u8 unk259;
u8 filler25A[6];
u8 unk260;
u8 filler261[1];
u8 unk262;
s16 unk264;
s16 unk266;
};
extern u8 ewram[];
#define ewram1B000 (*(struct Unk201B000 *)(ewram + 0x1B000))
#define ewram1B000_alt (*(struct Struct201B000 *)(ewram + 0x1B000))
#define EWRAM_1B000 ewram1B000_alt
void sub_806AEDC(void);
void sub_806AF4C();
void OpenPartyMenu(u8, u8);

View File

@ -3,7 +3,7 @@
extern const u8 *const gNatureNames[];
void ShowPokemonSummaryScreen(struct Pokemon *, u8, u8, void (*)(u8), int);
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);
u8 sub_809FA30(void);

View File

@ -121,16 +121,16 @@ enum
/*0x73*/ SE_TB_KON,
/*0x74*/ SE_TB_KARA,
/*0x75*/ SE_BIDORO,
SE_W085,
SE_W085B,
SE_W231,
SE_W171,
SE_W233,
SE_W233B,
SE_W145,
SE_W145B,
SE_W145C,
SE_W240,
/*0x76*/ SE_W085,
/*0x77*/ SE_W085B,
/*0x78*/ SE_W231,
/*0x79*/ SE_W171,
/*0x7A*/ SE_W233,
/*0x7B*/ SE_W233B,
/*0x7C*/ SE_W145,
/*0x7D*/ SE_W145B,
/*0x7E*/ SE_W145C,
/*0x7F*/ SE_W240,
SE_W015,
SE_W081,
SE_W081B,

View File

@ -231,7 +231,7 @@ SECTIONS {
asm/battle_transition.o(.text);
src/battle_811DA74.o(.text);
asm/battle_message.o(.text);
asm/choose_party.o(.text);
src/choose_party.o(.text);
asm/cable_car.o(.text);
asm/roulette_util.o(.text);
asm/cable_car_util.o(.text);
@ -388,6 +388,7 @@ SECTIONS {
data/pokemon_menu.o(.rodata);
data/option_menu.o(.rodata);
src/pokedex.o(.rodata);
src/trainer_card.o(.rodata);
data/trainer_card.o(.rodata);
src/battle_party_menu.o(.rodata);
data/pokemon_storage_system.o(.rodata);
@ -447,7 +448,7 @@ SECTIONS {
data/battle_transition.o(.rodata);
data/battle_811DA74.o(.rodata);
data/battle_message.o(.rodata);
data/choose_party.o(.rodata);
src/choose_party.o(.rodata);
data/cable_car.o(.rodata);
src/save.o(.rodata);
data/field_effect_helpers.o(.rodata);

View File

@ -18,30 +18,43 @@
#include "task.h"
#include "text.h"
#define DATA_COUNT (6)
extern u8 ewram[];
struct Unk201B000
{
//u8 filler0[0x260];
struct Pokemon unk0[6];
u8 filler258[1];
u8 unk259;
u8 filler25A[6];
u8 unk260;
u8 unk261;
u8 filler262[2];
s16 unk264[DATA_COUNT * 2]; // This may be a union
u8 filler27C[2];
s16 unk27E;
s16 unk280;
s16 unk282;
};
#define ewram1B000 (*(struct Unk201B000 *)(ewram + 0x1B000))
#define UNK_201606C_ARRAY (ewram + 0x1606C) // lazy define but whatever.
extern u8 IsLinkDoubleBattle(void);
extern void TryCreatePartyMenuMonIcon(u8, u8, struct Pokemon *);
extern void LoadHeldItemIconGraphics(void);
extern void CreateHeldItemIcons_806DC34();
extern u8 sub_806BD58(u8, u8);
extern void PartyMenuPrintMonsLevelOrStatus(void);
extern void PrintPartyMenuMonNicknames(void);
extern void PartyMenuTryPrintMonsHP(void);
extern void nullsub_13(void);
extern void PartyMenuDrawHPBars(void);
extern u8 sub_806B58C(u8);
extern u8 GetItemEffectType();
extern void sub_806E750(u8, const struct PartyPopupMenu *, const struct PartyMenuItem *, int);
extern u16 sub_806BD80();
extern u8 sub_806CA38();
extern void sub_806D5A4(void);
extern void sub_802E414(void);
extern void sub_80A6DCC(void);
extern void sub_806AF4C();
extern u8 sub_80F9344(void);
extern u8 sub_806B124(void);
extern void sub_806C994();
extern void sub_806BF74();
extern void sub_806AEDC(void);
extern TaskFunc PartyMenuGetPopupMenuFunc(u8, const struct PartyPopupMenu *, const struct PartyMenuItem *, u8);
extern void sub_806E7D0(u8, const struct PartyPopupMenu *);
extern u8 *sub_8040D08();
extern void sub_8040B8C(void);
extern void sub_806E6F0();
extern void sub_806D538();
extern void nullsub_14();
extern void OpenPartyMenu();
extern u8 sub_803FBBC(void);
extern u16 gScriptItemId;
extern u8 gPlayerPartyCount;
extern u8 gNoOfAllBanks;
@ -562,7 +575,7 @@ static void Task_8095330(u8 taskId)
}
}
static void Task_809535C(u8 taskId)
static void Task_809535C(void)
{
gPaletteFade.bufferTransferDisabled = TRUE;
sub_806AF4C(1, 0xFF, SetUpBattlePokemonMenu, 5);

1071
src/choose_party.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -23,6 +23,14 @@
#include "string_util.h"
#include "strings.h"
#include "task.h"
#include "sprite.h"
#include "palette.h"
#include "event_data.h"
#include "main.h"
#include "item.h"
#include "battle_interface.h"
#include "species.h"
#include "party_menu.h"
#define DATA_COUNT (6)
@ -33,19 +41,6 @@ struct Unk2001000
u8 unk2;
};
struct Unk201B000
{
u8 filler0[0x260];
u8 unk260;
u8 unk261;
u8 filler262[2];
s16 unk264[DATA_COUNT * 2]; // This may be a union
u8 filler27C[2];
s16 unk27E;
s16 unk280;
s16 unk282;
};
struct Unk201C000
{
/*0x00*/ struct Pokemon *pokemon;
@ -74,7 +69,6 @@ struct UnknownStruct5
extern u8 ewram[];
#define ewram01000 (*(struct Unk2001000 *)(ewram + 0x01000))
#define ewram1B000 (*(struct Unk201B000 *)(ewram + 0x1B000))
#define ewram1C000 (*(struct Unk201C000 *)(ewram + 0x1C000))
#define ewram1F000 (*(struct Unk201F000 *)(ewram + 0x1F000))

View File

@ -31,7 +31,7 @@ extern struct SpriteTemplate gUnknown_02024E8C;
extern u8 gContestPlayerMonIndex;
extern u8 gIsLinkContest;
extern u8 gPlayerPartyCount;
extern u8 gBufferedMoves[];
extern u8 gSelectedOrderFromParty[];
extern u16 gSpecialVar_0x8004;
extern u16 gSpecialVar_0x8005;
@ -653,7 +653,7 @@ void sub_80C5568(void)
void sub_80C5580(void)
{
u8 var = gBufferedMoves[0];
u8 var = gSelectedOrderFromParty[0];
switch(var)
{
@ -676,7 +676,7 @@ void ChooseBattleTowerPlayerParty(void)
void SetBattleTowerPlayerParty(void)
{
u8 var = gBufferedMoves[0];
u8 var = gSelectedOrderFromParty[0];
switch(var)
{
@ -702,8 +702,8 @@ void ReducePlayerPartyToThree(void)
// copy the selected pokemon according to the order.
for(i = 0; i < 3; i++)
if(gBufferedMoves[i]) // as long as the order keeps going (did the player select 1 mon? 2? 3?), do not stop
party[i] = gPlayerParty[gBufferedMoves[i] - 1]; // index is 0 based, not literal
if(gSelectedOrderFromParty[i]) // as long as the order keeps going (did the player select 1 mon? 2? 3?), do not stop
party[i] = gPlayerParty[gSelectedOrderFromParty[i] - 1]; // index is 0 based, not literal
// delete the last 3 pokemon
CpuFill32(0, gPlayerParty, sizeof gPlayerParty);

View File

@ -3,6 +3,7 @@
#include "choose_party.h"
#include "contest.h"
#include "data2.h"
#include "party_menu.h"
#include "field_fadetransition.h"
#include "palette.h"
#include "party_menu.h"
@ -16,6 +17,8 @@
#include "task.h"
#include "text.h"
extern u8 gPlayerPartyCount;
extern u16 gSpecialVar_0x8004;
extern u16 gSpecialVar_0x8005;

View File

@ -928,7 +928,7 @@ gUnknown_0203926A: @ 203926A
gAbilitiesPerBank: @ 203926C
.space 0x4
gBufferedMoves: @ 2039270
gSelectedOrderFromParty: @ 2039270
.space 0x4
gUnknown_02039274: @ 2039274