summaryrefslogtreecommitdiff
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
parentb80218a8c1fafb174e3f05c0b51c61005531bf05 (diff)
TProtocol: Start adding, and matching more command handlers
Also found out alot more assumptions I had were wrong.
-rw-r--r--context.h198
-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
-rw-r--r--src/pso/TProtocol.cpp133
7 files changed, 382 insertions, 154 deletions
diff --git a/context.h b/context.h
index c650a13..12567f0 100644
--- a/context.h
+++ b/context.h
@@ -168,16 +168,16 @@ typedef long ptrdiff_t;
// pso/TProtocol.h
#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) \
@@ -209,7 +209,7 @@ typedef long ptrdiff_t;
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) \
@@ -222,6 +222,18 @@ typedef long ptrdiff_t;
#define recv_packet_handler(name) recv_packet_handler_##name
+// pso/TMenuList.h
+#define TMenuListEntry(name, members) \
+class name { \
+public: \
+ void bswap() { \
+ tag.bswap(); \
+ }; \
+public: \
+ TPlyGuildCardTag tag; \
+ members \
+} __packed__
+
// pso/forward.h
// Class forward.
class TTcpSocket;
@@ -418,19 +430,6 @@ inline TArray<T, n> &to_TArray(T *array) {
}
// pso/TMenuList.h
-template <typename T>
-class TMenuListEntry : public TPlyGuildCardTag {
-public:
- TMenuListEntry() : TPlyGuildCardTag() {};
-
- void bswap() {
- TPlyGuildCardTag::bswap();
- entry.bswap();
- };
-public:
- T entry;
-} __packed__;
-
template <typename T, int num_entries, int num_pad_entries>
class TMenuList {
public:
@@ -449,10 +448,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:
@@ -480,6 +480,31 @@ public:
packet_header header;
TMenuListEntry<T> pad_entries[num_pad_entries];
} __packed__;
+#endif
+
+// pso/packet_classes.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];
+);
// TMainTask.cpp
// Const defs.
@@ -492,6 +517,7 @@ extern TTcpSocket *tcp_socket_table[16];
// pso/TProtocol.h
EXTERN_OBJECT_NAME(TProtocol);
+extern TPlyMeetUserExtension meet_user_settings;
// TObject.cpp
#define o(name) extern const char *name##_name;
@@ -712,23 +738,6 @@ 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];
-};
-
struct recv_packet_handlers {
#define o(name, ...) recv_packet_handler(name) name;
RECV_PACKET_HANDLERS;
@@ -785,11 +794,13 @@ public:
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;
};
// pso/TPlyDispData.h
@@ -838,41 +849,27 @@ public:
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__;
@@ -1172,6 +1169,57 @@ public:
};
// pso/packet_classes.h
+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 TMessageBox {
public:
packet_header header;
@@ -1204,10 +1252,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];
@@ -1236,6 +1284,8 @@ public:
// Command handlers.
// 0x01
void recv_error(packet &pkt);
+ // 0x1A/0xD5
+ void recv_text(packet &pkt);
// 0x03
void recv_regist(packet &pkt);
// 0x04
@@ -1244,10 +1294,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/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;
diff --git a/src/pso/TProtocol.cpp b/src/pso/TProtocol.cpp
index 644fe55..a1462b9 100644
--- a/src/pso/TProtocol.cpp
+++ b/src/pso/TProtocol.cpp
@@ -14,24 +14,136 @@
OBJECT_NAME(TProtocol);
packet *server_packet = nullptr;
+TPlyMeetUserExtension meet_user_settings;
void copy_packet(struct packet *pkt) {
}
-void TProtocol::recv_regist(packet &pkt) {};
+void TProtocol::recv_start_game(packet &pkt) {
+ int lobby_entry_idx;
+ TPlyStartGame tmp = as(TPlyStartGame &, pkt);
+ tmp.bswap();
+
+ meet_user_settings = tmp.extension;
+
+ lobby_entry_idx = -1;
+ for (int i = 0; i < tmp.header.flags && i < 4; ++i) {
+ if (tmp.lobby_data[i].tag == m_guildcard_tag) {
+ lobby_entry_idx = i;
+ }
+ }
+
+ // Failed to find our guildcard tag, go into an infinite loop.
+ if (lobby_entry_idx == -1) {
+ for (;;) {}
+ } else {
+ m_joined_game = true;
+ if (m_recv_handlers.handle_0E_recv_start_game != nullptr) {
+ m_recv_handlers.handle_0E_recv_start_game(tmp.lobby_data, tmp.header.flags, lobby_entry_idx);
+ }
+ }
-void TProtocol::recv_login(packet &pkt) {};
+};
-void TProtocol::recv_logout(packet &pkt) {};
+void TProtocol::recv_info_list(packet &pkt) {
+ typedef TMenuList<GameListEntry, 64, 1> info_list;
+ info_list tmp = as(info_list &, pkt);
+ tmp.bswap();
-void TProtocol::recv_chat(packet &pkt) {};
+ m_entry_count = tmp.header.flags;
-void TProtocol::recv_dir_list(packet &pkt) {};
+ for (int i = 0; i < m_entry_count; ++i) {
+ m_game_entries[i] = tmp.entries[i];
+ }
-void TProtocol::recv_game_list(packet &pkt) {};
+ if (m_recv_handlers.handle_1F_recv_info_list != nullptr) {
+ m_recv_handlers.handle_1F_recv_info_list(m_entry_count, m_game_entries, tmp.pad_entries[0]);
+ }
+};
-void TProtocol::recv_start_game(packet &pkt) {};
+void TProtocol::recv_game_list(packet &pkt) {
+ typedef TMenuList<GameListEntry, 64, 1> game_list;
+ game_list tmp = as(game_list &, pkt);
+ tmp.bswap();
+
+ m_entry_count = tmp.header.flags;
+
+ for (int i = 0; i < m_entry_count; ++i) {
+ m_game_entries[i] = tmp.entries[i];
+ }
+
+ if (m_recv_handlers.handle_08_recv_game_list != nullptr) {
+ m_recv_handlers.handle_08_recv_game_list(m_entry_count, m_game_entries, tmp.pad_entries[0]);
+ }
+};
+
+void TProtocol::recv_dir_list(packet &pkt) {
+ typedef TMenuList<GameListEntry, 64, 1> dir_list;
+ dir_list tmp = as(dir_list &, pkt);
+ tmp.bswap();
+
+ m_entry_count = tmp.header.flags;
+
+ for (int i = 0; i < m_entry_count; ++i) {
+ m_game_entries[i] = tmp.entries[i];
+ }
+
+ if (m_recv_handlers.handle_07_A0_A1_recv_dir_list != nullptr) {
+ m_recv_handlers.handle_07_A0_A1_recv_dir_list(m_entry_count, m_game_entries, tmp.pad_entries[0]);
+ }
+};
+
+void TProtocol::recv_chat(packet &pkt) {
+ TMessageBox tmp = as(TMessageBox &, pkt);
+ tmp.bswap();
+ if (m_recv_handlers.handle_06_recv_chat != nullptr) {
+ m_recv_handlers.handle_06_recv_chat(tmp.tag, tmp.mesg);
+ }
+};
+
+void TProtocol::recv_logout(packet &pkt) {
+ close();
+
+ m_is_encrypted = false;
+ m_connected = false;
+ m_packet_offset = 0;
+ m_packet_size = 0;
+
+ if (m_recv_handlers.handle_05_recv_logout != nullptr) {
+ m_recv_handlers.handle_05_recv_logout();
+ }
+};
+
+void TProtocol::recv_login(packet &pkt) {
+ TPlyRecvLogin tmp = as(TPlyRecvLogin &, pkt);
+ tmp.bswap();
+ if (!tmp.header.flags) {
+ m_guildcard_tag = tmp.tag;
+ m_client_config = tmp.client_config;
+ m_connected = true;
+ }
+
+ if (m_recv_handlers.handle_04_recv_login != nullptr) {
+ m_recv_handlers.handle_04_recv_login(tmp.header.flags);
+ }
+};
+
+void TProtocol::recv_regist(packet &pkt) {
+ packet_header tmp = pkt.pkt.header;
+ tmp.bswap();
+ m_login_response_state = tmp.flags;
+ if (m_recv_handlers.handle_03_recv_regist != nullptr) {
+ m_recv_handlers.handle_03_recv_regist(tmp.flags);
+ }
+};
+
+void TProtocol::recv_text(packet &pkt) {
+ TPlyText<1024> tmp = as(TPlyText<1024> &, pkt);
+ if (m_recv_handlers.handle_1A_D5_recv_text != nullptr) {
+ m_recv_handlers.handle_1A_D5_recv_text(tmp.text);
+ }
+};
void TProtocol::recv_error(packet &pkt) {
TMessageBox tmp = as(TMessageBox &, pkt);
@@ -51,6 +163,11 @@ int TProtocol::handle_command(struct packet *pkt) {
{ 0x07, &recv_dir_list },
{ 0x08, &recv_game_list },
{ 0x0E, &recv_start_game },
+ { 0x1F, &recv_info_list },
+ { 0x1A, &recv_text },
+ { 0xA0, &recv_dir_list },
+ { 0xA1, &recv_dir_list },
+ { 0xD5, &recv_text },
{ 0, nullptr }
};
for (int i = 0; !handlers[i].command; ++i) {
@@ -214,7 +331,7 @@ TProtocol::TProtocol(TObject *parent, u16 sub_version, int language, char *seria
m_recv_handlers.unused11 = nullptr;
m_recv_handlers.handle_97_checksum_reply_packet = nullptr;
m_recv_handlers.handle_B0_server_message_packet = nullptr;
- m_recv_handlers.handle_1F_lobby_info_desk_list_packet = nullptr;
+ m_recv_handlers.handle_1F_recv_info_list = nullptr;
m_recv_handlers.handle_88_player_arrow_color_list_packet = nullptr;
m_recv_handlers.handle_8A_lobby_name_packet = nullptr;
m_recv_handlers.handle_C5_player_challenge_data_packet = nullptr;