diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2023-05-29 16:36:07 -0300 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2023-05-30 14:22:55 -0300 |
commit | a77eec717e08422876315fbd81afb5d492b75315 (patch) | |
tree | 11e1ba025fceb9b8d4c95fd650f0fa98eb40e217 /src/pso | |
parent | 1f357bb6afb918d4cf333f5aab87d4751fbfa6af (diff) |
TProtocol: Add (and match) recv_{burst,exit}_{game,lobby}()
Diffstat (limited to 'src/pso')
-rw-r--r-- | src/pso/TProtocol.cpp | 52 |
1 files changed, 44 insertions, 8 deletions
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<true> tmp = as(TRecvExit<true> &, 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<false> tmp = as(TRecvExit<false> &, 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; |