From 253b3c2fa5e5bf2be1190ae1423d3132b252caf7 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 8 Dec 2017 08:24:54 -0500 Subject: [PATCH] sub_800EDD4 --- asm/link_rfu.s | 72 ---------------------------------------------- include/link_rfu.h | 4 ++- src/link_rfu.c | 40 +++++++++++++++++++++++++- 3 files changed, 42 insertions(+), 74 deletions(-) diff --git a/asm/link_rfu.s b/asm/link_rfu.s index b95a9e5c8..67a9d6225 100644 --- a/asm/link_rfu.s +++ b/asm/link_rfu.s @@ -5,78 +5,6 @@ .text - thumb_func_start sub_800EDD4 -sub_800EDD4: @ 800EDD4 - push {r4-r6,lr} - bl sub_800C048 - ldr r4, =gUnknown_03005000 - ldrb r0, [r4, 0xC] - cmp r0, 0x1 - bne _0800EDF0 - ldr r0, =sub_800E748 - b _0800EDF6 - .pool -_0800EDF0: - cmp r0, 0 - bne _0800EE18 - ldr r0, =sub_800E94C -_0800EDF6: - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0800EE38 - adds r0, r4, 0 - adds r0, 0x67 - ldrb r0, [r0] - bl DestroyTask - bl sub_800E604 - b _0800EE38 - .pool -_0800EE18: - cmp r0, 0x2 - bne _0800EE38 - ldr r0, =sub_800EB44 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0800EE38 - adds r0, r4, 0 - adds r0, 0x67 - ldrb r0, [r0] - bl DestroyTask - bl sub_800E604 -_0800EE38: - movs r5, 0 - ldr r6, =gUnknown_082ED7E0 -_0800EE3C: - lsls r0, r5, 2 - adds r0, r6 - ldr r4, [r0] - adds r0, r4, 0 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _0800EE5E - adds r0, r4, 0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_0800EE5E: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x2 - bls _0800EE3C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800EDD4 - thumb_func_start sub_800EE78 sub_800EE78: @ 800EE78 push {lr} diff --git a/include/link_rfu.h b/include/link_rfu.h index 641558444..d2cb554fd 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -142,7 +142,9 @@ struct UnkRfuStruct_2 { /* 0x00d */ u8 playerCount; /* 0x00e */ u8 filler_0e[6]; /* 0x014 */ u8 unk_14[4][14]; - /* 0x04c */ u8 unk_4c[2][14]; + /* 0x04c */ u8 unk_4c[14]; + /* 0x05a */ u8 filler_5a[13]; + /* 0x067 */ u8 unk_67; /* 0x068 */ u8 filler_68[4]; /* 0x06c */ struct UnkRfuStruct_2_Sub_6c unk_6c; /* 0x080 */ struct UnkRfuStruct_2_Sub_6c unk_80[5]; diff --git a/src/link_rfu.c b/src/link_rfu.c index 4e86c81fb..ef4614194 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -2732,7 +2732,7 @@ void sub_800ED34(u16 unused) for (i = 0; i < 14; i++) { - gUnknown_03005000.unk_4c[0][i] = 0; + gUnknown_03005000.unk_4c[i] = 0; } rfu_REQ_recvData(); rfu_waitREQComplete(); @@ -2752,3 +2752,41 @@ static void sub_800EDBC(u16 unused) { gUnknown_03005000.unk_cdb = 1; } + +void sub_800EDD4(void) +{ + u8 i; + + sub_800C048(); + if (gUnknown_03005000.unk_0c == 1) + { + if (FuncIsActiveTask(sub_800E748) == TRUE) + { + DestroyTask(gUnknown_03005000.unk_67); + sub_800E604(); + } + } + else if (gUnknown_03005000.unk_0c == 0) + { + if (FuncIsActiveTask(sub_800E94C) == TRUE) + { + DestroyTask(gUnknown_03005000.unk_67); + sub_800E604(); + } + } + else if (gUnknown_03005000.unk_0c == 2) + { + if (FuncIsActiveTask(sub_800EB44) == TRUE) + { + DestroyTask(gUnknown_03005000.unk_67); + sub_800E604(); + } + } + for (i = 0; i < 3; i++) + { + if (FuncIsActiveTask(gUnknown_082ED7E0[i]) == TRUE) + { + DestroyTask(FindTaskIdByFunc(gUnknown_082ED7E0[i])); + } + } +}