sub_80E7830

This commit is contained in:
PikalaxALT 2017-11-04 12:03:50 -04:00
parent cd4aa5efe5
commit fb9e5cb3a4
2 changed files with 34 additions and 77 deletions

View file

@ -5,83 +5,6 @@
.text .text
thumb_func_start sub_80E7830
sub_80E7830: @ 80E7830
push {r4,lr}
adds r4, r0, 0
bl GetLinkPlayerCount
lsls r0, 24
lsrs r0, 24
cmp r0, 0x3
beq _080E7868
cmp r0, 0x3
bhi _080E784A
cmp r0, 0x2
beq _080E7850
b _080E78B8
_080E784A:
cmp r0, 0x4
beq _080E7894
b _080E78B8
_080E7850:
movs r3, 0
ldr r2, =gUnknown_0858CF8C
adds r1, r4, 0
_080E7856:
adds r0, r3, r2
ldrb r0, [r0]
stm r1!, {r0}
adds r3, 0x1
cmp r3, 0x1
bls _080E7856
b _080E78B8
.pool
_080E7868:
movs r0, 0
bl GetLinkPlayerTrainerId
adds r2, r0, 0
movs r0, 0x1
ands r2, r0
movs r3, 0
ldr r1, =gUnknown_0858CF8E
lsls r0, r2, 1
adds r0, r2
adds r1, r0, r1
adds r2, r4, 0
_080E7880:
ldrb r0, [r1]
stm r2!, {r0}
adds r1, 0x1
adds r3, 0x1
cmp r3, 0x2
bls _080E7880
b _080E78B8
.pool
_080E7894:
movs r0, 0
bl GetLinkPlayerTrainerId
movs r1, 0x9
bl __umodsi3
adds r2, r0, 0
movs r3, 0
ldr r1, =gUnknown_0858CF94
lsls r0, r2, 2
adds r1, r0, r1
adds r2, r4, 0
_080E78AC:
ldrb r0, [r1]
stm r2!, {r0}
adds r1, 0x1
adds r3, 0x1
cmp r3, 0x3
bls _080E78AC
_080E78B8:
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_80E7830
thumb_func_start sub_80E78C4 thumb_func_start sub_80E78C4
sub_80E78C4: @ 80E78C4 sub_80E78C4: @ 80E78C4
push {r4-r7,lr} push {r4-r7,lr}

View file

@ -94,6 +94,10 @@ void TaskDummy4(void *src);
// .rodata // .rodata
extern const u8 gUnknown_0858CF8C[];
extern const u8 gUnknown_0858CF8E[][3];
extern const u8 gUnknown_0858CF94[][4];
// .text // .text
void sub_80E6BE8(void) void sub_80E6BE8(void)
@ -541,3 +545,33 @@ static void *sub_80E7820(u8 id)
{ {
return gBlockRecvBuffer[id]; return gBlockRecvBuffer[id];
} }
void sub_80E7830(u32 *data)
{
u32 i;
u32 linkTrainerId;
switch ((u32)GetLinkPlayerCount())
{
case 2:
for (i = 0; i < 2; i ++)
{
data[i] = gUnknown_0858CF8C[i];
}
break;
case 3:
linkTrainerId = GetLinkPlayerTrainerId(0) % 2;
for (i = 0; i < 3; i ++)
{
data[i] = gUnknown_0858CF8E[linkTrainerId][i];
}
break;
case 4:
linkTrainerId = GetLinkPlayerTrainerId(0) % 9;
for (i = 0; i < 4; i ++)
{
data[i] = gUnknown_0858CF94[linkTrainerId][i];
}
break;
}
}