summaryrefslogtreecommitdiff
path: root/src/pso
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2023-03-10 15:03:42 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2023-03-10 15:06:37 -0400
commit0aab853119953c87fe76d23d695c9e0e1c267dd8 (patch)
tree1d92409551119906256bba256841c8c28768c314 /src/pso
parent2b9599035cf2da613869a4db10ac236a49fc5e4c (diff)
TProtocol: Add (and somewhat match) even more command handlers
Diffstat (limited to 'src/pso')
-rw-r--r--src/pso/TProtocol.cpp131
1 files changed, 125 insertions, 6 deletions
diff --git a/src/pso/TProtocol.cpp b/src/pso/TProtocol.cpp
index 58a7374..415f056 100644
--- a/src/pso/TProtocol.cpp
+++ b/src/pso/TProtocol.cpp
@@ -15,11 +15,120 @@ OBJECT_NAME(TProtocol);
packet *server_packet = nullptr;
TPlyMeetUserExtension meet_user_settings;
+u32 game_variations[16][2];
void copy_packet(struct packet *pkt) {
}
+void TProtocol::recv_message(packet &pkt) {
+ TMessageBox tmp = as(TMessageBox &, pkt);
+ tmp.bswap();
+ if (m_recv_handlers.handle_11_recv_message != nullptr) {
+ m_recv_handlers.handle_11_recv_message(tmp.mesg, tmp.header.flags);
+ }
+};
+
+void TProtocol::recv_upload(packet &pkt) {};
+
+void TProtocol::recv_download(packet &pkt) {
+ TSendDownloadHead tmp2;
+ TRecvDownload tmp = as(TRecvDownload &, pkt);
+ tmp.bswap();
+
+ tmp2.header.command = tmp.header.command;
+ tmp2.header.flags = tmp.header.flags;
+ tmp2.header.size = sizeof(tmp2);
+ strncpy(tmp2.filename, tmp.filename, sizeof(tmp2.filename));
+ tmp2.bswap();
+
+ if (m_recv_handlers.handle_13_recv_download != nullptr) {
+ m_recv_handlers.handle_13_recv_download(tmp);
+ }
+
+ send(reinterpret_cast<u8 *>(&tmp2), sizeof(tmp2));
+};
+
+void TProtocol::recv_download2(packet &pkt) {
+ TSendDownloadHead tmp2;
+ TRecvDownload tmp = as(TRecvDownload &, pkt);
+ tmp.bswap();
+
+ tmp2.header.command = tmp.header.command;
+ tmp2.header.flags = tmp.header.flags;
+ tmp2.header.size = sizeof(tmp2);
+ strncpy(tmp2.filename, tmp.filename, sizeof(tmp2.filename));
+ tmp2.bswap();
+
+ if (m_recv_handlers.handle_A7_recv_download2 != nullptr) {
+ m_recv_handlers.handle_A7_recv_download2(tmp);
+ }
+
+ send(reinterpret_cast<u8 *>(&tmp2), sizeof(tmp2));
+};
+
+void TProtocol::recv_download_head2(packet &pkt) {
+ TSendDownloadHead tmp2;
+ TRecvDownloadHead tmp = as(TRecvDownloadHead &, pkt);
+ tmp.bswap();
+
+ tmp2.header.command = tmp.header.command;
+ tmp2.header.flags = tmp.header.flags;
+ tmp2.header.size = sizeof(tmp2);
+ strncpy(tmp2.filename, tmp.filename, sizeof(tmp2.filename));
+ tmp2.bswap();
+
+ if (m_recv_handlers.handle_A6_recv_download_head2 != nullptr) {
+ m_recv_handlers.handle_A6_recv_download_head2(tmp);
+ }
+
+ send(reinterpret_cast<u8 *>(&tmp2), sizeof(tmp2));
+};
+
+void TProtocol::recv_download_head(packet &pkt) {
+ TSendDownloadHead tmp2;
+ TRecvDownloadHead tmp = as(TRecvDownloadHead &, pkt);
+ tmp.bswap();
+
+ tmp2.header.command = tmp.header.command;
+ tmp2.header.flags = tmp.header.flags;
+ tmp2.header.size = sizeof(tmp2);
+ strncpy(tmp2.filename, tmp.filename, sizeof(tmp2.filename));
+ tmp2.bswap();
+
+ if (m_recv_handlers.handle_44_recv_download_head != nullptr) {
+ m_recv_handlers.handle_44_recv_download_head(tmp);
+ }
+
+ send(reinterpret_cast<u8 *>(&tmp2), sizeof(tmp2));
+};
+
+void TProtocol::recv_banner_head(packet &pkt) {};
+void TProtocol::recv_banner(packet &pkt) {};
+
+void TProtocol::recv_start_lobby2(packet &pkt) {
+ TPlyJoinLobby tmp = as(TPlyJoinLobby &, pkt);
+ tmp.bswap();
+
+ m_joined_game = true;
+
+ if (m_recv_handlers.handle_67_recv_start_lobby2 != nullptr) {
+ m_recv_handlers.handle_67_recv_start_lobby2(tmp.entries, tmp.header.flags, tmp.client_id, tmp.leader_id, tmp.lobby_number, tmp.block_number, tmp.unknown1, tmp.event);
+ }
+};
+
+void TProtocol::recv_start_game3(packet &pkt) {
+ TPlyJoinGame tmp = as(TPlyJoinGame &, pkt);
+ tmp.bswap();
+
+ memcpy(game_variations, tmp.variations, sizeof(game_variations));
+ m_joined_game = true;
+
+ if (m_recv_handlers.handle_64_recv_start_game3 != nullptr) {
+ m_recv_handlers.handle_64_recv_start_game3(tmp);
+ }
+};
+
void TProtocol::recv_start_game(packet &pkt) {
int lobby_entry_idx;
TPlyStartGame tmp = as(TPlyStartGame &, pkt);
@@ -163,10 +272,20 @@ int TProtocol::handle_command(struct packet *pkt) {
{ 0x07, &recv_dir_list },
{ 0x08, &recv_game_list },
{ 0x0E, &recv_start_game },
+ { 0x64, &recv_start_game3 },
+ { 0x12, &recv_banner },
+ { 0x16, &recv_banner_head },
+ { 0x44, &recv_download_head },
+ { 0x13, &recv_download },
+ { 0x14, &recv_upload },
+ { 0x11, &recv_message },
{ 0x1F, &recv_info_list },
{ 0x1A, &recv_text },
+ { 0x67, &recv_start_lobby2 },
{ 0xA0, &recv_dir_list },
{ 0xA1, &recv_dir_list },
+ { 0xA6, &recv_download_head2 },
+ { 0xA7, &recv_download2 },
{ 0xD5, &recv_text },
{ 0, nullptr }
};
@@ -307,13 +426,13 @@ TProtocol::TProtocol(TObject *parent, u16 sub_version, int language, char *seria
m_recv_handlers.handle_07_A0_A1_recv_dir_list = nullptr;
m_recv_handlers.handle_01_recv_error = nullptr;
m_recv_handlers.handle_06_recv_chat = nullptr;
- m_recv_handlers.handle_11_additional_info_reply_packet = nullptr;
+ m_recv_handlers.handle_11_recv_message = nullptr;
m_recv_handlers.handle_0E_recv_start_game = nullptr;
m_recv_handlers.unused7 = nullptr;
- m_recv_handlers.handle_64_join_game_packet = nullptr;
+ m_recv_handlers.handle_64_recv_start_game3 = nullptr;
m_recv_handlers.unused8 = nullptr;
- m_recv_handlers.handle_67_join_lobby_packet = nullptr;
- m_recv_handlers.handle_13_quest_data_packet = nullptr;
+ m_recv_handlers.handle_67_recv_start_lobby2 = nullptr;
+ m_recv_handlers.handle_13_recv_download = nullptr;
m_recv_handlers.handle_80_unused_ignored_packet = nullptr;
m_recv_handlers.unused9 = nullptr;
m_recv_handlers.handle_65_add_player_to_game_packet = nullptr;
@@ -326,8 +445,8 @@ TProtocol::TProtocol(TObject *parent, u16 sub_version, int language, char *seria
m_recv_handlers.handle_41_guild_card_search_reply_packet = nullptr;
m_recv_handlers.handle_A2_quest_list_packet = nullptr;
m_recv_handlers.handle_A3_quest_info_packet = nullptr;
- m_recv_handlers.handle_44_quest_file_list_packet = nullptr;
- m_recv_handlers.handle_13_quest_data_packet = nullptr;
+ m_recv_handlers.handle_44_recv_download_head = nullptr;
+ m_recv_handlers.handle_13_recv_download = nullptr;
m_recv_handlers.handle_A4_downloadable_quest_menu_packet = nullptr;
m_recv_handlers.handle_A5_downloadable_quest_info_packet = nullptr;
m_recv_handlers.unused11 = nullptr;