sub_80E7630

This commit is contained in:
PikalaxALT 2017-11-04 11:39:23 -04:00
parent 6c746425ed
commit d921e555d2
3 changed files with 47 additions and 152 deletions

View File

@ -5,157 +5,6 @@
.text
thumb_func_start sub_80E7630
sub_80E7630: @ 80E7630
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0xC
lsls r0, 24
lsrs r0, 24
str r0, [sp]
lsls r0, 2
ldr r1, [sp]
adds r0, r1
lsls r0, 3
ldr r1, =gTasks
adds r0, r1
mov r10, r0
bl GetBlockReceivedStatus
lsls r0, 24
lsrs r0, 24
str r0, [sp, 0x4]
movs r2, 0
str r2, [sp, 0x8]
bl sub_800A9D8
lsls r0, 24
lsrs r0, 24
ldr r3, [sp, 0x4]
cmp r3, r0
bne _080E773E
movs r4, 0
mov r8, r4
b _080E771C
.pool
_080E7678:
ldr r1, [sp, 0x4]
mov r0, r8
asrs r1, r0
movs r0, 0x1
ands r1, r0
movs r2, 0x1
add r2, r8
mov r9, r2
cmp r1, 0
beq _080E7714
mov r0, r10
adds r0, 0x12
bl sub_80E77FC
mov r3, r9
lsls r4, r3, 1
mov r5, r10
adds r5, 0x8
adds r4, r5, r4
movs r2, 0
ldrsh r1, [r4, r2]
movs r7, 0xC8
muls r1, r7
adds r0, r1
ldr r3, =gUnknown_0300115C
ldr r1, [r3]
mov r2, r8
muls r2, r1
adds r1, r2, 0
adds r6, r0, r1
mov r0, r8
bl sub_80E7820
adds r1, r0, 0
movs r3, 0
ldrsh r2, [r4, r3]
adds r0, r2, 0x1
muls r0, r7
ldr r4, =gUnknown_0300115C
ldr r3, [r4]
cmp r0, r3
bls _080E76DC
muls r2, r7
subs r2, r3, r2
adds r0, r6, 0
bl memcpy
b _080E76E4
.pool
_080E76DC:
adds r0, r6, 0
movs r2, 0xC8
bl memcpy
_080E76E4:
mov r0, r8
bl ResetBlockReceivedFlag
mov r0, r9
lsls r1, r0, 1
adds r1, r5, r1
ldrh r0, [r1]
adds r0, 0x1
strh r0, [r1]
movs r2, 0
ldrsh r4, [r1, r2]
ldr r3, =gUnknown_0300115C
ldr r0, [r3]
movs r1, 0xC8
bl __udivsi3
adds r0, 0x1
cmp r4, r0
bne _080E7714
ldr r0, [sp, 0x8]
adds r0, 0x1
lsls r0, 24
lsrs r0, 24
str r0, [sp, 0x8]
_080E7714:
mov r4, r9
lsls r0, r4, 24
lsrs r0, 24
mov r8, r0
_080E771C:
bl GetLinkPlayerCount
lsls r0, 24
lsrs r0, 24
cmp r8, r0
bcc _080E7678
ldr r2, =gTasks
mov r0, r10
movs r3, 0x8
ldrsh r1, [r0, r3]
lsls r0, r1, 2
adds r0, r1
lsls r0, 3
adds r0, r2
ldrh r1, [r0, 0x8]
adds r1, 0x1
strh r1, [r0, 0x8]
_080E773E:
bl GetLinkPlayerCount
lsls r0, 24
lsrs r0, 24
ldr r4, [sp, 0x8]
cmp r4, r0
bne _080E7752
ldr r0, [sp]
bl DestroyTask
_080E7752:
add sp, 0xC
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_80E7630
thumb_func_start sub_80E776C
sub_80E776C: @ 80E776C
push {r4,lr}

View File

@ -200,5 +200,6 @@ void sub_8009628(u8);
u8 sub_800AA48(void);
void sub_8009FAC(void);
void sub_800A4D8(u8);
u8 sub_800A9D8(void);
#endif // GUARD_LINK_H

View File

@ -67,10 +67,11 @@ EWRAM_DATA struct PlayerRecords *gUnknown_0203A018 = NULL;
static void sub_80E715C(u8 taskId);
static void sub_80E7324(u8 taskId);
static void sub_80E756C(u8 taskId);
void sub_80E7630(u8 taskId);
static void sub_80E7630(u8 taskId);
void sub_80E77D4(u8 taskId);
void *sub_80E77FC(s16 *asShort);
u8 sub_80E7810(void);
void *sub_80E7820(u8);
void sub_80E7808(struct PlayerRecords *records, s16 *a1);
void sub_80E78C4(OldMan *, size_t, u8);
void sub_80E7948(void *, size_t, u8);
@ -445,3 +446,47 @@ static void sub_80E756C(u8 taskId)
break;
}
}
static void sub_80E7630(u8 taskId)
{
struct Task *task;
u8 status;
u8 counter;
u8 i;
void *dest;
void *src;
task = &gTasks[taskId];
status = GetBlockReceivedStatus();
counter = 0;
if (status == sub_800A9D8())
{
for (i = 0; i < GetLinkPlayerCount(); i ++)
{
if ((status >> i) & 0x01)
{
dest = sub_80E77FC(&task->data[5]) + task->data[i + 1] * 200 + gUnknown_0300115C * i;
src = sub_80E7820(i);
if ((task->data[i + 1] + 1) * 200 > gUnknown_0300115C)
{
memcpy(dest, src, gUnknown_0300115C - task->data[i + 1] * 200);
}
else
{
memcpy(dest, src, 200);
}
ResetBlockReceivedFlag(i);
task->data[i + 1] ++;
if (task->data[i + 1] == gUnknown_0300115C / 200 + 1)
{
counter ++;
}
}
}
gTasks[task->data[0]].data[0] ++;
}
if (counter == GetLinkPlayerCount())
{
DestroyTask(taskId);
}
}