summaryrefslogtreecommitdiff
path: root/include/pso/packet_classes.h
blob: 51474771c5576507eb7a3f666b6cc4b9baea6a96 (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
#ifndef PACKET_CLASSES_H
#define PACKET_CLASSES_H

#include <global_types.h>
#include <string.h>
#include <pso/macros.h>
#include <pso/forward.h>
#include <pso/protocol.h>
#include <pso/TMenuList.h>
#include <pso/TPlyCharData.h>
#include <pso/TPlyClientConfig.h>
#include <pso/TPlyGuildCardTag.h>
#include <pso/TPlySmth.h>

template<size_t size>
struct TPlyText {
	packet_header header;
	char text[size];
};

TMenuListEntry(GameListEntry,
	u8 difficulty_tag;
	u8 num_players;
	char name[16];
	u8 episode;
	u8 flags;
);

TMenuListEntry(LobbyListEntry,
	u32 smth;
);

TMenuListEntry(QuestListEntry,
	char name[32];
	char short_description[112];
);

class TPlyMeetUserExtension {
public:
	TPlyGuildCardTag tags[8];
	u32 mbr_0x40;
	char player_name[16];
	char player_name2[16];
public:
	void bswap() {
		for (int i = 0; i < 8; ++i) {
			tags[i].bswap();
		}
		bswap_32(&mbr_0x40);
	};
};

class TPlyJoinLobbyData {
public:
	TPlyGuildCardTag tag;
	u32 ip_addr;
	u32 client_id;
	char name[16];
public:
	void bswap() {
		tag.bswap();
		bswap_32(&ip_addr);
		bswap_32(&client_id);
	};
};

class TPlyStartGame {
public:
	packet_header header;
	TPlyJoinLobbyData lobby_data[4];
	TPlyMeetUserExtension extension;
	u8 mbr_0xe8[4];
public:
	void bswap() {
		header.bswap();
		for (int i = 0; i < 4; ++i) {
			lobby_data[i].bswap();
		}
		extension.bswap();
	};
};

class TPlyGuildCardTagPacket {
public:
	packet_header header;
	TPlyGuildCardTag tag;
};

class TPlyRecvLogin : public TPlyGuildCardTagPacket {
public:
	TPlyClientConfig client_config;
public:
	void bswap() {
		header.bswap();
		tag.bswap();
	};
};

class TMessageBox {
public:
	packet_header header;
	TPlyGuildCardTag tag;
	char mesg[512];
public:
	void bswap() {
		header.bswap();
		tag.bswap();
	};
};

#endif