summaryrefslogtreecommitdiff
path: root/src/pokemon_jump_3.c
blob: 04d9ad439966a52177325a4962e966d39526dbc0 (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
#include "global.h"
#include "link_rfu.h"
#include "pokemon_jump.h"

struct MonInfoPacket
{
    u8 id; // packet id
    u16 species;
    u32 personality;
    u32 otId;
};

void sub_8149A6C(struct PokemonJump1_MonInfo *arg0)
{
    struct MonInfoPacket packet;
    packet.id = 1;
    packet.species = arg0->species;
    packet.otId = arg0->otId;
    packet.personality = arg0->personality;
    RfuPrepareSend0x2f00(&packet);
}

bool32 sub_8149A90(int multiplayerId, struct PokemonJump1_MonInfo *arg0)
{
    struct MonInfoPacket packet;

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

    memcpy(&packet, &gRecvCmds[multiplayerId][1], sizeof(packet));
    if (packet.id == 1)
    {
        arg0->species = packet.species;
        arg0->otId = packet.otId;
        arg0->personality = packet.personality;
        return TRUE;
    }

    return FALSE;
}

struct UnkPacket2
{
    u8 id; // packet id
    u32 unk4;
    u32 unk8;
};

void sub_8149AE0(u32 arg0)
{
    struct UnkPacket2 packet;
    packet.id = 2;
    packet.unk4 = arg0;
    RfuPrepareSend0x2f00(&packet);
}

struct UnkPacket3
{
    u8 id; // packet id
    u8 unk1;
    u8 unk2;
    u8 unk3_0:5;
    u8 unk3_1:3;
    u16 unk4;
    u16 unk6;
    u32 unk8_0:15;
    u32 unk8_1:17;
};

void sub_8149AF8(struct PokemonJump1_82E4 *arg0, struct PokemonJump1Sub *arg1)
{
    struct UnkPacket3 packet;
    packet.id = 3;
    packet.unk8_1 = arg1->unk8;
    packet.unk3_0 = arg1->unk1;
    packet.unk1 = arg1->unk0;
    packet.unk6 = arg1->unk2;
    packet.unk8_0 = arg1->unk4;
    packet.unk2 = arg0->unk10;
    packet.unk3_1 = arg0->unk14;
    packet.unk4 = arg0->unkE;
    RfuPrepareSend0x2f00(&packet);
}

bool32 sub_8149B7C(struct PokemonJump1_82E4 *arg0, struct PokemonJump1Sub *arg1)
{
    struct UnkPacket3 packet;

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

    memcpy(&packet, &gRecvCmds[0][1], sizeof(packet));
    if (packet.id != 3)
        return FALSE;

    arg1->unk8 = packet.unk8_1;
    arg1->unk1 = packet.unk3_0;
    arg1->unk0 = packet.unk1;
    arg1->unk2 = packet.unk6;
    arg1->unk4 = packet.unk8_0;
    arg0->unk10 = packet.unk2;
    arg0->unk14 = packet.unk3_1;
    arg0->unkE = packet.unk4;
    return TRUE;
}

struct UnkPacket4
{
    u8 id; // packet id
    u8 unk1;
    u8 unk2;
    u8 unk3;
    u16 unk4;
    u8 unk6;
    u16 unk8;
};

void sub_8149BF4(struct PokemonJump1_82E4 *arg0, u8 arg1, u16 arg2)
{
    struct UnkPacket4 packet;
    packet.id = 4;
    packet.unk1 = arg0->unk10;
    packet.unk2 = arg0->unk14;
    packet.unk3 = arg0->unk18;
    packet.unk4 = arg0->unkE;
    packet.unk6 = arg1;
    packet.unk8 = arg2;
    RfuPrepareSend0x2f00(&packet);
}

bool32 sub_8149C24(struct PokemonJump1_82E4 *arg0, int multiplayerId, u8 *arg2, u16 *arg3)
{
    struct UnkPacket4 packet;

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

    memcpy(&packet, &gRecvCmds[multiplayerId][1], sizeof(packet));
    if (packet.id != 4)
        return FALSE;

    arg0->unk10 = packet.unk1;
    arg0->unk14 = packet.unk2;
    arg0->unk18 = packet.unk3;
    arg0->unkE = packet.unk4;
    *arg2 = packet.unk6;
    *arg3 = packet.unk8;
    return TRUE;
}

bool32 sub_8149C90(struct PokemonJump1_82E4 *arg0, int multiplayerId)
{
    struct UnkPacket4 packet;

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

    memcpy(&packet, &gRecvCmds[multiplayerId][1], sizeof(packet));
    if (packet.id != 4)
        return FALSE;

    arg0->unk10 = packet.unk1;
    arg0->unk14 = packet.unk2;
    arg0->unk18 = packet.unk3;
    arg0->unkE = packet.unk4;
    return TRUE;
}