sub_80E756C

This commit is contained in:
PikalaxALT 2017-11-04 11:16:07 -04:00
parent 411cb29f4a
commit 6c746425ed
3 changed files with 48 additions and 94 deletions

View File

@ -5,99 +5,6 @@
.text
thumb_func_start sub_80E756C
sub_80E756C: @ 80E756C
push {r4,r5,lr}
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
ldr r0, =gTasks
adds r5, r1, r0
movs r2, 0x8
ldrsh r1, [r5, r2]
adds r2, r0, 0
cmp r1, 0x4
bhi _080E7624
lsls r0, r1, 2
ldr r1, =_080E7598
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_080E7598:
.4byte _080E75AC
.4byte _080E75D0
.4byte _080E7624
.4byte _080E75E2
.4byte _080E760E
_080E75AC:
adds r0, r5, 0
adds r0, 0xC
bl sub_80E77FC
adds r1, r0, 0
movs r0, 0x10
ldrsh r2, [r5, r0]
movs r0, 0xC8
muls r0, r2
adds r1, r0
ldr r0, =gUnknown_020228C4
movs r2, 0xC8
bl memcpy
b _080E75FC
.pool
_080E75D0:
bl GetMultiplayerId
lsls r0, 24
cmp r0, 0
bne _080E75FC
movs r0, 0x1
bl sub_800A4D8
b _080E75FC
_080E75E2:
ldrh r0, [r5, 0x10]
adds r0, 0x1
strh r0, [r5, 0x10]
movs r1, 0x10
ldrsh r4, [r5, r1]
ldr r0, =gUnknown_0300115C
ldr r0, [r0]
movs r1, 0xC8
bl __udivsi3
adds r0, 0x1
cmp r4, r0
bne _080E7608
_080E75FC:
ldrh r0, [r5, 0x8]
adds r0, 0x1
strh r0, [r5, 0x8]
b _080E7624
.pool
_080E7608:
movs r0, 0
strh r0, [r5, 0x8]
b _080E7624
_080E760E:
movs r1, 0x1C
ldrsh r0, [r5, r1]
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r1, r2
ldrb r0, [r1, 0x4]
cmp r0, 0
bne _080E7624
ldr r0, =sub_80E77D4
str r0, [r5]
_080E7624:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80E756C
thumb_func_start sub_80E7630
sub_80E7630: @ 80E7630
push {r4-r7,lr}

View File

@ -6,6 +6,8 @@
#define QUEUE_CAPACITY 50
#define BLOCK_BUFFER_SIZE 0x100
#define gBlockSendBuffer gUnknown_020228C4 // FIXME
#define LINK_STAT_LOCAL_ID 0x00000003
#define LINK_STAT_PLAYER_COUNT 0x0000001C
#define LINK_STAT_PLAYER_COUNT_SHIFT 2
@ -197,5 +199,6 @@ bool32 sub_800A03C(void);
void sub_8009628(u8);
u8 sub_800AA48(void);
void sub_8009FAC(void);
void sub_800A4D8(u8);
#endif // GUARD_LINK_H

View File

@ -66,8 +66,10 @@ EWRAM_DATA struct PlayerRecords *gUnknown_0203A018 = NULL;
static void sub_80E715C(u8 taskId);
static void sub_80E7324(u8 taskId);
void sub_80E756C(u8 taskId);
static void sub_80E756C(u8 taskId);
void sub_80E7630(u8 taskId);
void sub_80E77D4(u8 taskId);
void *sub_80E77FC(s16 *asShort);
u8 sub_80E7810(void);
void sub_80E7808(struct PlayerRecords *records, s16 *a1);
void sub_80E78C4(OldMan *, size_t, u8);
@ -401,3 +403,45 @@ static void sub_80E7324(u8 taskId)
break;
}
}
static void sub_80E756C(u8 taskId)
{
struct Task *task;
void *dest;
task = &gTasks[taskId];
switch (task->data[0])
{
case 0:
dest = sub_80E77FC(&task->data[2]) + task->data[4] * 200;
memcpy(gBlockSendBuffer, dest, 200);
task->data[0] ++;
break;
case 1:
if (GetMultiplayerId() == 0)
{
sub_800A4D8(1);
}
task->data[0] ++;
break;
case 2:
break;
case 3:
task->data[4] ++;
if (task->data[4] == gUnknown_0300115C / 200 + 1)
{
task->data[0] ++;
}
else
{
task->data[0] = 0;
}
break;
case 4:
if (!gTasks[task->data[10]].isActive)
{
task->func = sub_80E77D4;
}
break;
}
}