More link stuff, stumped on sub_807A728

This commit is contained in:
Diegoisawesome 2018-12-24 14:39:05 -06:00
parent 3f08e0c76c
commit 2bca45bcf5
2 changed files with 47 additions and 75 deletions

View File

@ -6,81 +6,6 @@
.text
thumb_func_start sub_807A728
sub_807A728: @ 807A728
push {r4-r7,lr}
ldr r0, =gReceivedRemoteLinkPlayers
ldrb r0, [r0]
cmp r0, 0
beq _0807A7B4
movs r4, 0
bl GetMultiplayerId
ldr r5, =gLinkPlayers
movs r7, 0x1
eors r0, r7
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 3
subs r1, r0
lsls r1, 2
adds r1, r5
ldrb r1, [r1]
subs r0, r1, 0x1
lsls r0, 16
lsrs r0, 16
cmp r0, 0x2
bls _0807A7B4
subs r0, r1, 0x4
lsls r0, 16
lsrs r0, 16
cmp r0, 0x1
bhi _0807A762
movs r4, 0x2
_0807A762:
cmp r4, 0
ble _0807A7B4
bl GetMultiplayerId
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 3
subs r1, r0
lsls r1, 2
adds r1, r5
ldrb r1, [r1, 0x12]
movs r6, 0xF0
adds r0, r6, 0
ands r0, r1
cmp r0, 0
beq _0807A7B0
cmp r4, 0x2
bne _0807A7B4
bl GetMultiplayerId
eors r0, r7
lsls r0, 24
lsrs r0, 24
lsls r1, r0, 3
subs r1, r0
lsls r1, 2
adds r1, r5
ldrb r1, [r1, 0x12]
adds r0, r6, 0
ands r0, r1
cmp r0, 0
bne _0807A7B4
movs r0, 0x2
b _0807A7B6
.pool
_0807A7B0:
movs r0, 0x1
b _0807A7B6
_0807A7B4:
movs r0, 0
_0807A7B6:
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_807A728
thumb_func_start sub_807A7BC
sub_807A7BC: @ 807A7BC
push {lr}

View File

@ -3195,3 +3195,50 @@ u32 sub_807A5F4(struct Pokemon *a0, int a1, int a2)
return 1;
}
}
s32 sub_807A728(void)
{
int val;
u8 version;
if (gReceivedRemoteLinkPlayers != 0)
{
val = 0;
version = (gLinkPlayers[GetMultiplayerId() ^ 1].version & 0xFF);
if (version == VERSION_RUBY ||
version == VERSION_SAPPHIRE ||
version == VERSION_EMERALD)
{
// this value could actually be anything 0 or less
val = 0;
}
else if (version == VERSION_FIRE_RED ||
version == VERSION_LEAF_GREEN)
{
val = 2;
}
if (val > 0)
{
if (gLinkPlayers[GetMultiplayerId()].name[10] & 0xF0)
{
if (val == 2)
{
if (gLinkPlayers[GetMultiplayerId() ^ 1].name[10] & 0xF0)
{
return 0;
}
else
{
return 2;
}
}
}
else
{
return 1;
}
}
}
return 0;
}