summaryrefslogtreecommitdiff
path: root/src/dodrio_berry_picking_3.c
blob: 3bd538f94f2cdab7dd7537c85c3679bf70328657 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
#include "global.h"
#include "dodrio_berry_picking.h"
#include "link.h"
#include "link_rfu.h"

void sub_815A5BC(s32 a0)
{
    struct Padded_U8 data[2];
    data[0].value = 1;
    data[1].value = a0;
    Rfu_SendPacket(data);
}

u8 sub_815A5E8(s32 a0)
{
    u8 * r1;
    if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00)
        return 0;
    r1 = (u8 *)&gRecvCmds[a0][1];
    if (r1[0] == 1)
        return r1[4];
    return 0;
}

struct UnkPacket2
{
    u8 id;
    u8 unk1_0:4;
    u8 unk1_1:4;
    u16 unk2_0:4;
    u16 unk2_1:4;
    u16 unk3_0:4;
    u16 unk3_1:4;
    u16 unk4_0:4;
    u16 unk4_1:4;
    u16 unk5_0:4;
    u16 unk5_1:4;
    u16 unk6_0:2;
    u16 unk6_1:2;
    u16 unk6_2:2;
    u16 unk6_3:2;
    u16 unk7_0:2;
    u16 unk7_1:2;
    u16 unk7_2:2;
    u16 unk7_3:2;
    u8 unk8_0:2;
    u8 unk8_1:2;
    u8 unk8_2:2;
    u8 unk8_3:2;
    u8 unk9_0:2;
    u8 unk9_1:2;
    u8 unk9_2:2;
    u8 unk9_3:1;
    u8 unk9_4:1;
    u8 unkA_0:1;
    u8 unkA_1:1;
    u8 unkA_2:1;
    u8 unkA_3:5;
    u8 unkB_0:1;
    u8 unkB_1:1;
    u8 unkB_2:1;
    u8 unkB_3:1;
    u8 unkB_4:1;
    u8 unkB_5:1;
    u8 unkB_6:1;
};

void sub_815A61C(struct DodrioSubstruct_31A0 * arg0, struct DodrioSubstruct_31A0_2C * arg1, struct DodrioSubstruct_31A0_2C * arg2, struct DodrioSubstruct_31A0_2C * arg3, struct DodrioSubstruct_31A0_2C * arg4, struct DodrioSubstruct_31A0_2C * arg5, u8 arg6, u32 arg7, u32 arg8)
{
    struct UnkPacket2 packet;
    struct DodrioSubstruct_31A0_14 * ptr = &arg0->unk14;

    packet.id = 2;
    packet.unk1_0 = ptr->unkB[0];
    packet.unk1_1 = ptr->unkB[1];
    packet.unk2_0 = ptr->unkB[2];
    packet.unk2_1 = ptr->unkB[3];
    packet.unk3_0 = ptr->unkB[4];
    packet.unk3_1 = ptr->unkB[5];
    packet.unk4_0 = ptr->unkB[6];
    packet.unk4_1 = ptr->unkB[7];
    packet.unk5_0 = ptr->unkB[8];
    packet.unk5_1 = ptr->unkB[9];

    packet.unk6_0 = ptr->unk0[0];
    packet.unk6_1 = ptr->unk0[1];
    packet.unk6_2 = ptr->unk0[2];
    packet.unk6_3 = ptr->unk0[3];
    packet.unk7_0 = ptr->unk0[4];
    packet.unk7_1 = ptr->unk0[5];
    packet.unk7_2 = ptr->unk0[6];
    packet.unk7_3 = ptr->unk0[7];
    packet.unk8_0 = ptr->unk0[8];
    packet.unk8_1 = ptr->unk0[9];

    packet.unk8_2 = arg1->unk0;
    packet.unk8_3 = arg2->unk0;
    packet.unk9_0 = arg3->unk0;
    packet.unk9_1 = arg4->unk0;
    packet.unk9_2 = arg5->unk0;

    packet.unk9_3 = arg1->unk4;
    packet.unk9_4 = arg2->unk4;
    packet.unkA_0 = arg3->unk4;
    packet.unkA_1 = arg4->unk4;
    packet.unkA_2 = arg5->unk4;

    packet.unkB_2 = arg1->unk8;
    packet.unkB_3 = arg2->unk8;
    packet.unkB_4 = arg3->unk8;
    packet.unkB_5 = arg4->unk8;
    packet.unkB_6 = arg5->unk8;

    packet.unkA_3 = arg6;
    packet.unkB_1 = arg7;
    packet.unkB_0 = arg8;
    Rfu_SendPacket(&packet);
}

u32 sub_815A950(u32 unused, struct DodrioSubstruct_31A0 * arg0, struct DodrioSubstruct_31A0_2C * arg1, struct DodrioSubstruct_31A0_2C * arg2, struct DodrioSubstruct_31A0_2C * arg3, struct DodrioSubstruct_31A0_2C * arg4, struct DodrioSubstruct_31A0_2C * arg5, u8 *arg6, u32 *arg7, u32 *arg8)
{
    struct UnkPacket2 * packet;
    struct DodrioSubstruct_31A0_14 * ptr = &arg0->unk14;

    if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00)
        return 0;

    packet = (void *)&gRecvCmds[0][1];
    if (packet->id == 2)
    {
        ptr->unkB[0] = packet->unk1_0;
        ptr->unkB[1] = packet->unk1_1;
        ptr->unkB[2] = packet->unk2_0;
        ptr->unkB[3] = packet->unk2_1;
        ptr->unkB[4] = packet->unk3_0;
        ptr->unkB[5] = packet->unk3_1;
        ptr->unkB[6] = packet->unk4_0;
        ptr->unkB[7] = packet->unk4_1;
        ptr->unkB[8] = packet->unk5_0;
        ptr->unkB[9] = packet->unk5_1;
        ptr->unkB[10] = packet->unk1_0;

        ptr->unk0[0] = packet->unk6_0;
        ptr->unk0[1] = packet->unk6_1;
        ptr->unk0[2] = packet->unk6_2;
        ptr->unk0[3] = packet->unk6_3;
        ptr->unk0[4] = packet->unk7_0;
        ptr->unk0[5] = packet->unk7_1;
        ptr->unk0[6] = packet->unk7_2;
        ptr->unk0[7] = packet->unk7_3;
        ptr->unk0[8] = packet->unk8_0;
        ptr->unk0[9] = packet->unk8_1;
        ptr->unk0[10] = packet->unk6_0;

        arg1->unk0 = packet->unk8_2;
        arg1->unk4 = packet->unk9_3;
        arg1->unk8 = packet->unkB_2;

        arg2->unk0 = packet->unk8_3;
        arg2->unk4 = packet->unk9_4;
        arg2->unk8 = packet->unkB_3;

        arg3->unk0 = packet->unk9_0;
        arg3->unk4 = packet->unkA_0;
        arg3->unk8 = packet->unkB_4;

        arg4->unk0 = packet->unk9_1;
        arg4->unk4 = packet->unkA_1;
        arg4->unk8 = packet->unkB_5;

        arg5->unk0 = packet->unk9_2;
        arg5->unk4 = packet->unkA_2;
        arg5->unk8 = packet->unkB_6;

        *arg6 = packet->unkA_3;
        *arg7 = packet->unkB_1;
        *arg8 = packet->unkB_0;
        return 1;
    }

    return 0;
}

struct UnkPacket3
{
    u8 id;
    u8 ALIGNED(4) unk4;
};

void sub_815AAD8(u8 arg0)
{
    struct UnkPacket3 packet;
    packet.id = 3;
    packet.unk4 = arg0;
    Rfu_SendPacket(&packet);
}

u32 sub_815AB04(u32 arg0, u8 *arg1)
{
    struct UnkPacket3 * packet;

    if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00)
        return 0;

    packet = (void *)&gRecvCmds[arg0][1];
    if (packet->id == 3)
    {
        *arg1 = packet->unk4;
        return 1;
    }

    return 0;
}

struct UnkPacket4
{
    u8 id;
    u32 unk4;
};

void sub_815AB3C(u32 arg0)
{
    struct UnkPacket4 packet;
    packet.id = 4;
    packet.unk4 = arg0;
    Rfu_SendPacket(&packet);
}

u32 sub_815AB60(u32 arg0)
{
    struct UnkPacket4 * packet;

    if ((gRecvCmds[0][0] & 0xFF00) != 0x2F00)
        return 0;

    packet = (void *)&gRecvCmds[arg0][1];
    if (packet->id == 4)
        return packet->unk4;

    return 0;
}