diff --git a/asm/record_mixing.s b/asm/record_mixing.s index 50bc0037d8..2c86404ecc 100644 --- a/asm/record_mixing.s +++ b/asm/record_mixing.s @@ -5,83 +5,6 @@ .text - thumb_func_start sub_80E7830 -sub_80E7830: @ 80E7830 - push {r4,lr} - adds r4, r0, 0 - bl GetLinkPlayerCount - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - beq _080E7868 - cmp r0, 0x3 - bhi _080E784A - cmp r0, 0x2 - beq _080E7850 - b _080E78B8 -_080E784A: - cmp r0, 0x4 - beq _080E7894 - b _080E78B8 -_080E7850: - movs r3, 0 - ldr r2, =gUnknown_0858CF8C - adds r1, r4, 0 -_080E7856: - adds r0, r3, r2 - ldrb r0, [r0] - stm r1!, {r0} - adds r3, 0x1 - cmp r3, 0x1 - bls _080E7856 - b _080E78B8 - .pool -_080E7868: - movs r0, 0 - bl GetLinkPlayerTrainerId - adds r2, r0, 0 - movs r0, 0x1 - ands r2, r0 - movs r3, 0 - ldr r1, =gUnknown_0858CF8E - lsls r0, r2, 1 - adds r0, r2 - adds r1, r0, r1 - adds r2, r4, 0 -_080E7880: - ldrb r0, [r1] - stm r2!, {r0} - adds r1, 0x1 - adds r3, 0x1 - cmp r3, 0x2 - bls _080E7880 - b _080E78B8 - .pool -_080E7894: - movs r0, 0 - bl GetLinkPlayerTrainerId - movs r1, 0x9 - bl __umodsi3 - adds r2, r0, 0 - movs r3, 0 - ldr r1, =gUnknown_0858CF94 - lsls r0, r2, 2 - adds r1, r0, r1 - adds r2, r4, 0 -_080E78AC: - ldrb r0, [r1] - stm r2!, {r0} - adds r1, 0x1 - adds r3, 0x1 - cmp r3, 0x3 - bls _080E78AC -_080E78B8: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80E7830 - thumb_func_start sub_80E78C4 sub_80E78C4: @ 80E78C4 push {r4-r7,lr} diff --git a/src/record_mixing.c b/src/record_mixing.c index 01b19cbb3d..14afd57ce3 100644 --- a/src/record_mixing.c +++ b/src/record_mixing.c @@ -94,6 +94,10 @@ void TaskDummy4(void *src); // .rodata +extern const u8 gUnknown_0858CF8C[]; +extern const u8 gUnknown_0858CF8E[][3]; +extern const u8 gUnknown_0858CF94[][4]; + // .text void sub_80E6BE8(void) @@ -541,3 +545,33 @@ static void *sub_80E7820(u8 id) { return gBlockRecvBuffer[id]; } + +void sub_80E7830(u32 *data) +{ + u32 i; + u32 linkTrainerId; + + switch ((u32)GetLinkPlayerCount()) + { + case 2: + for (i = 0; i < 2; i ++) + { + data[i] = gUnknown_0858CF8C[i]; + } + break; + case 3: + linkTrainerId = GetLinkPlayerTrainerId(0) % 2; + for (i = 0; i < 3; i ++) + { + data[i] = gUnknown_0858CF8E[linkTrainerId][i]; + } + break; + case 4: + linkTrainerId = GetLinkPlayerTrainerId(0) % 9; + for (i = 0; i < 4; i ++) + { + data[i] = gUnknown_0858CF94[linkTrainerId][i]; + } + break; + } +}