From 263fbdb2c1500aac078c9b36883bb39eefb77acf Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 10 Nov 2017 19:37:38 -0500 Subject: [PATCH] through sub_800A388 --- asm/link.s | 64 ------------------------------------------------------ src/link.c | 33 ++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 66 deletions(-) diff --git a/asm/link.s b/asm/link.s index 828e9f8b3c..830fa17901 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,70 +5,6 @@ .text - thumb_func_start sub_800A364 -sub_800A364: @ 800A364 - push {lr} - ldr r1, =gUnknown_03000D50 - ldr r0, [r1] - adds r0, 0x1 - str r0, [r1] - cmp r0, 0x2 - bls _0800A378 - ldr r1, =gUnknown_03003140 - ldr r0, =sub_800A388 - str r0, [r1] -_0800A378: - pop {r0} - bx r0 - .pool - thumb_func_end sub_800A364 - - thumb_func_start sub_800A388 -sub_800A388: @ 800A388 - push {r4-r6,lr} - ldr r0, =gUnknown_03000D10 - ldr r5, [r0, 0x4] - ldr r2, =gUnknown_03003110 - ldr r1, =0x00008888 - strh r1, [r2] - movs r3, 0 - adds r4, r0, 0 - adds r6, r4, 0 - adds r2, 0x2 -_0800A39C: - lsls r0, r3, 1 - ldrh r1, [r6] - adds r0, r1 - adds r0, r5 - ldrb r1, [r0, 0x1] - lsls r1, 8 - ldrb r0, [r0] - orrs r0, r1 - strh r0, [r2] - adds r2, 0x2 - adds r3, 0x1 - cmp r3, 0x6 - ble _0800A39C - ldrh r0, [r4] - adds r0, 0xE - strh r0, [r4] - ldrh r1, [r4, 0x2] - lsls r0, 16 - lsrs r0, 16 - cmp r1, r0 - bhi _0800A3D0 - movs r0, 0 - strb r0, [r4, 0x8] - ldr r1, =gUnknown_03003140 - ldr r0, =sub_800A3EC - str r0, [r1] -_0800A3D0: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800A388 - thumb_func_start sub_800A3EC sub_800A3EC: @ 800A3EC ldr r1, =gUnknown_03003140 diff --git a/src/link.c b/src/link.c index 9fd2430529..1499b82750 100644 --- a/src/link.c +++ b/src/link.c @@ -22,7 +22,7 @@ struct BlockTransfer { u16 pos; u16 size; - const void *src; + const u8 *src; bool8 active; u8 multiplayerId; }; @@ -114,7 +114,9 @@ static void sub_8009AA0(u8 unused); static void sub_8009F70(void); static void sub_800A2E0(void); bool32 sub_800A2F4(const void *src, size_t size); -void sub_800A364(void); +static void sub_800A364(void); +static void sub_800A388(void); +void sub_800A3EC(void); void sub_800A418(void); void task00_link_test(u8 taskId); void sub_800A588(u8 who); @@ -921,3 +923,30 @@ bool32 sub_800A2F4(const void *src, size_t size) gUnknown_03000D50 = 0; return TRUE; } + +static void sub_800A364(void) +{ + if (++ gUnknown_03000D50 > 2) + { + gUnknown_03003140 = sub_800A388; + } +} + +static void sub_800A388(void) +{ + int i; + const u8 *src; + + src = gUnknown_03000D10.src; + gUnknown_03003110[0] = 0x8888; + for (i = 0; i < 7; i ++) + { + gUnknown_03003110[i + 1] = (src[gUnknown_03000D10.pos + i * 2 + 1] << 8) | src[gUnknown_03000D10.pos + i * 2]; + } + gUnknown_03000D10.pos += 14; + if (gUnknown_03000D10.size <= gUnknown_03000D10.pos) + { + gUnknown_03000D10.active = FALSE; + gUnknown_03003140 = sub_800A3EC; + } +}