summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--context.h47
-rw-r--r--include/pso/TProtocol.h16
-rw-r--r--include/pso/packet_classes.h31
-rw-r--r--src/pso/TProtocol.cpp52
4 files changed, 112 insertions, 34 deletions
diff --git a/context.h b/context.h
index fff939a..8d4e3d0 100644
--- a/context.h
+++ b/context.h
@@ -184,10 +184,10 @@ typedef long ptrdiff_t;
o(handle_67_recv_start_lobby2, TPlyJoinLobbyEntry *entries, u8 entry_count, int client_id, int leader_id, int lobby_number, int block_number, int smth, int event) \
o(handle_80_recv_generate_id, TRecvGenerateID gen_id) \
o(unused9, void) \
- o(handle_65_add_player_to_game_packet, void) \
- o(handle_66_player_left_game_packet, void) \
- o(handle_68_add_player_to_lobby_packet, void) \
- o(handle_69_player_left_lobby_packet, void) \
+ o(handle_65_recv_burst_game, TPlyJoinLobbyEntry *entries, int leader_id, int disable_udp) \
+ o(handle_66_recv_exit_game, int client_id, int leader_id, int disable_udp) \
+ o(handle_68_recv_burst_lobby, TPlyJoinLobbyEntry *entries, int leader_id) \
+ o(handle_69_recv_exit_lobby, int client_id, int leader_id) \
o(handle_18_90_9A_login_response_packet, void) \
o(handle_92_9C_register_response_packet, void) \
o(unused10, void) \
@@ -1467,6 +1467,19 @@ public:
};
};
+template<bool is_lobby>
+class TRecvExit {
+public:
+ packet_header header;
+ char client_id;
+ char leader_id;
+ char disable_udp;
+public:
+ void bswap() {
+ header.bswap();
+ };
+};
+
class TRegister {
public:
packet_header header;
@@ -1680,15 +1693,15 @@ public:
class TPlyJoinLobby {
public:
packet_header header;
- u8 client_id;
- u8 leader_id;
- u8 disable_udp;
- u8 lobby_number;
- u8 block_number;
- u8 unknown1;
- u8 event;
- u8 unknown2;
- u8 unused[4];
+ char client_id;
+ char leader_id;
+ char disable_udp;
+ char lobby_number;
+ char block_number;
+ char unknown1;
+ char event;
+ char unknown2;
+ char unused[4];
TPlyJoinLobbyEntry entries[12];
public:
void bswap() {
@@ -1896,6 +1909,14 @@ public:
void recv_quest_info(packet &pkt);
// 0xB0
void recv_emergency_call(packet &pkt);
+ // 0x65
+ void recv_burst_game(packet &pkt);
+ // 0x66
+ void recv_exit_game(packet &pkt);
+ // 0x68
+ void recv_burst_lobby(packet &pkt);
+ // 0x69
+ void recv_exit_lobby(packet &pkt);
// Send command handlers.
// 0x03
diff --git a/include/pso/TProtocol.h b/include/pso/TProtocol.h
index ca80ffe..041cd56 100644
--- a/include/pso/TProtocol.h
+++ b/include/pso/TProtocol.h
@@ -65,10 +65,10 @@ struct packet : public flex_packet<0x7c00> {};
o(handle_67_recv_start_lobby2, TPlyJoinLobbyEntry *entries, u8 entry_count, int client_id, int leader_id, int lobby_number, int block_number, int smth, int event) \
o(handle_80_recv_generate_id, TRecvGenerateID gen_id) \
o(unused9, void) \
- o(handle_65_add_player_to_game_packet, void) \
- o(handle_66_player_left_game_packet, void) \
- o(handle_68_add_player_to_lobby_packet, void) \
- o(handle_69_player_left_lobby_packet, void) \
+ o(handle_65_recv_burst_game, TPlyJoinLobbyEntry *entries, int leader_id, int disable_udp) \
+ o(handle_66_recv_exit_game, int client_id, int leader_id, int disable_udp) \
+ o(handle_68_recv_burst_lobby, TPlyJoinLobbyEntry *entries, int leader_id) \
+ o(handle_69_recv_exit_lobby, int client_id, int leader_id) \
o(handle_18_90_9A_login_response_packet, void) \
o(handle_92_9C_register_response_packet, void) \
o(unused10, void) \
@@ -243,6 +243,14 @@ public:
void recv_quest_info(packet &pkt);
// 0xB0
void recv_emergency_call(packet &pkt);
+ // 0x65
+ void recv_burst_game(packet &pkt);
+ // 0x66
+ void recv_exit_game(packet &pkt);
+ // 0x68
+ void recv_burst_lobby(packet &pkt);
+ // 0x69
+ void recv_exit_lobby(packet &pkt);
// Send command handlers.
// 0x03
diff --git a/include/pso/packet_classes.h b/include/pso/packet_classes.h
index d49c49a..9cd9800 100644
--- a/include/pso/packet_classes.h
+++ b/include/pso/packet_classes.h
@@ -233,6 +233,19 @@ _TSendAction(3,
#undef _TSendAction
#endif
+template<bool is_lobby>
+class TRecvExit {
+public:
+ packet_header header;
+ char client_id;
+ char leader_id;
+ char disable_udp;
+public:
+ void bswap() {
+ header.bswap();
+ };
+};
+
class TRegister {
public:
packet_header header;
@@ -446,15 +459,15 @@ public:
class TPlyJoinLobby {
public:
packet_header header;
- u8 client_id;
- u8 leader_id;
- u8 disable_udp;
- u8 lobby_number;
- u8 block_number;
- u8 unknown1;
- u8 event;
- u8 unknown2;
- u8 unused[4];
+ char client_id;
+ char leader_id;
+ char disable_udp;
+ char lobby_number;
+ char block_number;
+ char unknown1;
+ char event;
+ char unknown2;
+ char unused[4];
TPlyJoinLobbyEntry entries[12];
public:
void bswap() {
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;