From 30c20bbab63f4d78e4500bcc9a0e056a491faaff Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 3 Mar 2018 13:41:28 -0500 Subject: [PATCH] through sub_81D1B00 --- asm/match_call.s | 90 ------------------------------------------------ src/match_call.c | 55 +++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 92 deletions(-) diff --git a/asm/match_call.s b/asm/match_call.s index 608c47fda7..ba329371b7 100644 --- a/asm/match_call.s +++ b/asm/match_call.s @@ -5,96 +5,6 @@ .text - thumb_func_start sub_81D1A78 -sub_81D1A78: @ 81D1A78 - push {r4-r6,lr} - adds r5, r1, 0 - adds r6, r2, 0 - cmp r0, 0x14 - bhi _081D1AA2 - ldr r1, =gUnknown_086252A8 - lsls r0, 2 - adds r0, r1 - ldr r4, [r0] - adds r0, r4, 0 - bl sub_81D1574 - ldr r1, =gUnknown_08625374 - lsls r0, 2 - adds r0, r1 - ldr r3, [r0] - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r6, 0 - bl _call_via_r3 -_081D1AA2: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81D1A78 - - thumb_func_start sub_81D1AB0 -sub_81D1AB0: @ 81D1AB0 - ldr r3, [r0, 0x4] - str r3, [r1] - ldr r0, [r0, 0x8] - str r0, [r2] - bx lr - thumb_func_end sub_81D1AB0 - - thumb_func_start sub_81D1ABC -sub_81D1ABC: @ 81D1ABC - push {r4,r5,lr} - adds r5, r1, 0 - adds r4, r0, 0 - ldr r0, [r4, 0xC] - cmp r0, 0 - bne _081D1AD0 - ldrh r0, [r4, 0x4] - bl sub_81D1B0C - b _081D1AD2 -_081D1AD0: - str r0, [r2] -_081D1AD2: - ldr r0, [r4, 0x8] - str r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81D1ABC - - thumb_func_start sub_81D1ADC -sub_81D1ADC: @ 81D1ADC - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldrh r0, [r4, 0x4] - bl sub_81D1B0C - ldr r0, [r4, 0x8] - str r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81D1ADC - - thumb_func_start sub_81D1AF4 -sub_81D1AF4: @ 81D1AF4 - ldr r3, [r0, 0x4] - str r3, [r1] - ldr r0, [r0, 0x8] - str r0, [r2] - bx lr - thumb_func_end sub_81D1AF4 - - thumb_func_start sub_81D1B00 -sub_81D1B00: @ 81D1B00 - ldr r3, [r0, 0x4] - str r3, [r1] - ldr r0, [r0, 0x8] - str r0, [r2] - bx lr - thumb_func_end sub_81D1B00 - thumb_func_start sub_81D1B0C sub_81D1B0C: @ 81D1B0C push {r4,r5,lr} diff --git a/src/match_call.c b/src/match_call.c index fd92d8a9ac..85cc34307d 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -36,7 +36,8 @@ struct MatchCallStruct1 { u8 v1; u16 flag; u16 v4; - u8 fill6[10]; + const u8 *v8; + const u8 *vC; const match_call_sub0_t *v10; }; @@ -76,7 +77,9 @@ struct MatchCallStruct5 { u8 type; u8 v1; u16 flag; - u8 fill4[12]; + u16 v4; + const u8 *v8; + const u8 *vC; const match_call_sub0_t *v10; }; @@ -107,6 +110,7 @@ struct UnkStruct_08625388 { void sub_81D1920(const match_call_sub0_t *, u8 *); void sub_81D199C(const match_call_sub0_t *, u16, u8 *); void sub_8197080(u8 *); +void sub_81D1B0C(u32, const u8 **, const u8 **); // .rodata @@ -118,6 +122,7 @@ extern bool32 (*const gUnknown_08625338[])(const match_call_t); extern const struct UnkStruct_08625388 gUnknown_08625388[]; extern u32 (*const gUnknown_0862534C[])(const match_call_t); extern void (*const gUnknown_08625360[])(const match_call_t, u8 *); +extern void (*const gUnknown_08625374[])(const match_call_t, const u8 **, const u8 **); // .text @@ -569,3 +574,49 @@ ASM_DIRECT void sub_81D199C(const match_call_sub0_t *sub0, u16 idx, u8 *dest) "\t.pool"); } #endif + +void sub_81D1A78(u32 idx, const u8 **a1, const u8 **a2) +{ + match_call_t matchCall; + u32 i; + + if (idx > 20) + return; + matchCall = gUnknown_086252A8[idx]; + i = sub_81D1574(matchCall); + gUnknown_08625374[i](matchCall, a1, a2); +} + +void sub_81D1AB0(match_call_t matchCall, const u8 **a1, const u8 **a2) +{ + *a1 = matchCall.type0->v4; + *a2 = matchCall.type0->v8; +} + +void sub_81D1ABC(match_call_t matchCall, const u8 **a1, const u8 **a2) +{ + match_call_t _matchCall = matchCall; + if (_matchCall.type1->vC == NULL) + sub_81D1B0C(_matchCall.type1->v4, a1, a2); + else + *a2 = _matchCall.type1->vC; + *a1 = _matchCall.type1->v8; +} + +void sub_81D1ADC(match_call_t matchCall, const u8 **a1, const u8 **a2) +{ + sub_81D1B0C(matchCall.type2->v4, a1, a2); + *a1 = matchCall.type2->v8; +} + +void sub_81D1AF4(match_call_t matchCall, const u8 **a1, const u8 **a2) +{ + *a1 = matchCall.type0->v4; + *a2 = matchCall.type0->v8; +} + +void sub_81D1B00(match_call_t matchCall, const u8 **a1, const u8 **a2) +{ + *a1 = matchCall.type0->v4; + *a2 = matchCall.type0->v8; +}