From 09c901655db3bb42d2aac4b506846b18833d777c Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Tue, 7 Mar 2023 15:23:51 -0400 Subject: global: Completly disable inlining This is because it looks more, and more clear that the entire codebase was compiled without inlining. Likely to reduce code size from all the byteswap functions, only present on the GameCube version. --- include/pso/PSOV3Encryption.h | 9 +-- include/pso/PSOV3EncryptionTCP.h | 4 +- include/pso/TMainTask.h | 14 +--- include/pso/TMenuList.h | 135 +++++++++++------------------------ include/pso/TObject.h | 150 ++++++++++++++++----------------------- include/pso/TPlyCharData.h | 7 +- include/pso/TPlyClientConfig.h | 11 +-- include/pso/TPlyDispData.h | 32 +++------ include/pso/TPlyGuildCardTag.h | 36 ++++++---- include/pso/TPlyInventory.h | 28 +++----- include/pso/TPlySmth.h | 21 ++---- include/pso/TProtocol.h | 65 ++++------------- include/pso/TSocket.h | 40 +---------- include/pso/TTcpSocket.h | 4 -- include/pso/protocol.h | 7 +- 15 files changed, 178 insertions(+), 385 deletions(-) (limited to 'include/pso') diff --git a/include/pso/PSOV3Encryption.h b/include/pso/PSOV3Encryption.h index ae48f6b..d34cd4f 100644 --- a/include/pso/PSOV3Encryption.h +++ b/include/pso/PSOV3Encryption.h @@ -22,13 +22,8 @@ public: virtual ~PSOV3Encryption(); virtual void init(u32 seed); virtual u32 next(); - - PRIVATE_MEMBER_ACCESSORS_ARRAY(u32, buffer, 522); - PRIVATE_MEMBER_ACCESSORS_NON_REF(u32 *, buffer_start); - PRIVATE_MEMBER_ACCESSORS_NON_REF(u32 *, buffer_end); - -private: - TArray m_buffer; +public: + u32 m_buffer[522]; u32 *m_buffer_start; u32 *m_buffer_end; }; diff --git a/include/pso/PSOV3EncryptionTCP.h b/include/pso/PSOV3EncryptionTCP.h index da3208d..9546df0 100644 --- a/include/pso/PSOV3EncryptionTCP.h +++ b/include/pso/PSOV3EncryptionTCP.h @@ -15,9 +15,7 @@ public: void reset(u32 seed); void encrypt(void *void_data, int size); - - PRIVATE_MEMBER_ACCESSORS(u32, seed); -private: +public: u32 m_seed; }; diff --git a/include/pso/TMainTask.h b/include/pso/TMainTask.h index b73d69d..eb50a99 100644 --- a/include/pso/TMainTask.h +++ b/include/pso/TMainTask.h @@ -34,7 +34,7 @@ TL_OBJECTS TL_OBJECTS #undef o -class TMainTask : private TObject { +class TMainTask : public TObject { public: u32 task_flags; u32 mbr_0x20; @@ -66,17 +66,5 @@ public: virtual void run_task(); virtual void render(); virtual void render_shadows(); -private: - void set_task_flags(u32 flags) { - this->task_flags |= flags; - } - - void clear_task_flags(u32 flags) { - this->task_flags &= ~flags; - } - - u32 get_task_flags(u32 flags) { - return this->task_flags & flags; - }; }; #endif diff --git a/include/pso/TMenuList.h b/include/pso/TMenuList.h index af71a87..d065622 100644 --- a/include/pso/TMenuList.h +++ b/include/pso/TMenuList.h @@ -10,120 +10,65 @@ template class TMenuListEntry : public TPlyGuildCardTag { - public: - T entry; - +public: TMenuListEntry() : TPlyGuildCardTag() {}; - void bswap(); - void assign(const TMenuListEntry &src); - - TMenuListEntry &operator=(const TMenuListEntry &src) { - _assign(src); - return *this; + void bswap() { + TPlyGuildCardTag::bswap(); + entry.bswap(); }; - - private: - void _assign(const TMenuListEntry &src); +public: + T entry; } __packed__; template class TMenuList { - public: +public: + void bswap() { + header.bswap(); + if (num_pad_entries) { + for (int i = 0; i < num_pad_entries; i++) { + pad_entries[i].bswap(); + } + } + if (num_entries) { + for (int i = 0; i < num_entries; i++) { + entries[i].bswap(); + } + } + }; +public: packet_header header; - TArray, num_pad_entries> pad_entries; - TArray, num_entries> entries; - - void bswap(); - TMenuList &assign(const TMenuList &src); + TMenuListEntry pad_entries[num_pad_entries]; + TMenuListEntry entries[num_entries]; } __packed__; template class TMenuList { - public: +public: + void bswap() { + header.bswap(); + for (int i = 0; i < num_entries; i++) { + entries[i].bswap(); + } + }; +public: packet_header header; - TArray, num_entries> entries; - - void bswap(); - TMenuList &assign(const TMenuList &src); + TMenuListEntry entries[num_entries]; } __packed__; template class TMenuList { - public: - packet_header header; - TArray, num_pad_entries> pad_entries; - - void bswap(); - TMenuList &assign(const TMenuList &src); -} __packed__; - - -template -void TMenuList::bswap() { - header.bswap(); - for (int i = 0; i < num_entries; i++) { - entries[i].bswap(); - } -} - -template -void TMenuList::bswap() { - header.bswap(); - for (int i = 0; i < num_pad_entries; i++) { - pad_entries[i].bswap(); - } -} - -template -void TMenuList::bswap() { - header.bswap(); - if (num_pad_entries) { +public: + void bswap() { + header.bswap(); for (int i = 0; i < num_pad_entries; i++) { pad_entries[i].bswap(); } - } - if (num_entries) { - for (int i = 0; i < num_entries; i++) { - entries[i].bswap(); - } - } -} - -template -void TMenuListEntry::bswap() { - TPlyGuildCardTag::bswap(); - entry.bswap(); -} - -template -TMenuList &TMenuList::assign(const TMenuList &src) { - *this = src; - return *this; -} - -template -TMenuList &TMenuList::assign(const TMenuList &src) { - *this = src; - return *this; -} - -template -TMenuList &TMenuList::assign(const TMenuList &src) { - *this = src; - return *this; -} - -template -void TMenuListEntry::_assign(const TMenuListEntry &src) { - TPlyGuildCardTag::assign(src); - entry = src.entry; -} - -template -void TMenuListEntry::assign(const TMenuListEntry &src) { - TPlyGuildCardTag::operator=(src); - entry = src.entry; -} + }; +public: + packet_header header; + TMenuListEntry pad_entries[num_pad_entries]; +} __packed__; #endif diff --git a/include/pso/TObject.h b/include/pso/TObject.h index 55e49ce..b1d4748 100644 --- a/include/pso/TObject.h +++ b/include/pso/TObject.h @@ -35,104 +35,80 @@ enum object_flags { ALL_BITS = 0xFFFF }; -static inline object_flags operator^(object_flags a, object_flags b) { return static_cast(static_cast(a) ^ static_cast(b)); }; -static inline object_flags operator&(object_flags a, object_flags b) { return static_cast(static_cast(a) & static_cast(b)); }; -static inline object_flags operator|(object_flags a, object_flags b) { return static_cast(static_cast(a) | static_cast(b)); }; -static inline object_flags operator~(object_flags a) { return static_cast(~static_cast(a)); } -static inline void operator^=(object_flags &a, object_flags b) { a = a ^ b; }; -static inline void operator&=(object_flags &a, object_flags b) { a = a & b; }; -static inline void operator|=(object_flags &a, object_flags b) { a = a | b; }; - class TObject { -private: - void _delete_children() { - while (m_down != NULL) { - delete m_down; - } - }; - void add_parent(TObject *parent, bool set_parent) { - if (set_parent) { - m_up = parent; - } - TObject *child; - if (parent == NULL) { - m_prev = this; - m_next = NULL; - return; - } - child = parent->m_down; - if (child != NULL) { - m_prev = child->m_next; - m_next = NULL; - child->m_prev->m_next = this; - child->m_prev = this; - } else { - m_prev = this; - parent->m_down = this; - m_next = NULL; - } - }; - void remove_parent() { - if (m_up != NULL) { - if (m_prev == this) { - m_up->m_down = NULL; - } else if (m_up->m_down == this) { - m_up->m_down = m_next; - m_prev->m_next = NULL; - if (m_next != NULL) { - m_next->m_prev = m_prev; - } - } else { - m_prev->m_next = m_next; - if (m_next != NULL) { - m_next->m_prev = m_prev; - } else { - m_up->m_down->m_prev = m_prev; - } - } - } - }; - - void set_flags(object_flags flags) { - m_flags |= flags; +#ifdef TOBJECT_CPP + #define _delete_children() { \ + while (m_down != NULL) { \ + delete m_down; \ + } \ } - - void clear_flags(object_flags flags) { - m_flags_u16 &= ~static_cast(flags); + #define add_parent(parent, set_parent) { \ + if (set_parent) { \ + m_up = parent; \ + } \ + /*TObject *child;*/ \ + if (parent == NULL) { \ + m_prev = this; \ + m_next = NULL; \ + } else { \ + TObject *child = parent->m_down; \ + if (child != NULL) { \ + m_prev = child->m_next; \ + m_next = NULL; \ + child->m_prev->m_next = this; \ + child->m_prev = this; \ + } else { \ + m_prev = this; \ + parent->m_down = this; \ + m_next = NULL; \ + } \ + } \ } - - void toggle_flags(object_flags flags) { - m_flags ^= flags; + #define remove_parent() { \ + if (m_up != NULL) { \ + if (m_prev == this) { \ + m_up->m_down = NULL; \ + } else if (m_up->m_down == this) { \ + m_up->m_down = m_next; \ + m_prev->m_next = NULL; \ + if (m_next != NULL) { \ + m_next->m_prev = m_prev; \ + } \ + } else { \ + m_prev->m_next = m_next; \ + if (m_next != NULL) { \ + m_next->m_prev = m_prev; \ + } else { \ + m_up->m_down->m_prev = m_prev; \ + } \ + } \ + } \ } - - u32 get_flags(object_flags flags) { - return m_flags & flags; - }; - - +#endif public: const char *m_name; - union { - object_flags m_flags; - u16 m_flags_u16; - }; + u16 m_flags; u16 m_id; TObject *m_prev; TObject *m_next; TObject *m_up; TObject *m_down; public: - void disallow_rendering_shadows(); - void allow_rendering_shadows(); - void disallow_rendering(); - void allow_rendering(); - void toggle_flag_3(); - void set_flag_3(); - void clear_flag_3(); - void queue_destruction(); - void set_flag_9(); - u32 get_flag_9(); - void clear_flag_9(); + void allow_rendering_shadows() { m_flags &= ~DISALLOW_RENDER_SHADOWS; }; + void disallow_rendering_shadows() { m_flags |= DISALLOW_RENDER_SHADOWS; }; + + void clear_flag_9() { m_flags &= ~BIT_9; }; + void set_flag_9() { m_flags |= BIT_9; }; + u32 get_flag_9() { return m_flags & BIT_9; }; + + void allow_rendering() { m_flags &= ~DISALLOW_RENDER; }; + void disallow_rendering() { m_flags |= DISALLOW_RENDER; }; + + void clear_flag_3() { m_flags &= ~BIT_3; }; + void set_flag_3() { m_flags |= BIT_3; }; + void toggle_flag_3() { m_flags ^= BIT_3; }; + + void queue_destruction() { m_flags |= QUEUE_DESTRUCTION; }; TObject(TObject *parent = NULL); virtual ~TObject(); @@ -157,8 +133,6 @@ public: void log(const char *str); int get_node_count(); int all_parents_unqueued_for_destruction(); - static void *alloc(size_t size); - static void free(void *ptr); bool toggle_flag_9_if_flag_10_is_clear(); }; diff --git a/include/pso/TPlyCharData.h b/include/pso/TPlyCharData.h index d516c10..7e0036c 100644 --- a/include/pso/TPlyCharData.h +++ b/include/pso/TPlyCharData.h @@ -10,13 +10,10 @@ class TPlyCharData { public: - TPlyCharData() {} + TPlyCharData() {}; void bswap(); TPlyCharData &assign(const TPlyCharData &src); - - PRIVATE_MEMBER_ACCESSORS(TPlyInventory, inventory); - PRIVATE_MEMBER_ACCESSORS(TPlyDispData, disp_data); -private: +public: TPlyInventory m_inventory; TPlyDispData m_disp_data; }; diff --git a/include/pso/TPlyClientConfig.h b/include/pso/TPlyClientConfig.h index 6551fc2..b4c9103 100644 --- a/include/pso/TPlyClientConfig.h +++ b/include/pso/TPlyClientConfig.h @@ -8,17 +8,12 @@ class TPlyClientConfig { public: - PRIVATE_MEMBER_ACCESSORS_ARRAY(u32, magic, 2); - PRIVATE_MEMBER_ACCESSORS(u32, flags); - PRIVATE_MEMBER_ACCESSORS(u32, proxy_dst_addr); - PRIVATE_MEMBER_ACCESSORS(u16, proxy_dst_port); - PRIVATE_MEMBER_ACCESSORS_ARRAY(u8, mbr_0xe, 14); -private: - TArray m_magic; +public: + u32 m_magic[2]; u32 m_flags; u32 m_proxy_dst_addr; u16 m_proxy_dst_port; - TArray m_mbr_0xe; + u8 m_mbr_0xe[14]; }; #endif diff --git a/include/pso/TPlyDispData.h b/include/pso/TPlyDispData.h index 7901fb9..2113d04 100644 --- a/include/pso/TPlyDispData.h +++ b/include/pso/TPlyDispData.h @@ -38,11 +38,11 @@ struct disp_data_part2 { void bswap(); disp_data_part2 &assign(const disp_data_part2 &src); - TArray name; - TArray smth; + char name[16]; + u32 smth[2]; u32 name_colour; u8 extra_model; - TArray padding; + u8 padding[15]; u32 name_colour_checksum; u8 section_id; u8 char_class; @@ -67,9 +67,7 @@ public: void bswap(); TPlyDispConfigSmthTag &assign(const TPlyDispConfigSmthTag &src); - - PRIVATE_MEMBER_ACCESSORS(gc_tag, tag); -private: +public: gc_tag m_tag; }; @@ -77,23 +75,16 @@ class TPlyDispConfigSmth { public: void bswap(); TPlyDispConfigSmth &assign(const TPlyDispConfigSmth &src); - - PRIVATE_MEMBER_ACCESSORS(u32, mbr_0x0); - PRIVATE_MEMBER_ACCESSORS_ARRAY(TPlyDispConfigSmthTag, tags, 4); - PRIVATE_MEMBER_ACCESSORS_ARRAY(TPlyDispConfigSmthTag, tags1, 4); -private: +public: u32 m_mbr_0x0; - TArray m_tags; - TArray m_tags1; + TPlyDispConfigSmthTag m_tags[4]; + TPlyDispConfigSmthTag m_tags1[4]; }; class TPlyDispConfig { public: void bswap(); TPlyDispConfig &assign(const TPlyDispConfig &src); - - PRIVATE_MEMBER_ACCESSORS(TPlyDispConfigSmth, smth); - PRIVATE_MEMBER_ACCESSORS(TPlyDispConfigSmth, smth1); private: TPlyDispConfigSmth m_smth; TPlyDispConfigSmth m_smth1; @@ -103,16 +94,11 @@ class TPlyDispData { public: void bswap(); TPlyDispData &assign(const TPlyDispData &src); - - PRIVATE_MEMBER_ACCESSORS(player_stats, stats); - PRIVATE_MEMBER_ACCESSORS(disp_data_part2, disp_part2); - PRIVATE_MEMBER_ACCESSORS(TPlyDispConfig, config); - PRIVATE_MEMBER_ACCESSORS_ARRAY(u8, tech_levels, 20); -private: +public: player_stats m_stats; disp_data_part2 m_disp_part2; TPlyDispConfig m_config; - TArray m_tech_levels; + u8 m_tech_levels[20]; }; #endif diff --git a/include/pso/TPlyGuildCardTag.h b/include/pso/TPlyGuildCardTag.h index 8a8e577..de96902 100644 --- a/include/pso/TPlyGuildCardTag.h +++ b/include/pso/TPlyGuildCardTag.h @@ -13,24 +13,32 @@ struct gc_tag { class TPlyGuildCardTag { public: - TPlyGuildCardTag(); - TPlyGuildCardTag(u16 tag2, u32 guildcard_number); - - TPlyGuildCardTag &operator=(const TPlyGuildCardTag &src); - - void bswap(); - void assign(const TPlyGuildCardTag &src); - void assign(const TPlyGuildCardTag *src); + TPlyGuildCardTag() {}; + TPlyGuildCardTag(u16 tag2, u32 guildcard_number) { + m_tag.tag0 = 0; + m_tag.tag1 = 0; + m_tag.tag2 = tag2; + m_guildcard_number = guildcard_number; + }; - PRIVATE_MEMBER_ACCESSORS(gc_tag, tag); - PRIVATE_MEMBER_ACCESSORS(u32, tag_u32); - PRIVATE_MEMBER_ACCESSORS(u32, guildcard_number); -private: - void _assign(const TPlyGuildCardTag &src) { - m_tag = src.m_tag; + TPlyGuildCardTag &operator=(const TPlyGuildCardTag &src) { + m_tag.tag0 = src.m_tag.tag0; + m_tag.tag1 = src.m_tag.tag1; + m_tag.tag2 = src.m_tag.tag2; m_guildcard_number = src.m_guildcard_number; }; + void bswap() { + bswap_32(&m_guildcard_number); + bswap_16(&m_tag.tag2); + }; + + void assign(const TPlyGuildCardTag &src) { *this = src; }; + void assign(const TPlyGuildCardTag *src) { + m_tag_u32 = src->m_tag_u32; + m_guildcard_number = src->m_guildcard_number; + }; +public: union { gc_tag m_tag; u32 m_tag_u32; diff --git a/include/pso/TPlyInventory.h b/include/pso/TPlyInventory.h index 6cfb7ec..397b4cc 100644 --- a/include/pso/TPlyInventory.h +++ b/include/pso/TPlyInventory.h @@ -12,14 +12,14 @@ struct TItemData { TItemData &assign(const TItemData &src); union { - TArray data_u8; - TArray data_u16; - TArray data_u32; + u8 data_u8[12]; + u16 data_u16[6]; + u32 data_u32[3]; } data1; u32 id; union { - TArray data_u8; - TArray data_u16; + u8 data_u8[4]; + u8 data_u16[2]; u32 data_u32; } data2; }; @@ -29,12 +29,8 @@ public: void init(); void bswap(); TPlyInventoryItem &assign(const TPlyInventoryItem &src); - - PRIVATE_MEMBER_ACCESSORS_ARRAY(u8, present, 4); - PRIVATE_MEMBER_ACCESSORS(u32, flags); - PRIVATE_MEMBER_ACCESSORS(TItemData, data); -private: - TArray m_present; +public: + u8 m_present[4]; u32 m_flags; TItemData m_data; }; @@ -43,18 +39,12 @@ class TPlyInventory { public: void bswap(); TPlyInventory &assign(const TPlyInventory &src); - - PRIVATE_MEMBER_ACCESSORS(u8, num_items); - PRIVATE_MEMBER_ACCESSORS(u8, hp_materials_used); - PRIVATE_MEMBER_ACCESSORS(u8, tp_materials_used); - PRIVATE_MEMBER_ACCESSORS(u8, language); - PRIVATE_MEMBER_ACCESSORS_ARRAY(TPlyInventoryItem, items, 30); -private: +public: u8 m_num_items; u8 m_hp_materials_used; u8 m_tp_materials_used; u8 m_language; - TArray m_items; + TPlyInventoryItem m_items[30]; }; #endif diff --git a/include/pso/TPlySmth.h b/include/pso/TPlySmth.h index 99bf763..2530c7b 100644 --- a/include/pso/TPlySmth.h +++ b/include/pso/TPlySmth.h @@ -10,24 +10,13 @@ class TPlySmth { public: TPlySmth() {}; - //TPlySmth &operator=(const TPlySmth &src) { return assign(src); }; - void bswap() { - bswap_32(m_smth.as()); - bswap_32(m_smth1.as()); + bswap_32(reinterpret_cast(&m_smth)); + bswap_32(reinterpret_cast(&m_smth1)); }; - - TPlySmth &assign(const TPlySmth &src) /*{ - m_smth = src.m_smth; - }*/; - - PRIVATE_MEMBER_ACCESSORS_ARRAY(u8, smth, 4); - PRIVATE_MEMBER_ACCESSORS_ARRAY(u8, smth1, 4); - - friend class TProtocol; -protected: - TArray m_smth; - TArray m_smth1; +public: + u8 m_smth[4]; + u8 m_smth1[4]; }; #endif diff --git a/include/pso/TProtocol.h b/include/pso/TProtocol.h index ac2589e..f9d22f9 100644 --- a/include/pso/TProtocol.h +++ b/include/pso/TProtocol.h @@ -25,7 +25,7 @@ struct packet { union { struct { packet_header header; - TArray data; + u8 data[0x7c00-sizeof(packet_header)]; } pkt; u8 bytes[0x7c00]; }; @@ -44,7 +44,7 @@ struct packet { struct GameListEntry { u8 difficulty_tag; u8 num_players; - TArray name; + char name[16]; u8 episode; u8 flags; }; @@ -54,8 +54,8 @@ struct LobbyListEntry { }; struct QuestListEntry { - TArray name; - TArray short_description; + char name[32]; + char short_description[112]; }; typedef void (*recv_packet_handler)(packet &pkt); @@ -76,27 +76,27 @@ public: int m_unused2; int m_udp_disabled; int m_language; - TArray m_unused3; + u8 m_unused3[80]; TPlyCharData m_character_data; u32 m_unused4; TMenuListEntry m_game_entries[64]; TMenuListEntry m_game_entries2[64]; TMenuListEntry m_lobby_entries[16]; TMenuListEntry m_quest_entries[30]; - TArray m_unused5; - TArray m_serial_number3; - TArray m_password2; - TArray m_serial_number; - TArray m_access_key; - TArray m_password; - TArray m_player_name; - TArray m_serial_number2; - TArray m_access_key2; + u8 m_unused5[128]; + char m_serial_number3[17]; + char m_password2[17]; + char m_serial_number[48]; + char m_access_key[48]; + char m_password[64]; + char m_player_name[16]; + char m_serial_number2[17]; + char m_access_key2[17]; TPlyClientConfig m_client_config; int m_packet_offset; int m_packet_size; struct packet m_packet; - TArray m_recv_handlers; + recv_packet_handler m_recv_handlers[52]; public: TProtocol(TObject *parent, u16 sub_version, int language, char *serial_number, char *access_key, char *password); virtual ~TProtocol(); @@ -107,41 +107,6 @@ public: void some_stub() {}; int handle_command(struct packet *pkt); void parse_packet(); - - PRIVATE_MEMBER_ACCESSORS(TPlySmth, smth); - PRIVATE_MEMBER_ACCESSORS(TPlyGuildCardTag, guildcard_tag); - PRIVATE_MEMBER_ACCESSORS(u16, sub_version); - PRIVATE_MEMBER_ACCESSORS(int, login_response_state); - PRIVATE_MEMBER_ACCESSORS(int, connected); - PRIVATE_MEMBER_ACCESSORS(int, joined_game); - PRIVATE_MEMBER_ACCESSORS(int, has_meet_user_settings); - PRIVATE_MEMBER_ACCESSORS(int, handle_pings_only); - PRIVATE_MEMBER_ACCESSORS(int, entry_count); - PRIVATE_MEMBER_ACCESSORS(int, unused); - PRIVATE_MEMBER_ACCESSORS(int, lobby_list_count); - PRIVATE_MEMBER_ACCESSORS(int, unused2); - PRIVATE_MEMBER_ACCESSORS(int, udp_disabled); - PRIVATE_MEMBER_ACCESSORS(int, language); - PRIVATE_MEMBER_ACCESSORS_ARRAY(u8, unused3, 80); - PRIVATE_MEMBER_ACCESSORS(TPlyCharData, character_data); - PRIVATE_MEMBER_ACCESSORS(u32, unused4); - PRIVATE_MEMBER_ACCESSORS_C_ARRAY(TMenuListEntry, game_entries, 64); - PRIVATE_MEMBER_ACCESSORS_C_ARRAY(TMenuListEntry, game_entries2, 64); - PRIVATE_MEMBER_ACCESSORS_C_ARRAY(TMenuListEntry, lobby_entries, 16); - PRIVATE_MEMBER_ACCESSORS_C_ARRAY(TMenuListEntry, quest_entries, 30); - PRIVATE_MEMBER_ACCESSORS_ARRAY(u8, unused5, 128); - PRIVATE_MEMBER_ACCESSORS_ARRAY(char, serial_number3, 17); - PRIVATE_MEMBER_ACCESSORS_ARRAY(char, password2, 17); - PRIVATE_MEMBER_ACCESSORS_ARRAY(char, serial_number, 48); - PRIVATE_MEMBER_ACCESSORS_ARRAY(char, access_key, 48); - PRIVATE_MEMBER_ACCESSORS_ARRAY(char, password, 64); - PRIVATE_MEMBER_ACCESSORS_ARRAY(char, player_name, 16); - PRIVATE_MEMBER_ACCESSORS_ARRAY(char, serial_number2, 17); - PRIVATE_MEMBER_ACCESSORS_ARRAY(char, access_key2, 17); - PRIVATE_MEMBER_ACCESSORS(int, packet_offset); - PRIVATE_MEMBER_ACCESSORS(int, packet_size); - PRIVATE_MEMBER_ACCESSORS(struct packet, packet); - PRIVATE_MEMBER_ACCESSORS_ARRAY(recv_packet_handler, recv_handlers, 52); }; #endif diff --git a/include/pso/TSocket.h b/include/pso/TSocket.h index e4c5c5e..4a1f5ab 100644 --- a/include/pso/TSocket.h +++ b/include/pso/TSocket.h @@ -10,7 +10,7 @@ union ipv4_addr { u32 addr; - TArray addr_bytes; + u8 addr_bytes[4]; }; extern u16 to_be_uint16_t(u16 val); @@ -28,8 +28,8 @@ public: s16 m_size; s16 m_buffer_offset; u32 m_unused; - TArray m_unused2; - TArray m_packet_buffer; + u8 m_unused2[64]; + u8 m_packet_buffer[2048]; s16 m_stat_val; u16 m_unused3; u32 m_send_window; @@ -50,40 +50,6 @@ public: void set_port(u32 port); const u8 next(); int is_empty(); - - void set_flags(u8 flags) { - m_is_invalid_packet |= flags; - }; - - void clear_flags(u8 flags) { - m_is_invalid_packet &= ~flags; - }; - - void toggle_flags(u8 flags) { - m_is_invalid_packet ^= flags; - }; - - u8 get_flags(u8 flags) { - return m_is_invalid_packet & flags; - }; - - PRIVATE_MEMBER_ACCESSORS(ipv4_addr, dst_addr); - PRIVATE_MEMBER_ACCESSORS(u16, dst_port); - PRIVATE_MEMBER_ACCESSORS(u16, src_port); - PRIVATE_MEMBER_ACCESSORS(ipv4_addr, src_addr); - PRIVATE_MEMBER_ACCESSORS(s16, sock_fd); - PRIVATE_MEMBER_ACCESSORS(char, is_invalid_packet); - PRIVATE_MEMBER_ACCESSORS(char, buffer_cleared); - PRIVATE_MEMBER_ACCESSORS(s16, size); - PRIVATE_MEMBER_ACCESSORS(s16, buffer_offset); - PRIVATE_MEMBER_ACCESSORS(u32, unused); - PRIVATE_MEMBER_ACCESSORS_ARRAY(u8, unused2, 64); - PRIVATE_MEMBER_ACCESSORS_ARRAY(u8, packet_buffer, 2048); - PRIVATE_MEMBER_ACCESSORS(s16, stat_val); - PRIVATE_MEMBER_ACCESSORS(u16, unused3); - PRIVATE_MEMBER_ACCESSORS(u32, send_window); - PRIVATE_MEMBER_ACCESSORS(u32, recv_window); - PRIVATE_MEMBER_ACCESSORS_FUNC(void, callback, TSocket *socket); }; #endif diff --git a/include/pso/TTcpSocket.h b/include/pso/TTcpSocket.h index 0e47ef0..aa0790a 100644 --- a/include/pso/TTcpSocket.h +++ b/include/pso/TTcpSocket.h @@ -36,10 +36,6 @@ public: int test_connection(); static void notify(short size, short sock_fd); - - PRIVATE_MEMBER_ACCESSORS(PSOV3EncryptionTCP, send_crypt); - PRIVATE_MEMBER_ACCESSORS(PSOV3EncryptionTCP, recv_crypt); - PRIVATE_MEMBER_ACCESSORS(int, is_encrypted); }; #endif diff --git a/include/pso/protocol.h b/include/pso/protocol.h index 697f6b0..140a024 100644 --- a/include/pso/protocol.h +++ b/include/pso/protocol.h @@ -5,13 +5,14 @@ #include "pso/macros.h" #include +extern void bswap_16(u16 *val); +extern void bswap_32(u32 *val); + struct packet_header { u8 command; u8 flags; u16 size; - void bswap(); + void bswap() { bswap_16(&size); }; } __packed__; -extern void bswap_16(u16 *val); -extern void bswap_32(u32 *val); #endif -- cgit v1.2.3-13-gbd6f