summaryrefslogtreecommitdiff
path: root/include/pso
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2023-03-09 18:09:14 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2023-03-09 18:09:14 -0400
commitdacfbade1476d79bf7484b8817592d61ba62ee2f (patch)
treeebf296e1e152fcfc09aeab9488f0d57e2b6211e7 /include/pso
parentb80218a8c1fafb174e3f05c0b51c61005531bf05 (diff)
TProtocol: Start adding, and matching more command handlers
Also found out alot more assumptions I had were wrong.
Diffstat (limited to 'include/pso')
-rw-r--r--include/pso/TMenuList.h28
-rw-r--r--include/pso/TPlyClientConfig.h12
-rw-r--r--include/pso/TPlyGuildCardTag.h34
-rw-r--r--include/pso/TProtocol.h47
-rw-r--r--include/pso/packet_classes.h84
5 files changed, 132 insertions, 73 deletions
diff --git a/include/pso/TMenuList.h b/include/pso/TMenuList.h
index 3a38a66..90a7423 100644
--- a/include/pso/TMenuList.h
+++ b/include/pso/TMenuList.h
@@ -7,18 +7,16 @@
#include "pso/TPlyGuildCardTag.h"
#include <global_types.h>
-template <typename T>
-class TMenuListEntry : public TPlyGuildCardTag {
-public:
- TMenuListEntry() : TPlyGuildCardTag() {};
-
- void bswap() {
- TPlyGuildCardTag::bswap();
- entry.bswap();
- };
-public:
- T entry;
-} __packed__;
+#define TMenuListEntry(name, members) \
+class name { \
+public: \
+ void bswap() { \
+ tag.bswap(); \
+ }; \
+public: \
+ TPlyGuildCardTag tag; \
+ members \
+} __packed__
template <typename T, int num_entries, int num_pad_entries>
class TMenuList {
@@ -38,10 +36,11 @@ public:
};
public:
packet_header header;
- TMenuListEntry<T> pad_entries[num_pad_entries];
- TMenuListEntry<T> entries[num_entries];
+ T pad_entries[num_pad_entries];
+ T entries[num_entries];
} __packed__;
+#ifdef __MWCC__
template <typename T, int num_entries>
class TMenuList<T, num_entries, 0> {
public:
@@ -69,5 +68,6 @@ public:
packet_header header;
TMenuListEntry<T> pad_entries[num_pad_entries];
} __packed__;
+#endif
#endif
diff --git a/include/pso/TPlyClientConfig.h b/include/pso/TPlyClientConfig.h
index 8876640..b800a5d 100644
--- a/include/pso/TPlyClientConfig.h
+++ b/include/pso/TPlyClientConfig.h
@@ -8,11 +8,13 @@
class TPlyClientConfig {
public:
public:
- u32 m_magic[2];
- u32 m_flags;
- u32 m_proxy_dst_addr;
- u16 m_proxy_dst_port;
- u8 m_mbr_0xe[14];
+ struct {
+ u32 magic[2];
+ u32 flags;
+ u32 proxy_dst_addr;
+ u16 proxy_dst_port;
+ u8 mbr_0xe[14];
+ } config;
};
#endif
diff --git a/include/pso/TPlyGuildCardTag.h b/include/pso/TPlyGuildCardTag.h
index 948426a..7bcdb71 100644
--- a/include/pso/TPlyGuildCardTag.h
+++ b/include/pso/TPlyGuildCardTag.h
@@ -14,41 +14,27 @@ struct gc_tag {
class TPlyGuildCardTag {
public:
TPlyGuildCardTag() {};
- TPlyGuildCardTag(TPlyGuildCardTag &src) {
- m_tag.tag0 = src.m_tag.tag0;
- m_tag.tag1 = src.m_tag.tag1;
- m_tag.tag2 = src.m_tag.tag2;
- m_guildcard_number = src.m_guildcard_number;
- };
+
TPlyGuildCardTag(u16 tag2, u32 guildcard_number) {
- m_tag.tag0 = 0;
- m_tag.tag1 = 0;
- m_tag.tag2 = tag2;
+ m_tag0 = 0;
+ m_tag1 = 0;
+ m_tag2 = tag2;
m_guildcard_number = guildcard_number;
};
- TPlyGuildCardTag &operator=(const TPlyGuildCardTag &src) {
- m_tag.tag0 = src.m_tag.tag0;
- m_tag.tag1 = src.m_tag.tag1;
- m_tag.tag2 = src.m_tag.tag2;
- m_guildcard_number = src.m_guildcard_number;
+ int operator==(TPlyGuildCardTag &other) {
+ return (m_tag1 == other.m_tag1) && (m_tag2 == other.m_tag2) && (m_guildcard_number == other.m_guildcard_number);
};
void bswap() {
bswap_32(&m_guildcard_number);
- bswap_16(&m_tag.tag2);
+ bswap_16(&m_tag2);
};
- void assign(const TPlyGuildCardTag &src) { *this = src; };
- void assign(const TPlyGuildCardTag *src) {
- m_tag_u32 = src->m_tag_u32;
- m_guildcard_number = src->m_guildcard_number;
- };
public:
- union {
- gc_tag m_tag;
- u32 m_tag_u32;
- };
+ u8 m_tag0;
+ u8 m_tag1;
+ u16 m_tag2;
u32 m_guildcard_number;
} __packed__;
#endif
diff --git a/include/pso/TProtocol.h b/include/pso/TProtocol.h
index 9d24830..628ee7f 100644
--- a/include/pso/TProtocol.h
+++ b/include/pso/TProtocol.h
@@ -19,6 +19,7 @@
#include <pso/TTcpSocket.h>
EXTERN_OBJECT_NAME(TProtocol);
+extern TPlyMeetUserExtension meet_user_settings;
extern void copy_packet(struct packet *pkt);
struct packet {
@@ -31,36 +32,18 @@ struct packet {
};
};
-struct GameListEntry {
- u8 difficulty_tag;
- u8 num_players;
- char name[16];
- u8 episode;
- u8 flags;
-};
-
-struct LobbyListEntry {
- u32 smth;
-};
-
-struct QuestListEntry {
- char name[32];
- char short_description[112];
-};
-
-
#define RECV_PACKET_HANDLERS \
o(handle_unused_login, void) \
- o(handle_03_recv_regist, void) \
- o(handle_04_recv_login, void) \
+ o(handle_03_recv_regist, u8 state) \
+ o(handle_04_recv_login, u8 error_code) \
o(handle_05_recv_logout, void) \
- o(handle_07_A0_A1_recv_dir_list, int entry_count, TMenuListEntry<GameListEntry> *entries, TMenuListEntry<GameListEntry> &entry_0) \
- o(handle_08_recv_game_list, int entry_count, TMenuListEntry<GameListEntry> *entries, TMenuListEntry<GameListEntry> &entry_0) \
+ o(handle_07_A0_A1_recv_dir_list, int entry_count, GameListEntry *entries, GameListEntry &entry_0) \
+ o(handle_08_recv_game_list, int entry_count, GameListEntry *entries, GameListEntry &entry_0) \
o(handle_01_recv_error, char *mesg) \
o(handle_06_recv_chat, TPlyGuildCardTag &tag, char *mesg) \
o(handle_11_additional_info_reply_packet, void) \
- o(handle_1A_D5_large_message_box_packet, void) \
- o(handle_0E_recv_start_game, void) \
+ o(handle_1A_D5_recv_text, char *text) \
+ o(handle_0E_recv_start_game, TPlyJoinLobbyData *entries, u8 entry_count, int lobby_entry_idx) \
o(unused7, void) \
o(handle_64_join_game_packet, void) \
o(unused8, void) \
@@ -92,7 +75,7 @@ struct QuestListEntry {
o(handle_A6_download_quest_file_list_packet, void) \
o(handle_A7_download_quest_file_data_packet, void) \
o(unused11, void) \
- o(handle_1F_lobby_info_desk_list_packet, void) \
+ o(handle_1F_recv_info_list, int entry_count, GameListEntry *entries, GameListEntry &entry_0) \
o(handle_B0_server_message_packet, void) \
o(handle_88_player_arrow_color_list_packet, void) \
o(handle_8A_lobby_name_packet, void) \
@@ -142,10 +125,10 @@ public:
u8 m_unused3[80];
TPlyCharData m_character_data;
u32 m_unused4;
- TMenuListEntry<GameListEntry> m_game_entries[64];
- TMenuListEntry<GameListEntry> m_game_entries2[64];
- TMenuListEntry<LobbyListEntry> m_lobby_entries[16];
- TMenuListEntry<QuestListEntry> m_quest_entries[30];
+ GameListEntry m_game_entries[64];
+ GameListEntry m_game_entries2[64];
+ LobbyListEntry m_lobby_entries[16];
+ QuestListEntry m_quest_entries[30];
u8 m_unused5[128];
char m_serial_number3[17];
char m_password2[17];
@@ -174,6 +157,8 @@ public:
// Command handlers.
// 0x01
void recv_error(packet &pkt);
+ // 0x1A/0xD5
+ void recv_text(packet &pkt);
// 0x03
void recv_regist(packet &pkt);
// 0x04
@@ -182,10 +167,12 @@ public:
void recv_logout(packet &pkt);
// 0x06
void recv_chat(packet &pkt);
- // 0x07
+ // 0x07/0xA0/0xA1
void recv_dir_list(packet &pkt);
// 0x08
void recv_game_list(packet &pkt);
+ // 0x1F
+ void recv_info_list(packet &pkt);
// 0x0E
void recv_start_game(packet &pkt);
};
diff --git a/include/pso/packet_classes.h b/include/pso/packet_classes.h
index 87e0b06..5147477 100644
--- a/include/pso/packet_classes.h
+++ b/include/pso/packet_classes.h
@@ -12,6 +12,90 @@
#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;