summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2018-03-02 21:43:18 -0500
committerPikalaxALT <pikalaxalt@gmail.com>2018-03-02 21:43:18 -0500
commite3b078d08fb7208065cb6bda96879fbb6e97c5db (patch)
tree7cdd1e2ebeafcf658b564b704a2f96758b488a48
parentd25a9ffe169059715878c0c01bf8f8913b3eeb76 (diff)
through sub_81D1914
-rw-r--r--asm/match_call.s82
-rw-r--r--src/match_call.c66
2 files changed, 61 insertions, 87 deletions
diff --git a/asm/match_call.s b/asm/match_call.s
index b0a322b4d..af83c30db 100644
--- a/asm/match_call.s
+++ b/asm/match_call.s
@@ -5,88 +5,6 @@
.text
- thumb_func_start sub_81D189C
-sub_81D189C: @ 81D189C
- push {r4,r5,lr}
- adds r5, r1, 0
- cmp r0, 0x14
- bhi _081D18C2
- ldr r1, =gUnknown_086252A8
- lsls r0, 2
- adds r0, r1
- ldr r4, [r0]
- adds r0, r4, 0
- bl sub_81D1574
- ldr r1, =gUnknown_08625360
- lsls r0, 2
- adds r0, r1
- ldr r2, [r0]
- adds r0, r4, 0
- adds r1, r5, 0
- bl _call_via_r2
-_081D18C2:
- pop {r4,r5}
- pop {r0}
- bx r0
- .pool
- thumb_func_end sub_81D189C
-
- thumb_func_start sub_81D18D0
-sub_81D18D0: @ 81D18D0
- push {lr}
- ldr r0, [r0, 0xC]
- bl sub_81D1920
- pop {r0}
- bx r0
- thumb_func_end sub_81D18D0
-
- thumb_func_start sub_81D18DC
-sub_81D18DC: @ 81D18DC
- push {lr}
- adds r3, r0, 0
- adds r2, r1, 0
- ldrb r0, [r3]
- cmp r0, 0x5
- beq _081D18F0
- ldr r0, [r3, 0x10]
- bl sub_81D1920
- b _081D18F8
-_081D18F0:
- ldr r0, [r3, 0x10]
- ldrh r1, [r3, 0x4]
- bl sub_81D199C
-_081D18F8:
- pop {r0}
- bx r0
- thumb_func_end sub_81D18DC
-
- thumb_func_start sub_81D18FC
-sub_81D18FC: @ 81D18FC
- push {lr}
- ldr r0, [r0, 0xC]
- bl sub_81D1920
- pop {r0}
- bx r0
- thumb_func_end sub_81D18FC
-
- thumb_func_start sub_81D1908
-sub_81D1908: @ 81D1908
- push {lr}
- ldr r0, [r0, 0xC]
- bl sub_81D1920
- pop {r0}
- bx r0
- thumb_func_end sub_81D1908
-
- thumb_func_start sub_81D1914
-sub_81D1914: @ 81D1914
- push {lr}
- adds r0, r1, 0
- bl sub_8197080
- pop {r0}
- bx r0
- thumb_func_end sub_81D1914
-
thumb_func_start sub_81D1920
sub_81D1920: @ 81D1920
push {r4-r7,lr}
diff --git a/src/match_call.c b/src/match_call.c
index b754b1180..8712cbf3a 100644
--- a/src/match_call.c
+++ b/src/match_call.c
@@ -8,11 +8,11 @@
// Static type declarations
-struct MatchCallSusbtruct0 {
+typedef struct MatchCallSusbtruct0 {
const u8 *text;
u16 v4;
u16 v6;
-};
+} match_call_sub0_t;
struct MatchCallStructCommon {
u8 type;
@@ -26,7 +26,7 @@ struct MatchCallStruct0 {
u16 flag;
const u8 *v4;
const u8 *v8;
- const struct MatchCallSusbtruct0 *vC;
+ const match_call_sub0_t *vC;
};
struct MatchCallStruct1 {
@@ -34,6 +34,8 @@ struct MatchCallStruct1 {
u8 v1;
u16 flag;
u16 v4;
+ u8 fill6[10];
+ const match_call_sub0_t *v10;
};
struct MatchCallSubstruct2 {
@@ -47,7 +49,7 @@ struct MatchCallStruct2 {
u16 flag;
u16 v4;
const u8 *v8;
- const u8 *vC;
+ const match_call_sub0_t *vC;
const struct MatchCallSubstruct2 *v10;
};
@@ -65,7 +67,15 @@ struct MatchCallStruct4 {
u16 flag;
const u8 *v4;
const u8 *v8;
- const struct MatchCallSusbtruct0 *vC;
+ const match_call_sub0_t *vC;
+};
+
+struct MatchCallStruct5 {
+ u8 type;
+ u8 v1;
+ u16 flag;
+ u8 fill4[12];
+ const match_call_sub0_t *v10;
};
typedef union {
@@ -75,6 +85,7 @@ typedef union {
struct MatchCallStruct2 *type2;
struct MatchCallStruct3 *type3;
struct MatchCallStruct4 *type4;
+ struct MatchCallStruct5 *type5;
} match_call_t;
struct UnkStruct_08625388 {
@@ -91,6 +102,10 @@ struct UnkStruct_08625388 {
// Static ROM declarations
+void sub_81D1920(const match_call_sub0_t *, u8 *);
+void sub_81D199C(const match_call_sub0_t *, u16, u8 *);
+void sub_8197080(u8 *);
+
// .rodata
extern const match_call_t gUnknown_086252A8[];
@@ -100,6 +115,7 @@ extern bool32 (*const gUnknown_08625324[])(const match_call_t);
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 *);
// .text
@@ -349,3 +365,43 @@ u32 sub_81D1898(match_call_t matchCall)
{
return ARRAY_COUNT(gRematchTable);
}
+
+void sub_81D189C(u32 idx, u8 *dest)
+{
+ match_call_t matchCall;
+ u32 i;
+
+ if (idx > 20)
+ return;
+ matchCall = gUnknown_086252A8[idx];
+ i = sub_81D1574(matchCall);
+ gUnknown_08625360[i](matchCall, dest);
+}
+
+void sub_81D18D0(match_call_t matchCall, u8 *dest)
+{
+ sub_81D1920(matchCall.type0->vC, dest);
+}
+
+void sub_81D18DC(match_call_t matchCall, u8 *dest)
+{
+ if (matchCall.common->type != 5)
+ sub_81D1920(matchCall.type5->v10, dest);
+ else
+ sub_81D199C(matchCall.type1->v10, matchCall.type1->v4, dest);
+}
+
+void sub_81D18FC(match_call_t matchCall, u8 *dest)
+{
+ sub_81D1920(matchCall.type2->vC, dest);
+}
+
+void sub_81D1908(match_call_t matchCall, u8 *dest)
+{
+ sub_81D1920(matchCall.type4->vC, dest);
+}
+
+void sub_81D1914(match_call_t matchCall, u8 *dest)
+{
+ sub_8197080(dest);
+}