diff --git a/asm/link.s b/asm/link.s index 9c921b4d5f..60d1c9a8ff 100644 --- a/asm/link.s +++ b/asm/link.s @@ -5,107 +5,6 @@ .text - thumb_func_start sub_800A9A8 -sub_800A9A8: @ 800A9A8 - push {r4,lr} - movs r1, 0 - movs r2, 0 - ldr r0, =gUnknown_03003100 - ldrb r0, [r0] - cmp r1, r0 - bge _0800A9CA - movs r4, 0x1 - adds r3, r0, 0 -_0800A9BA: - adds r0, r4, 0 - lsls r0, r2 - orrs r1, r0 - lsls r0, r1, 24 - lsrs r1, r0, 24 - adds r2, 0x1 - cmp r2, r3 - blt _0800A9BA -_0800A9CA: - adds r0, r1, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_800A9A8 - - thumb_func_start sub_800A9D8 -sub_800A9D8: @ 800A9D8 - push {r4-r6,lr} - movs r4, 0 - movs r5, 0 - movs r6, 0x1 - b _0800A9EE -_0800A9E2: - adds r0, r6, 0 - lsls r0, r5 - orrs r4, r0 - lsls r0, r4, 24 - lsrs r4, r0, 24 - adds r5, 0x1 -_0800A9EE: - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r5, r0 - blt _0800A9E2 - adds r0, r4, 0 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_800A9D8 - - thumb_func_start sub_800AA04 -sub_800AA04: @ 800AA04 - push {r4-r7,lr} - ldr r1, =gUnknown_03003100 - strb r0, [r1] - bl GetMultiplayerId - ldr r1, =gUnknown_03003120 - strb r0, [r1] - ldr r4, =gLinkPlayers - ldr r3, =gUnknown_02022A74 - movs r2, 0x4 -_0800AA18: - adds r0, r3, 0 - adds r1, r4, 0 - ldm r1!, {r5-r7} - stm r0!, {r5-r7} - ldm r1!, {r5-r7} - stm r0!, {r5-r7} - ldr r1, [r1] - str r1, [r0] - adds r4, 0x1C - adds r3, 0x1C - subs r2, 0x1 - cmp r2, 0 - bge _0800AA18 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_800AA04 - - thumb_func_start sub_800AA48 -sub_800AA48: @ 800AA48 - ldr r0, =gUnknown_03003100 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_800AA48 - - thumb_func_start sub_800AA54 -sub_800AA54: @ 800AA54 - ldr r0, =gUnknown_03003120 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_800AA54 - thumb_func_start sub_800AA60 sub_800AA60: @ 800AA60 push {r4-r7,lr} diff --git a/src/link.c b/src/link.c index 5ed05f50f1..d6bb7bd7df 100644 --- a/src/link.c +++ b/src/link.c @@ -1250,3 +1250,51 @@ void SetLinkDebugValues(u32 seed, u32 flags) gLinkDebugSeed = seed; gLinkDebugFlags = flags; } + +u8 sub_800A9A8(void) +{ + int i; + u8 flags; + + flags = 0; + for (i = 0; i < gUnknown_03003100; i ++) + { + flags |= (1 << i); + } + return flags; +} + +u8 sub_800A9D8(void) +{ + int i; + u8 flags; + + flags = 0; + for (i = 0; i < GetLinkPlayerCount(); i ++) + { + flags |= (1 << i); + } + return flags; +} + +void sub_800AA04(u8 a0) +{ + int i; + + gUnknown_03003100 = a0; + gUnknown_03003120 = GetMultiplayerId(); + for (i = 0; i < MAX_RFU_PLAYERS; i ++) + { + gUnknown_02022A74[i] = gLinkPlayers[i]; + } +} + +u8 sub_800AA48(void) +{ + return gUnknown_03003100; +} + +u8 sub_800AA54(void) +{ + return gUnknown_03003120; +}