trade.c up to sub_807A7E0

This commit is contained in:
Diegoisawesome 2018-12-24 20:18:06 -06:00
parent 2bca45bcf5
commit dea41e1a7e
2 changed files with 161 additions and 154 deletions

View File

@ -6,160 +6,6 @@
.text
thumb_func_start sub_807A7BC
sub_807A7BC: @ 807A7BC
push {lr}
lsls r0, 16
lsrs r2, r0, 16
lsls r1, 24
lsrs r1, 24
movs r0, 0xCD
lsls r0, 1
cmp r2, r0
beq _0807A7D2
cmp r2, 0x97
bne _0807A7DA
_0807A7D2:
cmp r1, 0
bne _0807A7DA
movs r0, 0x1
b _0807A7DC
_0807A7DA:
movs r0, 0
_0807A7DC:
pop {r1}
bx r1
thumb_func_end sub_807A7BC
thumb_func_start sub_807A7E0
sub_807A7E0: @ 807A7E0
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
ldr r4, [sp, 0x20]
ldr r5, [sp, 0x24]
ldr r6, [sp, 0x28]
lsls r2, 16
lsrs r7, r2, 16
lsls r3, 16
lsrs r3, 16
mov r8, r3
lsls r4, 24
lsrs r4, 24
lsls r5, 16
lsrs r5, 16
lsls r6, 24
lsrs r6, 24
lsls r2, r0, 23
lsrs r2, 31
mov r9, r2
lsls r0, 24
lsrs r2, r0, 31
lsls r0, r1, 23
lsrs r0, 31
mov r10, r0
lsls r0, r1, 24
lsrs r0, 31
lsls r1, 18
lsrs r1, 28
cmp r1, 0x3
beq _0807A832
cmp r2, 0
bne _0807A82A
movs r0, 0x8
b _0807A8C0
_0807A82A:
cmp r0, 0
bne _0807A832
movs r0, 0x9
b _0807A8C0
_0807A832:
adds r0, r5, 0
adds r1, r6, 0
bl sub_807A7BC
cmp r0, 0
bne _0807A898
movs r0, 0xCE
lsls r0, 1
cmp r8, r0
bne _0807A84E
cmp r7, r8
beq _0807A86C
movs r0, 0x2
b _0807A8C0
_0807A84E:
ldr r0, =gBaseStats
lsls r1, r7, 3
subs r1, r7
lsls r1, 2
adds r1, r0
ldrb r0, [r1, 0x6]
cmp r0, r4
beq _0807A86C
ldrb r0, [r1, 0x7]
cmp r0, r4
beq _0807A86C
movs r0, 0x1
b _0807A8C0
.pool
_0807A86C:
movs r0, 0xCE
lsls r0, 1
cmp r7, r0
bne _0807A87C
cmp r7, r8
beq _0807A87C
movs r0, 0x3
b _0807A8C0
_0807A87C:
mov r0, r9
cmp r0, 0
bne _0807A8AA
movs r0, 0xCE
lsls r0, 1
cmp r7, r0
bne _0807A88E
movs r0, 0x6
b _0807A8C0
_0807A88E:
adds r0, r7, 0
bl IsSpeciesInHoennDex
cmp r0, 0
bne _0807A89C
_0807A898:
movs r0, 0x4
b _0807A8C0
_0807A89C:
mov r0, r8
bl IsSpeciesInHoennDex
cmp r0, 0
bne _0807A8AA
movs r0, 0x5
b _0807A8C0
_0807A8AA:
mov r0, r10
cmp r0, 0
bne _0807A8BE
adds r0, r7, 0
bl IsSpeciesInHoennDex
cmp r0, 0
bne _0807A8BE
movs r0, 0x7
b _0807A8C0
_0807A8BE:
movs r0, 0
_0807A8C0:
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_807A7E0
thumb_func_start sub_807A8D0
sub_807A8D0: @ 807A8D0
push {r4-r6,lr}

View File

@ -3196,6 +3196,7 @@ u32 sub_807A5F4(struct Pokemon *a0, int a1, int a2)
}
}
#ifdef NONMATCHING
s32 sub_807A728(void)
{
int val;
@ -3242,3 +3243,163 @@ s32 sub_807A728(void)
}
return 0;
}
#else
NAKED
s32 sub_807A728(void)
{
asm_unified("push {r4-r7,lr}\n\
ldr r0, =gReceivedRemoteLinkPlayers\n\
ldrb r0, [r0]\n\
cmp r0, 0\n\
beq _0807A7B4\n\
movs r4, 0\n\
bl GetMultiplayerId\n\
ldr r5, =gLinkPlayers\n\
movs r7, 0x1\n\
eors r0, r7\n\
lsls r0, 24\n\
lsrs r0, 24\n\
lsls r1, r0, 3\n\
subs r1, r0\n\
lsls r1, 2\n\
adds r1, r5\n\
ldrb r1, [r1]\n\
subs r0, r1, 0x1\n\
lsls r0, 16\n\
lsrs r0, 16\n\
cmp r0, 0x2\n\
bls _0807A7B4\n\
subs r0, r1, 0x4\n\
lsls r0, 16\n\
lsrs r0, 16\n\
cmp r0, 0x1\n\
bhi _0807A762\n\
movs r4, 0x2\n\
_0807A762:\n\
cmp r4, 0\n\
ble _0807A7B4\n\
bl GetMultiplayerId\n\
lsls r0, 24\n\
lsrs r0, 24\n\
lsls r1, r0, 3\n\
subs r1, r0\n\
lsls r1, 2\n\
adds r1, r5\n\
ldrb r1, [r1, 0x12]\n\
movs r6, 0xF0\n\
adds r0, r6, 0\n\
ands r0, r1\n\
cmp r0, 0\n\
beq _0807A7B0\n\
cmp r4, 0x2\n\
bne _0807A7B4\n\
bl GetMultiplayerId\n\
eors r0, r7\n\
lsls r0, 24\n\
lsrs r0, 24\n\
lsls r1, r0, 3\n\
subs r1, r0\n\
lsls r1, 2\n\
adds r1, r5\n\
ldrb r1, [r1, 0x12]\n\
adds r0, r6, 0\n\
ands r0, r1\n\
cmp r0, 0\n\
bne _0807A7B4\n\
movs r0, 0x2\n\
b _0807A7B6\n\
.pool\n\
_0807A7B0:\n\
movs r0, 0x1\n\
b _0807A7B6\n\
_0807A7B4:\n\
movs r0, 0\n\
_0807A7B6:\n\
pop {r4-r7}\n\
pop {r1}\n\
bx r1");
}
#endif // NONMATCHING
bool32 sub_807A7BC(u16 a0, u8 a1)
{
if (a0 == SPECIES_DEOXYS || a0 == SPECIES_MEW)
{
if (!a1)
{
return TRUE;
}
}
return FALSE;
}
u32 sub_807A7E0(struct UnkLinkRfuStruct_02022B14Substruct a0, struct UnkLinkRfuStruct_02022B14Substruct a1, u16 a2, u16 a3, u8 a4, u16 a5, u8 a6)
{
u8 r9 = a0.unk_01_0;
u8 r2 = a0.unk_00_7;
u8 r10 = a1.unk_01_0;
u8 r0 = a1.unk_00_7;
u8 r1 = a1.unk_01_2;
if (r1 != 3)
{
if (!r2)
{
return 8;
}
else if (!r0)
{
return 9;
}
}
if (sub_807A7BC(a5, a6))
{
return 4;
}
if (a3 == SPECIES_EGG)
{
if (a2 != a3)
{
return 2;
}
}
else
{
if (gBaseStats[a2].type1 != a4 && gBaseStats[a2].type2 != a4)
{
return 1;
}
}
if (a2 == SPECIES_EGG && a2 != a3)
{
return 3;
}
if (!r9)
{
if (a2 == SPECIES_EGG)
{
return 6;
}
if (!IsSpeciesInHoennDex(a2))
{
return 4;
}
if (!IsSpeciesInHoennDex(a3))
{
return 5;
}
}
if (!r10 && !IsSpeciesInHoennDex(a2))
{
return 7;
}
return 0;
}