From a77eec717e08422876315fbd81afb5d492b75315 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Mon, 29 May 2023 16:36:07 -0300 Subject: TProtocol: Add (and match) recv_{burst,exit}_{game,lobby}() --- src/pso/TProtocol.cpp | 52 +++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/pso/TProtocol.cpp b/src/pso/TProtocol.cpp index 3c410aa..e876e02 100644 --- a/src/pso/TProtocol.cpp +++ b/src/pso/TProtocol.cpp @@ -24,6 +24,42 @@ void copy_packet(struct packet *pkt) { } +void TProtocol::recv_exit_lobby(packet &pkt) { + TRecvExit tmp = as(TRecvExit &, pkt); + tmp.bswap(); + + if (m_recv_handlers.handle_69_recv_exit_lobby != nullptr) { + m_recv_handlers.handle_69_recv_exit_lobby(tmp.client_id, tmp.leader_id); + } +} + +void TProtocol::recv_burst_lobby(packet &pkt) { + TPlyJoinLobby tmp = as(TPlyJoinLobby &, pkt); + tmp.bswap(); + + if (m_recv_handlers.handle_68_recv_burst_lobby != nullptr) { + m_recv_handlers.handle_68_recv_burst_lobby(tmp.entries, tmp.leader_id); + } +} + +void TProtocol::recv_exit_game(packet &pkt) { + TRecvExit tmp = as(TRecvExit &, pkt); + tmp.bswap(); + + if (m_recv_handlers.handle_66_recv_exit_game != nullptr) { + m_recv_handlers.handle_66_recv_exit_game(tmp.client_id, tmp.leader_id, tmp.disable_udp); + } +} + +void TProtocol::recv_burst_game(packet &pkt) { + TPlyJoinLobby tmp = as(TPlyJoinLobby &, pkt); + tmp.bswap(); + + if (m_recv_handlers.handle_65_recv_burst_game != nullptr) { + m_recv_handlers.handle_65_recv_burst_game(tmp.entries, tmp.leader_id, tmp.disable_udp); + } +} + void TProtocol::send_create_game(char *name, char *password, u8 difficulty, u8 battle_mode, u8 challenge_mode, u8 episode) { if (m_connected) { TCreateGame tmp; @@ -858,10 +894,10 @@ int TProtocol::handle_command(struct packet *pkt) { { 0x67, &recv_start_lobby2 }, { 0x83, &recv_room_info }, { 0x1D, &recv_ping }, - // 0x65 - // 0x66 - // 0x68 - // 0x69 + { 0x65, &recv_burst_game }, + { 0x66, &recv_exit_game }, + { 0x68, &recv_burst_lobby }, + { 0x69, &recv_exit_lobby }, // 0x90 // 0x91 // 0x92 @@ -1043,10 +1079,10 @@ TProtocol::TProtocol(TObject *parent, u16 sub_version, int language, char *seria m_recv_handlers.handle_13_recv_download = nullptr; m_recv_handlers.handle_80_recv_generate_id = nullptr; m_recv_handlers.unused9 = nullptr; - m_recv_handlers.handle_65_add_player_to_game_packet = nullptr; - m_recv_handlers.handle_66_player_left_game_packet = nullptr; - m_recv_handlers.handle_68_add_player_to_lobby_packet = nullptr; - m_recv_handlers.handle_69_player_left_lobby_packet = nullptr; + m_recv_handlers.handle_65_recv_burst_game = nullptr; + m_recv_handlers.handle_66_recv_exit_game = nullptr; + m_recv_handlers.handle_68_recv_burst_lobby = nullptr; + m_recv_handlers.handle_69_recv_exit_lobby = nullptr; m_recv_handlers.handle_92_9C_register_response_packet = nullptr; m_recv_handlers.unused10 = nullptr; m_recv_handlers.handle_81_recv_chat_message = nullptr; -- cgit v1.2.3-13-gbd6f