through sub_80259FC

This commit is contained in:
scnorton 2019-03-25 15:26:23 -04:00
parent c3e26a58df
commit e3a11bc3ca
3 changed files with 158 additions and 435 deletions

View file

@ -5,436 +5,6 @@
.text
thumb_func_start sub_802589C
sub_802589C: @ 802589C
push {r4,r5,lr}
lsls r0, 24
lsrs r5, r0, 24
ldr r1, =gUnknown_02022C98
ldr r0, [r1]
ldrb r0, [r0, 0x10]
adds r4, r1, 0
cmp r0, 0x1
beq _080258C8
cmp r0, 0x1
bgt _080258BC
cmp r0, 0
beq _080258C2
b _080258E0
.pool
_080258BC:
cmp r0, 0x2
beq _080258CE
b _080258E0
_080258C2:
bl sub_8026264
b _080258D2
_080258C8:
bl sub_80286E4
b _080258D6
_080258CE:
bl sub_8028828
_080258D2:
cmp r0, 0x1
bne _08025904
_080258D6:
ldr r1, [r4]
ldrb r0, [r1, 0x10]
adds r0, 0x1
strb r0, [r1, 0x10]
b _08025904
_080258E0:
ldr r0, [r4]
adds r0, 0x20
ldrb r0, [r0]
cmp r0, 0
beq _080258F8
ldr r0, =sub_8024D4C
bl sub_802621C
b _080258FE
.pool
_080258F8:
ldr r0, =sub_8024D84
bl sub_802621C
_080258FE:
adds r0, r5, 0
bl DestroyTask
_08025904:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_802589C
thumb_func_start sub_8025910
sub_8025910: @ 8025910
push {r4-r6,lr}
lsls r0, 24
lsrs r6, r0, 24
lsls r0, r6, 2
adds r0, r6
lsls r0, 3
ldr r1, =gTasks + 0x8
adds r5, r0, r1
movs r0, 0
ldrsh r4, [r5, r0]
cmp r4, 0x1
beq _0802596C
cmp r4, 0x1
bgt _08025938
cmp r4, 0
beq _0802593E
b _080259E8
.pool
_08025938:
cmp r4, 0x2
beq _0802597E
b _080259E8
_0802593E:
ldr r6, =gUnknown_02022C98
ldr r1, [r6]
adds r0, r1, 0
adds r0, 0x28
ldrb r0, [r0]
lsls r0, 2
ldr r2, =0x0000318c
adds r0, r2
adds r1, r0
movs r0, 0
movs r2, 0x1
bl SendBlock
lsls r0, 24
cmp r0, 0
beq _080259E8
ldr r0, [r6]
strb r4, [r0, 0x8]
b _08025976
.pool
_0802596C:
bl IsLinkTaskFinished
lsls r0, 24
cmp r0, 0
beq _080259E8
_08025976:
ldrh r0, [r5]
adds r0, 0x1
strh r0, [r5]
b _080259E8
_0802597E:
bl sub_8025170
cmp r0, 0
beq _080259C4
movs r2, 0
ldr r1, =gUnknown_02022C98
ldr r0, [r1]
adds r0, 0x24
ldrb r0, [r0]
cmp r2, r0
bcs _080259C4
adds r3, r1, 0
ldr r5, =gBlockRecvBuffer
ldr r4, =0x0000318c
_0802599A:
ldr r0, [r3]
lsls r1, r2, 2
adds r1, r0
adds r1, r4
lsls r0, r2, 8
adds r0, r5
ldrb r0, [r0]
strb r0, [r1]
ldr r1, [r3]
adds r0, r1, 0
adds r0, 0x24
ldrb r0, [r0]
strb r0, [r1, 0x8]
adds r0, r2, 0x1
lsls r0, 24
lsrs r2, r0, 24
ldr r0, [r3]
adds r0, 0x24
ldrb r0, [r0]
cmp r2, r0
bcc _0802599A
_080259C4:
ldr r4, =gUnknown_02022C98
ldr r0, [r4]
adds r1, r0, 0
adds r1, 0x24
ldrb r0, [r0, 0x8]
ldrb r1, [r1]
cmp r0, r1
bcc _080259E8
adds r0, r6, 0
bl DestroyTask
movs r0, 0x6
bl sub_80292E0
ldr r1, [r4]
ldrb r0, [r1, 0x10]
adds r0, 0x1
strb r0, [r1, 0x10]
_080259E8:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_8025910
thumb_func_start sub_80259FC
sub_80259FC: @ 80259FC
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x18
ldr r6, =gUnknown_02022C98
ldr r0, [r6]
adds r1, r0, 0
adds r1, 0x24
ldrb r7, [r1]
ldr r2, =0x000031a0
adds r1, r0, r2
ldr r3, =0x000031cc
adds r2, r0, r3
ldr r4, =0x00003208
adds r3, r0, r4
ldr r5, =0x00003244
adds r4, r0, r5
str r4, [sp]
adds r5, 0x3C
adds r4, r0, r5
str r4, [sp, 0x4]
adds r5, 0x3C
adds r4, r0, r5
str r4, [sp, 0x8]
adds r4, r0, 0
adds r4, 0x40
str r4, [sp, 0xC]
movs r5, 0x90
lsls r5, 1
adds r4, r0, r5
str r4, [sp, 0x10]
movs r4, 0x96
lsls r4, 1
adds r0, r4
str r0, [sp, 0x14]
movs r0, 0
bl sub_8028164
ldr r1, [r6]
ldr r5, =0x000031b0
adds r2, r1, r5
str r0, [r2]
movs r0, 0x94
lsls r0, 1
adds r1, r0
movs r0, 0x1
strb r0, [r1]
movs r5, 0x1
cmp r5, r7
bcs _08025AA4
_08025A60:
ldr r1, [r6]
adds r0, r1, 0
adds r0, 0xA8
adds r0, r5
ldrb r0, [r0]
cmp r0, 0
bne _08025A9A
lsls r0, r5, 4
subs r0, r5
lsls r4, r0, 2
adds r1, r4, r1
ldr r2, =0x000031cc
adds r1, r2
adds r0, r5, 0
bl sub_8028318
adds r1, r0, 0
cmp r1, 0
bne _08025A9A
ldr r0, [r6]
adds r0, r4
ldr r3, =0x000031cc
adds r0, r3
strb r1, [r0]
ldr r0, [r6]
movs r4, 0x94
lsls r4, 1
adds r0, r4
strb r1, [r0]
_08025A9A:
adds r0, r5, 0x1
lsls r0, 24
lsrs r5, r0, 24
cmp r5, r7
bcc _08025A60
_08025AA4:
ldr r5, =gUnknown_02022C98
ldr r1, [r5]
movs r6, 0x92
lsls r6, 1
adds r1, r6
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
lsls r0, 24
lsrs r0, 24
cmp r0, 0x3B
bls _08025B02
ldr r1, [r5]
movs r2, 0x94
lsls r2, 1
adds r0, r1, r2
ldrb r4, [r0]
cmp r4, 0
beq _08025AF0
bl sub_8011AC8
ldr r0, [r5]
adds r0, r6
movs r1, 0
strb r1, [r0]
b _08025B02
.pool
_08025AF0:
adds r0, r1, r6
ldrb r0, [r0]
cmp r0, 0x46
bls _08025B02
bl sub_8011AC8
ldr r0, [r5]
adds r0, r6
strb r4, [r0]
_08025B02:
movs r5, 0
cmp r5, r7
bcs _08025BF6
ldr r3, =0x000031cc
mov r12, r3
ldr r4, =gUnknown_02022C98
mov r8, r4
_08025B10:
mov r6, r8
ldr r2, [r6]
lsls r0, r5, 4
subs r1, r0, r5
lsls r1, 2
adds r1, r2, r1
add r1, r12
ldrb r1, [r1]
adds r6, r0, 0
cmp r1, 0
beq _08025B36
adds r0, r2, 0
adds r0, 0xA8
adds r1, r0, r5
ldrb r0, [r1]
cmp r0, 0
bne _08025B36
movs r0, 0x1
strb r0, [r1]
_08025B36:
adds r3, r4, 0
ldr r1, [r3]
adds r0, r1, 0
adds r0, 0xA8
adds r0, r5
ldrb r0, [r0]
cmp r0, 0x3
bgt _08025B54
cmp r0, 0x1
bge _08025B5A
b _08025BEC
.pool
_08025B54:
cmp r0, 0x4
beq _08025BA8
b _08025BEC
_08025B5A:
adds r1, 0xB0
adds r1, r5
ldrb r0, [r1]
adds r0, 0x1
movs r2, 0
strb r0, [r1]
lsls r0, 24
lsrs r0, 24
cmp r0, 0x5
bls _08025BEC
ldr r0, [r3]
adds r0, 0xB0
adds r0, r5
strb r2, [r0]
ldr r0, [r3]
adds r0, 0xA8
adds r0, r5
strb r2, [r0]
ldr r0, [r3]
subs r1, r6, r5
lsls r1, 2
adds r0, r1
add r0, r12
strb r2, [r0]
ldr r0, [r3]
adds r0, r1
ldr r6, =0x000031d0
adds r0, r6
strb r2, [r0]
ldr r0, [r3]
adds r0, r1
ldr r1, =0x000031d4
adds r0, r1
b _08025BEA
.pool
_08025BA8:
adds r1, 0xB0
adds r1, r5
ldrb r0, [r1]
adds r0, 0x1
movs r2, 0
strb r0, [r1]
lsls r0, 24
lsrs r0, 24
cmp r0, 0x27
bls _08025BEC
ldr r0, [r4]
adds r0, 0xB0
adds r0, r5
strb r2, [r0]
ldr r0, [r4]
adds r0, 0xA8
adds r0, r5
strb r2, [r0]
ldr r0, [r4]
subs r1, r6, r5
lsls r1, 2
adds r0, r1
add r0, r12
strb r2, [r0]
ldr r0, [r4]
adds r0, r1
ldr r3, =0x000031d0
adds r0, r3
strb r2, [r0]
ldr r0, [r4]
adds r0, r1
ldr r6, =0x000031d4
adds r0, r6
_08025BEA:
strb r2, [r0]
_08025BEC:
adds r0, r5, 0x1
lsls r0, 24
lsrs r5, r0, 24
cmp r5, r7
bcc _08025B10
_08025BF6:
add sp, 0x18
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_80259FC
thumb_func_start sub_8025C0C
sub_8025C0C: @ 8025C0C
push {r4-r7,lr}

View file

@ -284,5 +284,6 @@ bool8 sub_800DE7C(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx);
s32 sub_800E87C(u8 idx);
void sub_8011BA4(void);
void sub_8010198(void);
void sub_8011AC8(void);
#endif //GUARD_LINK_RFU_H

View file

@ -29,11 +29,15 @@ struct DodrioBerryPickingStruct_2022CF4
struct DodrioBerryPickingSubstruct_31A0
{
u8 unk_00[0x2C - 0x00];
u8 unk_00[0x10];
u32 unk_10;
u8 filler_14[0x18];
u8 unk_2C;
u8 filler_2D[3];
u8 unk_30;
u8 filler_31[11];
u8 filler_31[3];
u8 unk_34;
u8 filler_35[7];
}; // size = 0x3C
struct DodrioBerryPickingSubstruct_318C
@ -99,7 +103,10 @@ struct DodrioBerryPickingStruct
/*0x0118*/ u32 unk_0118;
/*0x011C*/ u32 unk_011C;
/*0x0120*/ u32 unk_0120;
/*0x0124*/ u8 filler_0124[8];
/*0x0124*/ u8 unk_0124;
/*0x0125*/ u8 filler_0125[3];
/*0x0128*/ u8 unk_0128;
// align 2
/*0x012C*/ u32 unk_012C;
/*0x0130*/ u32 unk_0130[5];
/*0x0144*/ u8 filler_0144[0x1C];
@ -152,6 +159,7 @@ void sub_80261F8(struct DodrioBerryPickingSubstruct_318C *, struct Pokemon *);
void sub_802620C(TaskFunc, u8);
void sub_802621C(TaskFunc);
void sub_8026240(u8);
bool32 sub_8026264(void);
void sub_80262C0(void);
void sub_802671C(void);
void sub_8026AF4(void);
@ -167,6 +175,8 @@ u8 sub_8027518(u8);
void sub_8027554(void);
void sub_8027608(void);
u32 sub_8027748(void);
u32 sub_8028164(u32 unused, struct DodrioBerryPickingSubstruct_31A0 *, u8 *, u8 *, u8 *, u8 *, u8 *, u8 *, u32 *, u32 *);
u32 sub_8028318(u8, u8 *);
void sub_80283A8(void);
void sub_8028408(struct DodrioBerryPickingSubstruct_318C *, u8, u8, u8);
void sub_8028504(u8);
@ -175,6 +185,8 @@ void sub_802868C(u8, u8);
void sub_8028734(void);
void sub_80287E4(void);
void sub_80289E8(u8);
void sub_80286E4(void);
bool32 sub_8028828(void);
void sub_8028A34(void);
void sub_8028A88(void);
void sub_8028B80(void);
@ -353,7 +365,7 @@ void sub_8024BC8(u8 taskId)
}
}
void sub_8024D4C(void)
void sub_8024D4C(u8 taskId)
{
sub_8025D04();
gUnknown_082F7AC4[gUnknown_02022C98->unk_0018]();
@ -364,7 +376,7 @@ void sub_8024D4C(void)
sub_8025D50();
}
void sub_8024D84(void)
void sub_8024D84(u8 taskId)
{
sub_8025E0C();
gUnknown_082F7AF4[gUnknown_02022C98->unk_0018]();
@ -947,3 +959,143 @@ void sub_8025758(void)
break;
}
}
void sub_802589C(u8 taskId)
{
switch (gUnknown_02022C98->unk_0010)
{
case 0:
if (sub_8026264() == 1)
{
gUnknown_02022C98->unk_0010++;
}
break;
case 1:
sub_80286E4();
gUnknown_02022C98->unk_0010++;
break;
case 2:
if (sub_8028828() == 1)
{
gUnknown_02022C98->unk_0010++;
}
break;
default:
if (gUnknown_02022C98->unk_0020 != 0)
{
sub_802621C(sub_8024D4C);
}
else
{
sub_802621C(sub_8024D84);
}
DestroyTask(taskId);
break;
}
}
void sub_8025910(u8 taskId)
{
s16 * data = gTasks[taskId].data;
u8 i;
switch (data[0])
{
case 0:
if (SendBlock(0, &gUnknown_02022C98->unk_318C[gUnknown_02022C98->multiplayerId].isShiny, sizeof(gUnknown_02022C98->unk_318C[gUnknown_02022C98->multiplayerId].isShiny)))
{
gUnknown_02022C98->unk_0008 = 0;
data[0]++;
}
break;
case 1:
if (IsLinkTaskFinished())
{
data[0]++;
}
break;
case 2:
if (sub_8025170())
{
for (i = 0; i < gUnknown_02022C98->unk_0024; i++)
{
*(u8 *)&gUnknown_02022C98->unk_318C[i] = *(u8 *)gBlockRecvBuffer[i];
gUnknown_02022C98->unk_0008 = gUnknown_02022C98->unk_0024;
}
}
if (gUnknown_02022C98->unk_0008 >= gUnknown_02022C98->unk_0024)
{
DestroyTask(taskId);
sub_80292E0(6);
gUnknown_02022C98->unk_0010++;
}
break;
}
}
void sub_80259FC(void)
{
u8 i;
u8 r7 = gUnknown_02022C98->unk_0024;
gUnknown_02022C98->unk_31A0[0].unk_10 = sub_8028164(0, &gUnknown_02022C98->unk_31A0[0], &gUnknown_02022C98->unk_31A0[0].unk_2C, &gUnknown_02022C98->unk_31A0[1].unk_2C, &gUnknown_02022C98->unk_31A0[2].unk_2C, &gUnknown_02022C98->unk_31A0[3].unk_2C, &gUnknown_02022C98->unk_31A0[4].unk_2C, &gUnknown_02022C98->unk_0040, &gUnknown_02022C98->unk_0120, &gUnknown_02022C98->unk_012C);
gUnknown_02022C98->unk_0128 = 1;
for (i = 1; i < r7; i++)
{
if ( gUnknown_02022C98->unk_00A8[i] == 0
&& sub_8028318(i, &gUnknown_02022C98->unk_31A0[i].unk_2C) == 0)
{
gUnknown_02022C98->unk_31A0[i].unk_2C = 0;
gUnknown_02022C98->unk_0128 = 0;
}
}
if (++gUnknown_02022C98->unk_0124 >= 60)
{
if (gUnknown_02022C98->unk_0128 != 0)
{
sub_8011AC8();
gUnknown_02022C98->unk_0124 = 0;
}
else if (gUnknown_02022C98->unk_0124 > 70)
{
sub_8011AC8();
gUnknown_02022C98->unk_0124 = 0;
}
}
for (i = 0; i < r7; i++)
{
if ( gUnknown_02022C98->unk_31A0[i].unk_2C != 0
&& gUnknown_02022C98->unk_00A8[i] == 0)
{
gUnknown_02022C98->unk_00A8[i] = 1;
}
switch (gUnknown_02022C98->unk_00A8[i])
{
case 0:
default:
break;
case 1 ... 3:
if (++gUnknown_02022C98->unk_00B0[i] >= 6)
{
gUnknown_02022C98->unk_00B0[i] = 0;
gUnknown_02022C98->unk_00A8[i] = 0;
gUnknown_02022C98->unk_31A0[i].unk_2C = 0;
gUnknown_02022C98->unk_31A0[i].unk_30 = 0;
gUnknown_02022C98->unk_31A0[i].unk_34 = 0;
}
break;
case 4:
if (++gUnknown_02022C98->unk_00B0[i] >= 40)
{
gUnknown_02022C98->unk_00B0[i] = 0;
gUnknown_02022C98->unk_00A8[i] = 0;
gUnknown_02022C98->unk_31A0[i].unk_2C = 0;
gUnknown_02022C98->unk_31A0[i].unk_30 = 0;
gUnknown_02022C98->unk_31A0[i].unk_34 = 0;
}
break;
}
}
}