Match sub_801D220 also cuz why not

This commit is contained in:
Kermalis 2023-08-09 22:06:22 -04:00
parent 18bdbf6276
commit a869dda4a3
3 changed files with 80 additions and 228 deletions

View File

@ -1,207 +0,0 @@
#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start sub_801D220
sub_801D220:
push {r4-r7,lr}
mov r7, r9
mov r6, r8
push {r6,r7}
ldr r4, _0801D248
ldr r0, [r4]
adds r0, 0xB8
bl sub_8006518
ldr r0, [r4]
ldr r0, [r0, 0x10]
cmp r0, 0
beq _0801D250
cmp r0, 0x1
beq _0801D2C0
movs r2, 0
adds r7, r4, 0
ldr r3, _0801D24C
b _0801D368
.align 2, 0
_0801D248: .4byte gUnknown_203B250
_0801D24C: .4byte gUnknown_80DBE7C
_0801D250:
bl sub_801D4C0
ldr r0, [r4]
ldr r0, [r0]
cmp r0, 0
beq _0801D290
adds r7, r4, 0
ldr r0, _0801D288
mov r9, r0
mov r12, r7
ldr r2, _0801D28C
mov r8, r2
movs r3, 0
movs r2, 0x3
_0801D26C:
mov r4, r12
ldr r1, [r4]
adds r1, r3
adds r1, 0xB8
mov r0, r8
ldm r0!, {r4-r6}
stm r1!, {r4-r6}
ldm r0!, {r4-r6}
stm r1!, {r4-r6}
adds r3, 0x18
subs r2, 0x1
cmp r2, 0
bge _0801D26C
b _0801D2F6
.align 2, 0
_0801D288: .4byte gUnknown_80DBE98
_0801D28C: .4byte gUnknown_80DBE7C
_0801D290:
adds r7, r4, 0
mov r8, r7
ldr r6, _0801D2BC
mov r9, r6
movs r3, 0
movs r2, 0x3
_0801D29C:
mov r0, r8
ldr r1, [r0]
adds r1, r3
adds r1, 0xB8
mov r0, r9
ldm r0!, {r4-r6}
stm r1!, {r4-r6}
ldm r0!, {r4-r6}
stm r1!, {r4-r6}
movs r0, 0x18
add r9, r0
adds r3, 0x18
subs r2, 0x1
cmp r2, 0
bge _0801D29C
b _0801D34E
.align 2, 0
_0801D2BC: .4byte gUnknown_80DBEB0
_0801D2C0:
bl sub_801D4C0
ldr r0, [r4]
ldr r0, [r0]
cmp r0, 0
beq _0801D324
adds r7, r4, 0
ldr r2, _0801D31C
mov r9, r2
mov r8, r7
ldr r3, _0801D320
mov r12, r3
movs r3, 0
movs r2, 0x3
_0801D2DC:
mov r4, r8
ldr r1, [r4]
adds r1, r3
adds r1, 0xB8
mov r0, r12
ldm r0!, {r4-r6}
stm r1!, {r4-r6}
ldm r0!, {r4-r6}
stm r1!, {r4-r6}
adds r3, 0x18
subs r2, 0x1
cmp r2, 0
bge _0801D2DC
_0801D2F6:
ldr r1, [r7]
adds r1, 0xB8
mov r0, r9
ldm r0!, {r2,r5,r6}
stm r1!, {r2,r5,r6}
ldm r0!, {r3-r5}
stm r1!, {r3-r5}
ldr r1, [r7]
adds r0, r1, 0
adds r0, 0xB8
adds r1, 0x68
bl sub_8012CAC
ldr r0, [r7]
adds r0, 0xC4
movs r1, 0x9
strh r1, [r0]
b _0801D384
.align 2, 0
_0801D31C: .4byte gUnknown_80DBE98
_0801D320: .4byte gUnknown_80DBE7C
_0801D324:
adds r7, r4, 0
mov r8, r7
ldr r6, _0801D364
mov r9, r6
movs r3, 0
movs r2, 0x3
_0801D330:
mov r0, r8
ldr r1, [r0]
adds r1, r3
adds r1, 0xB8
mov r0, r9
ldm r0!, {r4-r6}
stm r1!, {r4-r6}
ldm r0!, {r4-r6}
stm r1!, {r4-r6}
movs r0, 0x18
add r9, r0
adds r3, 0x18
subs r2, 0x1
cmp r2, 0
bge _0801D330
_0801D34E:
ldr r1, [r7]
adds r0, r1, 0
adds r0, 0xB8
adds r1, 0x68
bl sub_8012CAC
ldr r0, [r7]
adds r0, 0xC4
movs r1, 0x8
strh r1, [r0]
b _0801D384
.align 2, 0
_0801D364: .4byte gUnknown_80DBEB0
_0801D368:
ldr r0, [r7]
lsls r1, r2, 1
adds r1, r2
lsls r1, 3
adds r0, r1
adds r0, 0xB8
adds r1, r3, 0
ldm r1!, {r4-r6}
stm r0!, {r4-r6}
ldm r1!, {r4-r6}
stm r0!, {r4-r6}
adds r2, 0x1
cmp r2, 0x3
ble _0801D368
_0801D384:
bl ResetUnusedInputStruct
ldr r0, _0801D3A4
ldr r0, [r0]
adds r0, 0xB8
movs r1, 0x1
movs r2, 0x1
bl sub_800641C
pop {r3,r4}
mov r8, r3
mov r9, r4
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_0801D3A4: .4byte gUnknown_203B250
thumb_func_end sub_801D220
.align 2,0

View File

@ -101,7 +101,6 @@ SECTIONS {
src/code_801AFA4.o(.text);
src/code_801B3C0.o(.text);
src/code_801C620.o(.text);
asm/code_801C620.o(.text);
src/code_801D760.o(.text);
asm/code_801D760.o(.text);
src/options_menu.o(.text);

View File

@ -30,28 +30,28 @@ struct unkStruct_203B238
struct UnkTextStruct2 unkC4[4];
};
// size: 0xC4
struct unkStruct_203B23C
{
// size: 0xC4
{
/* 0x0 */ s16 species;
/* 0x4 */ struct PokemonStruct *pokeStruct;
/* 0x8 */ u8 iqSkills[NUM_IQ_SKILLS];
/* 0x20 */ s32 numIQSkills;
/* 0x24 */ struct MenuInputStruct input;
u32 unk58;
/* 0x5C */ struct UnkTextStruct2 *unk5C;
/* 0x60 */ struct UnkTextStruct2 unk60[4];
struct UnkTextStruct2 *unk5C;
struct UnkTextStruct2 unk60[4];
u8 unkC0;
u8 unkC1;
u8 unkC2;
u8 unkC3;
};
// size: 0x94
struct unkStruct_203B240
{
// size: 0x94
s32 state;
u8 chosenIQSkill;
/* 0x0 */ s32 state;
/* 0x4 */ u8 chosenIQSkill;
s32 unk8;
s32 unkC;
struct subStruct_203B240 *unk10[2];
@ -62,30 +62,31 @@ struct unkStruct_203B240
struct MenuInputStructSub unk88;
};
// size: 0x554
struct unkStruct_203B244
{
// size: 0x554
u32 unk0;
u8 itemIDs[NUMBER_OF_ITEM_IDS];
/* 0x4 */ u8 itemIDs[NUMBER_OF_ITEM_IDS];
u32 unkF4[NUMBER_OF_ITEM_IDS];
struct MenuInputStruct input;
/* 0x4B4 */ struct MenuInputStruct input;
u32 unk4E8;
struct UnkTextStruct2 * unk4EC;
struct UnkTextStruct2 unk4F0[4];
u8 unk550[4];
};
// size: 118
struct unk_203B250
{
struct PokemonStruct *pokeStruct;
s16 index;
/* 0x0 */ struct PokemonStruct *pokeStruct;
/* 0x4 */ s16 index;
/* 0x6 */ u8 currFriendAreaLocation; // 0 when not in a friend area
u8 unk7;
u8 unk8;
u8 unk9;
struct PokemonStruct *unkC;
u32 state;
u32 menuAction;
/* 0x10 */ u32 state;
/* 0x14 */ u32 menuAction;
struct MenuStruct unk18;
struct MenuItem unk68[8];
u16 unkA8[8];
@ -99,6 +100,7 @@ extern struct PokemonStruct *GetPlayerPokemonStruct(void);
extern u8 sub_8002658(s16);
extern s16 sub_80A5728(void);
extern void sub_801D208(u32);
extern void sub_801D4C0(void);
extern void sub_801D680(void);
extern void sub_801D760(void);
extern void sub_801D77C(void);
@ -113,11 +115,14 @@ s16 sub_80A7AE8(s32);
extern struct PokemonStruct *sub_808D3F8(void);
extern const struct UnkTextStruct2 gUnknown_80DBE54;
extern struct UnkTextStruct2 gUnknown_80DBDD8;
extern struct UnkTextStruct2 gUnknown_80DBDF0;
extern struct UnkTextStruct2 gUnknown_80DBDB0;
extern struct UnkTextStruct2 gUnknown_80DBD98;
extern struct UnkTextStruct2 gUnknown_80DBE3C;
extern const struct UnkTextStruct2 gUnknown_80DBDD8;
extern const struct UnkTextStruct2 gUnknown_80DBDF0;
extern const struct UnkTextStruct2 gUnknown_80DBDB0;
extern const struct UnkTextStruct2 gUnknown_80DBD98;
extern const struct UnkTextStruct2 gUnknown_80DBE3C;
extern const struct UnkTextStruct2 gUnknown_80DBE7C;
extern const struct UnkTextStruct2 gUnknown_80DBE98;
extern const struct UnkTextStruct2 gUnknown_80DBEB0[4];
extern struct unkStruct_203B238 *gUnknown_203B238;
extern struct unkStruct_203B23C *gUnknown_203B23C;
@ -181,7 +186,7 @@ void sub_801C118(void);
void sub_801C1A0(void);
void sub_801C228(void);
extern void sub_801D220(void);
void sub_801D220(void);
extern void sub_801D3A8(void);
@ -1208,3 +1213,58 @@ void sub_801D208(u32 newState)
sub_801D220();
sub_801D3A8();
}
void sub_801D220(void)
{
s32 i;
sub_8006518(gUnknown_203B250->unkB8);
switch (gUnknown_203B250->state) {
case 0:
sub_801D4C0();
if (gUnknown_203B250->pokeStruct != NULL) {
for (i = 0; i < 4; i++)
gUnknown_203B250->unkB8[i] = gUnknown_80DBE7C;
gUnknown_203B250->unkB8[0] = gUnknown_80DBE98;
sub_8012CAC(gUnknown_203B250->unkB8, gUnknown_203B250->unk68);
gUnknown_203B250->unkB8[0].unkC = 9;
}
else {
for (i = 0; i < 4; i++)
gUnknown_203B250->unkB8[i] = gUnknown_80DBEB0[i];
sub_8012CAC(gUnknown_203B250->unkB8, gUnknown_203B250->unk68);
gUnknown_203B250->unkB8[0].unkC = 8;
}
break;
case 1:
sub_801D4C0();
if (gUnknown_203B250->pokeStruct != NULL) {
for (i = 0; i < 4; i++)
gUnknown_203B250->unkB8[i] = gUnknown_80DBE7C;
gUnknown_203B250->unkB8[0] = gUnknown_80DBE98;
sub_8012CAC(gUnknown_203B250->unkB8, gUnknown_203B250->unk68);
gUnknown_203B250->unkB8[0].unkC = 9;
}
else {
for (i = 0; i < 4; i++)
gUnknown_203B250->unkB8[i] = gUnknown_80DBEB0[i];
sub_8012CAC(gUnknown_203B250->unkB8, gUnknown_203B250->unk68);
gUnknown_203B250->unkB8[0].unkC = 8;
}
break;
default:
for (i = 0; i < 4; i++)
gUnknown_203B250->unkB8[i] = gUnknown_80DBE7C;
break;
}
ResetUnusedInputStruct();
sub_800641C(gUnknown_203B250->unkB8, 1, 1);
}