sub_8024BC8

This commit is contained in:
scnorton 2019-03-24 17:32:59 -04:00
parent 98ab62a7af
commit 2136187c11
4 changed files with 113 additions and 192 deletions

View File

@ -5,174 +5,6 @@
.text
thumb_func_start sub_8024BC8
sub_8024BC8: @ 8024BC8
push {r4,r5,lr}
sub sp, 0x4
lsls r0, 24
lsrs r1, r0, 24
ldr r0, =gUnknown_02022C98
ldr r0, [r0]
ldrb r0, [r0, 0xC]
cmp r0, 0x7
bls _08024BDC
b _08024D34
_08024BDC:
lsls r0, 2
ldr r1, =_08024BF0
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_08024BF0:
.4byte _08024C10
.4byte _08024C24
.4byte _08024C4C
.4byte _08024C5A
.4byte _08024C80
.4byte _08024CD4
.4byte _08024CE6
.4byte _08024D10
_08024C10:
movs r0, 0
bl SetVBlankCallback
ldr r0, =sub_8025910
movs r1, 0x4
bl sub_802620C
b _08024D20
.pool
_08024C24:
ldr r0, =sub_8025910
bl FuncIsActiveTask
lsls r0, 24
cmp r0, 0
beq _08024C32
b _08024D40
_08024C32:
ldr r4, =gUnknown_02022C98
ldr r0, [r4]
movs r1, 0xB0
lsls r1, 1
adds r0, r1
bl sub_8029274
ldr r1, [r4]
b _08024D24
.pool
_08024C4C:
bl sub_802A770
cmp r0, 0
bne _08024D40
bl sub_8010434
b _08024D20
_08024C5A:
bl IsLinkTaskFinished
lsls r0, 24
cmp r0, 0
beq _08024D40
ldr r0, =gReceivedRemoteLinkPlayers
ldrb r0, [r0]
cmp r0, 0
beq _08024D20
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl CreateWirelessStatusIndicatorSprite
b _08024D20
.pool
_08024C80:
ldr r0, =gUnknown_02022C98
ldr r0, [r0]
adds r0, 0x24
ldrb r5, [r0]
bl sub_80283A8
movs r4, 0
cmp r4, r5
bcs _08024CBA
_08024C92:
ldr r0, =gUnknown_02022C98
ldr r1, [r0]
adds r0, r1, 0
adds r0, 0x34
adds r0, r4
ldrb r2, [r0]
lsls r0, r2, 2
ldr r3, =0x0000318c
adds r0, r3
adds r0, r1, r0
adds r1, 0x24
ldrb r3, [r1]
adds r1, r4, 0
bl sub_8028408
adds r0, r4, 0x1
lsls r0, 24
lsrs r4, r0, 24
cmp r4, r5
bcc _08024C92
_08024CBA:
ldr r4, =gUnknown_02022C98
ldr r0, [r4]
adds r0, 0x24
ldrb r1, [r0]
movs r0, 0
bl sub_802868C
ldr r1, [r4]
b _08024D24
.pool
_08024CD4:
bl sub_8028A34
bl sub_8028A88
bl sub_8028D44
bl sub_8028734
b _08024D20
_08024CE6:
movs r4, 0x1
negs r4, r4
adds r0, r4, 0
movs r1, 0x10
movs r2, 0
bl BlendPalettes
movs r0, 0
str r0, [sp]
adds r0, r4, 0
movs r1, 0
movs r2, 0x10
movs r3, 0
bl BeginNormalPaletteFade
ldr r0, =sub_80261E4
bl SetVBlankCallback
b _08024D20
.pool
_08024D10:
bl UpdatePaletteFade
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _08024D40
_08024D20:
ldr r0, =gUnknown_02022C98
ldr r1, [r0]
_08024D24:
ldrb r0, [r1, 0xC]
adds r0, 0x1
strb r0, [r1, 0xC]
b _08024D40
.pool
_08024D34:
adds r0, r1, 0
bl DestroyTask
ldr r0, =sub_802589C
bl sub_802621C
_08024D40:
add sp, 0x4
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_8024BC8
thumb_func_start sub_8024D4C
sub_8024D4C: @ 8024D4C
push {lr}

View File

@ -4,4 +4,4 @@ OBJDUMP="$DEVKITARM/bin/arm-none-eabi-objdump -D -bbinary -marmv4t -Mforce-thumb
OPTIONS="--start-address=$(($1)) --stop-address=$(($1 + $2))"
$OBJDUMP $OPTIONS baserom.gba > baserom.dump
$OBJDUMP $OPTIONS pokeemerald.gba > pokeemerald.dump
diff baserom.dump pokeemerald.dump
diff -u baserom.dump pokeemerald.dump

View File

@ -1,16 +1,28 @@
#include "global.h"
#include "alloc.h"
#include "palette.h"
#include "link.h"
#include "link_rfu.h"
#include "task.h"
#include "main.h"
#include "constants/songs.h"
#include "sound.h"
struct DodrioBerryPickingSubstruct_004A
struct DodrioBerryPickingSubstruct_0160
{
/*0x00*/ u16 unk00;
/*0x02*/ u8 filler02[10];
}; // size = 0x0C
/*0x0000 : 0x0160*/ u8 filler_000[12];
/*0x000C : 0x016C*/ u8 unk_00C;
/*0x000D : 0x016D*/ u8 filler_00D[0x3000 - 0xd];
/*0x3000 : 0x3160*/ u32 unk_3000;
/*0x3004 : 0x3164*/ u8 filler_3004[16];
/*0x3014 : 0x3174*/ u8 unk_3014;
/*0x3015 : 0x3175*/ u8 filler_3015[0x318C - 0x3175];
}; // size = 0x302C
struct DodrioBerryPickingStruct_2022CF4
{
u8 filler_00[0x40];
}; // size = 0x40
struct DodrioBerryPickingSubstruct_31A0
{
@ -77,7 +89,8 @@ struct DodrioBerryPickingStruct
/*0x0124*/ u8 filler_0124[8];
/*0x012C*/ u32 unk_012C;
/*0x0130*/ u32 unk_0130[5];
/*0x0144*/ u8 filler_0144[0x318C - 0x0144];
/*0x0144*/ u8 filler_0144[0x1C];
/*0x0160*/ struct DodrioBerryPickingSubstruct_0160 unk_0160;
/*0x318C*/ struct DodrioBerryPickingSubstruct_318C unk_318C[5];
/*0x31A0*/ struct DodrioBerryPickingSubstruct_31A0 unk_31A0[5];
/*0x32CC*/ struct DodrioBerryPickingSubstruct_31A0 unk_32CC;
@ -85,6 +98,13 @@ struct DodrioBerryPickingStruct
}; // size = 0x3330
EWRAM_DATA struct DodrioBerryPickingStruct * gUnknown_02022C98 = NULL;
EWRAM_DATA u16 * gUnknown_02022C9C[5] = {NULL};
EWRAM_DATA u16 * gUnknown_02022CB0[2] = {NULL};
EWRAM_DATA u16 * gUnknown_02022CB8[11] = {NULL};
EWRAM_DATA u16 * gUnknown_02022CE4[4] = {NULL};
EWRAM_DATA struct DodrioBerryPickingStruct_2022CF4 * gUnknown_02022CF4 = NULL;
EWRAM_DATA struct DodrioBerryPickingSubstruct_0160 * gUnknown_02022CF8 = NULL;
IWRAM_DATA bool32 gUnknown_03000DB0;
void sub_8024A1C(void);
@ -94,6 +114,20 @@ void sub_80261F8(struct DodrioBerryPickingSubstruct_318C *, struct Pokemon *);
void sub_80261CC(void);
void sub_8026B5C(u8, u8*, u8*);
void sub_80273F0(void);
void sub_8029274(struct DodrioBerryPickingSubstruct_0160 *);
void sub_8025910(u8 taskId);
void sub_802620C(TaskFunc, u8);
bool32 sub_802A770(void);
void sub_80283A8(void);
void sub_8028408(struct DodrioBerryPickingSubstruct_318C *, u8, u8, u8);
void sub_802868C(u8, u8);
void sub_8028A34(void);
void sub_8028A88(void);
void sub_8028D44(void);
void sub_8028734(void);
void sub_80261E4(void);
void sub_802621C(TaskFunc);
void sub_802589C(u8 taskId);
void sub_802493C(u16 a0, void (*a1)(void))
{
@ -181,3 +215,76 @@ void sub_8024A30(struct DodrioBerryPickingStruct * data)
data->unk_0034[i] %= data->unk_0024;
}
}
void sub_8024BC8(u8 taskId)
{
u8 r4, r5;
switch (gUnknown_02022C98->unk_000C)
{
case 0:
SetVBlankCallback(NULL);
sub_802620C(sub_8025910, 4);
gUnknown_02022C98->unk_000C++;
break;
case 1:
if (!FuncIsActiveTask(sub_8025910))
{
sub_8029274(&gUnknown_02022C98->unk_0160);
gUnknown_02022C98->unk_000C++;
}
break;
case 2:
if (!sub_802A770())
{
sub_8010434();
gUnknown_02022C98->unk_000C++;
}
break;
case 3:
if (IsLinkTaskFinished())
{
if (gReceivedRemoteLinkPlayers != 0)
{
sub_800E0E8();
CreateWirelessStatusIndicatorSprite(0, 0);
}
gUnknown_02022C98->unk_000C++;
}
break;
case 4:
r5 = gUnknown_02022C98->unk_0024;
sub_80283A8();
for (r4 = 0; r4 < r5; r4++)
{
sub_8028408(&gUnknown_02022C98->unk_318C[gUnknown_02022C98->unk_0034[r4]], r4, gUnknown_02022C98->unk_0034[r4], gUnknown_02022C98->unk_0024);
}
sub_802868C(0, gUnknown_02022C98->unk_0024);
gUnknown_02022C98->unk_000C++;
break;
case 5:
sub_8028A34();
sub_8028A88();
sub_8028D44();
sub_8028734();
gUnknown_02022C98->unk_000C++;
break;
case 6:
BlendPalettes(0xFFFFFFFF, 0x10, 0x00);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0);
SetVBlankCallback(sub_80261E4);
gUnknown_02022C98->unk_000C++;
break;
case 7:
UpdatePaletteFade();
if (!gPaletteFade.active)
{
gUnknown_02022C98->unk_000C++;
}
break;
default:
DestroyTask(taskId);
sub_802621C(sub_802589C);
break;
}
}

View File

@ -78,24 +78,6 @@ gUnknown_02022C94: @ 2022C94
.include "src/dodrio_berry_picking.o"
gUnknown_02022C9C: @ 2022C9C
.space 0x14
gUnknown_02022CB0: @ 2022CB0
.space 0x8
gUnknown_02022CB8: @ 2022CB8
.space 0x2C
gUnknown_02022CE4: @ 2022CE4
.space 0x10
gUnknown_02022CF4: @ 2022CF4
.space 0x4
gUnknown_02022CF8: @ 2022CF8
.space 0x4
gUnknown_02022CFC: @ 2022CFC
.space 0x4