From 1f357bb6afb918d4cf333f5aab87d4751fbfa6af Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Wed, 17 May 2023 15:07:28 -0300 Subject: TProtocol: Add (and match) the `SndPsoData` related command senders, along with a few other senders Man, those `SndPsoData` functions took way longer then they should've to figure out, mostly due to typecasting, and general weirdness. --- include/pso/TProtocol.h | 14 +++++++ include/pso/packet_classes.h | 94 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 104 insertions(+), 4 deletions(-) (limited to 'include/pso') diff --git a/include/pso/TProtocol.h b/include/pso/TProtocol.h index 98976b7..ca80ffe 100644 --- a/include/pso/TProtocol.h +++ b/include/pso/TProtocol.h @@ -266,6 +266,20 @@ public: void send_text_list(); // 0x61 void send_chara_data_v2(TPlyCharData &char_data, TPlyChallenge &challenge, TPlyChoiceSearchConfig &choice_search_config, TBlockedSenders &blocked_senders, TPlyText<512> &auto_reply, char *info_board); + // 0x98 + void send_update_chara_data_v2(TPlyCharData &char_data, TPlyChallenge &challenge, TPlyChoiceSearchConfig &choice_search_config, TBlockedSenders &blocked_senders, TPlyText<512> &auto_reply, char *info_board); + // 0x60 + void send_pso_data(game_command &packet, u32 size); + // 0x62 + void send_pso_data2(u32 flags, game_command &packet, u32 size); + // 0x6D + void send_pso_data_long2(char flags, long_game_command &packet, size_t size); + // 0x84 + void send_room_change(int idx); + // 0x40 + void send_find_user(TPlyGuildCardTag &tag, u32 gc_num); + // 0xC1 + void send_create_game(char *name, char *password, u8 difficulty, u8 battle_mode, u8 challenge_mode, u8 episode); }; #endif diff --git a/include/pso/packet_classes.h b/include/pso/packet_classes.h index e0a78bd..d49c49a 100644 --- a/include/pso/packet_classes.h +++ b/include/pso/packet_classes.h @@ -25,8 +25,8 @@ struct TPlyText { }; struct game_command_header { - u8 command; - u8 size; + char command; + char size; u16 id; void bswap() { @@ -44,6 +44,24 @@ struct extended_game_command_header { }; }; +struct long_game_command { + game_command_header header; + u8 data[1460-sizeof(game_command_header)]; + + void bswap() { + header.bswap(); + }; +}; + +struct extended_long_game_command { + extended_game_command_header header; + u8 data[1460-sizeof(extended_game_command_header)]; + + void bswap() { + header.bswap(); + }; +}; + struct game_command { game_command_header header; u8 data[1024-sizeof(game_command_header)]; @@ -85,6 +103,53 @@ union game_command_union { u8 bytes[1024]; }; +union long_game_command_union { + struct long_game_command game_cmd; + struct extended_long_game_command ext_game_cmd; + u8 bytes[1460]; +}; + +class TCreateGame { +public: + packet_header header; + TPlyGuildCardTag tag; + char name[16]; + char password[16]; + u8 difficulty; + u8 battle_mode; + u8 challenge_mode; + u8 episode; +public: + void bswap() { + header.bswap(); + tag.bswap(); + }; +}; + +class TFindUser { +public: + packet_header header; + TPlyGuildCardTag tag; + u32 target_gc; +public: + void bswap() { + header.bswap(); + tag.bswap(); + bswap_32(&target_gc); + }; +}; + +class TRoomChange { +public: + packet_header header; + TPlyGuildCardTag tag; +public: + void bswap() { + header.bswap(); + tag.bswap(); + }; +}; + class TBlockedSenders { public: packet_header header; @@ -275,11 +340,32 @@ public: }; }; -class TPsoData { +class TPsoDataBuf { +public: + void recv_pso_data_buf(size_t size) {}; +}; + +class TPsoDataLong : public TPsoDataBuf { +public: + union { + union long_game_command_union pkt; + u8 bytes[0x8000]; + }; +}; + +class TPsoData : public TPsoDataBuf { public: union game_command_union pkt; +}; + +class TRecvPsoDataLong { public: - void recv_pso_data_buf(size_t size) {}; + packet_header header; + TPsoDataLong data; +public: + void bswap() { + header.bswap(); + }; }; class TRecvPsoData { -- cgit v1.2.3-13-gbd6f