summaryrefslogtreecommitdiff
path: root/context.h
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2023-03-14 16:41:22 -0300
committermrb0nk500 <b0nk@b0nk.xyz>2023-03-14 16:41:22 -0300
commitad1179e6cfeb07ff865e0086627761b0a04bfd79 (patch)
treed64bb62cc2406e1616a02d14aecf1192d89edd92 /context.h
parentd7336127af97ed86778796fb3a9cd203ce8b9306 (diff)
TProtocol: Add (and match) even more command handlers
Slowly starting to get fleshed out.
Diffstat (limited to 'context.h')
-rw-r--r--context.h147
1 files changed, 141 insertions, 6 deletions
diff --git a/context.h b/context.h
index e82c1da..04c2593 100644
--- a/context.h
+++ b/context.h
@@ -182,7 +182,7 @@ typedef long ptrdiff_t;
o(handle_64_recv_start_game3, TPlyJoinGame &join_data) \
o(unused8, void) \
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_unused_ignored_packet, void) \
+ 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) \
@@ -192,8 +192,8 @@ typedef long ptrdiff_t;
o(handle_92_9C_register_response_packet, void) \
o(unused10, void) \
o(handle_95_request_character_data_packet, void) \
- o(handle_81_simple_mail_packet, void) \
- o(handle_41_guild_card_search_reply_packet, void) \
+ o(handle_81_recv_chat_message, TChatMessage &chat_message) \
+ o(handle_41_recv_user_ans, TUserAns &user_ans) \
o(send_96_unused, void) \
o(handle_97_checksum_reply_packet, void) \
o(handle_B1_current_time_packet, void) \
@@ -452,7 +452,7 @@ public:
T entries[num_entries];
} __packed__;
-#ifdef __MWCC__
+#ifdef __MWERKS__
template <typename T, int num_entries>
class TMenuList<T, num_entries, 0> {
public:
@@ -464,7 +464,7 @@ public:
};
public:
packet_header header;
- TMenuListEntry<T> entries[num_entries];
+ T entries[num_entries];
} __packed__;
template <typename T, int num_pad_entries>
@@ -478,7 +478,7 @@ public:
};
public:
packet_header header;
- TMenuListEntry<T> pad_entries[num_pad_entries];
+ T pad_entries[num_pad_entries];
} __packed__;
#endif
@@ -489,6 +489,44 @@ struct TPlyText {
char text[size];
};
+struct game_command_header {
+ u8 command;
+ u8 size;
+ u16 id;
+
+ void bswap() {
+ bswap_16(&id);
+ };
+};
+
+struct extended_game_command_header {
+ game_command_header header;
+ u32 size;
+
+ void bswap() {
+ bswap_16(&header.id);
+ bswap_32(&size);
+ };
+};
+
+struct game_command {
+ game_command_header header;
+ u8 data[1024-sizeof(game_command_header)];
+
+ void bswap() {
+ header.bswap();
+ };
+};
+
+struct extended_game_command {
+ extended_game_command_header header;
+ u8 data[1024-sizeof(extended_game_command_header)];
+
+ void bswap() {
+ header.bswap();
+ };
+};
+
TMenuListEntry(GameListEntry,
u8 difficulty_tag;
u8 num_players;
@@ -517,6 +555,7 @@ extern TTcpSocket *tcp_socket_table[16];
// pso/TProtocol.h
EXTERN_OBJECT_NAME(TProtocol);
+extern int maybe_release_flag;
extern u32 new_ip_addr;
extern u16 new_port;
extern TPlyMeetUserExtension meet_user_settings;
@@ -739,6 +778,10 @@ struct packet {
} pkt;
u8 bytes[0x7c00];
};
+
+ void bswap() {
+ pkt.header.bswap();
+ };
};
struct recv_packet_handlers {
@@ -1200,6 +1243,84 @@ public:
};
};
+class TChatMessage {
+public:
+ packet_header header;
+ TPlyGuildCardTag tag;
+ char name[16];
+ u32 to_guildcard_number;
+ char text[512];
+public:
+ void bswap() {
+ header.bswap();
+ tag.bswap();
+ bswap_32(&to_guildcard_number);
+ };
+};
+
+class TUserAns {
+public:
+ packet_header header;
+ TPlyGuildCardTag tag;
+ u32 found_guildcard;
+ TRecvPort recv_port;
+ char location[68];
+ TPlyMeetUserExtension extension;
+public:
+ void bswap() {
+ header.bswap();
+ tag.bswap();
+ bswap_32(&found_guildcard);
+ recv_port.bswap();
+ extension.bswap();
+ };
+};
+
+class TGenGuildCardTag {
+public:
+ u8 tag0;
+ u8 tag1;
+ u16 tag2;
+ u32 guildcard_number;
+public:
+ TGenGuildCardTag() {};
+
+ void bswap() {
+ bswap_32(&guildcard_number);
+ bswap_16(&tag2);
+ };
+};
+
+class TRecvGenerateID {
+public:
+ packet_header header;
+ u32 client_id;
+ TGenGuildCardTag tag;
+public:
+ void bswap() {
+ header.bswap();
+ bswap_32(&client_id);
+ tag.bswap();
+ };
+};
+
+class TPsoData {
+public:
+ union game_command_union pkt;
+public:
+ void recv_pso_data_buf(size_t size) {};
+};
+
+class TRecvPsoData {
+public:
+ packet_header header;
+ TPsoData data;
+public:
+ void bswap() {
+ header.bswap();
+ };
+};
+
class TPlyJoinLobbyData {
public:
TPlyGuildCardTag tag;
@@ -1458,6 +1579,20 @@ public:
void recv_battle_data(packet &pkt);
// 0x1C
void recv_system_file(packet &pkt);
+ // 0x60/0x62
+ void recv_pso_data(packet &pkt);
+ // 0x6C/0x6D
+ void recv_pso_data_long(packet &pkt);
+ // 0x80
+ void recv_generate_id(packet &pkt);
+ // 0x83
+ void recv_room_info(packet &pkt);
+ // 0x41
+ void recv_user_ans(packet &pkt);
+ // 0x1D
+ void recv_ping(packet &pkt);
+ // 0x81
+ void recv_chat_message(packet &pkt);
// Send command handlers.
int send_login3();