summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/pso/PSOV3Encryption.h9
-rw-r--r--include/pso/PSOV3EncryptionTCP.h4
-rw-r--r--include/pso/TMainTask.h14
-rw-r--r--include/pso/TMenuList.h135
-rw-r--r--include/pso/TObject.h150
-rw-r--r--include/pso/TPlyCharData.h7
-rw-r--r--include/pso/TPlyClientConfig.h11
-rw-r--r--include/pso/TPlyDispData.h32
-rw-r--r--include/pso/TPlyGuildCardTag.h36
-rw-r--r--include/pso/TPlyInventory.h28
-rw-r--r--include/pso/TPlySmth.h21
-rw-r--r--include/pso/TProtocol.h65
-rw-r--r--include/pso/TSocket.h40
-rw-r--r--include/pso/TTcpSocket.h4
-rw-r--r--include/pso/protocol.h7
15 files changed, 178 insertions, 385 deletions
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<u32, 522> 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 <typename T>
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 <typename T, int num_entries, int num_pad_entries>
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<TMenuListEntry<T>, num_pad_entries> pad_entries;
- TArray<TMenuListEntry<T>, num_entries> entries;
-
- void bswap();
- TMenuList &assign(const TMenuList &src);
+ TMenuListEntry<T> pad_entries[num_pad_entries];
+ TMenuListEntry<T> entries[num_entries];
} __packed__;
template <typename T, int num_entries>
class TMenuList<T, num_entries, 0> {
- public:
+public:
+ void bswap() {
+ header.bswap();
+ for (int i = 0; i < num_entries; i++) {
+ entries[i].bswap();
+ }
+ };
+public:
packet_header header;
- TArray<TMenuListEntry<T>, num_entries> entries;
-
- void bswap();
- TMenuList &assign(const TMenuList &src);
+ TMenuListEntry<T> entries[num_entries];
} __packed__;
template <typename T, int num_pad_entries>
class TMenuList<T, 0, num_pad_entries> {
- public:
- packet_header header;
- TArray<TMenuListEntry<T>, num_pad_entries> pad_entries;
-
- void bswap();
- TMenuList &assign(const TMenuList &src);
-} __packed__;
-
-
-template <typename T, int num_entries>
-void TMenuList<T, num_entries, 0>::bswap() {
- header.bswap();
- for (int i = 0; i < num_entries; i++) {
- entries[i].bswap();
- }
-}
-
-template <typename T, int num_pad_entries>
-void TMenuList<T, 0, num_pad_entries>::bswap() {
- header.bswap();
- for (int i = 0; i < num_pad_entries; i++) {
- pad_entries[i].bswap();
- }
-}
-
-template <typename T, int num_entries, int num_pad_entries>
-void TMenuList<T, num_entries, num_pad_entries>::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 <typename T>
-void TMenuListEntry<T>::bswap() {
- TPlyGuildCardTag::bswap();
- entry.bswap();
-}
-
-template <typename T, int num_entries>
-TMenuList<T, num_entries, 0> &TMenuList<T, num_entries, 0>::assign(const TMenuList<T, num_entries, 0> &src) {
- *this = src;
- return *this;
-}
-
-template <typename T, int num_pad_entries>
-TMenuList<T, 0, num_pad_entries> &TMenuList<T, 0, num_pad_entries>::assign(const TMenuList<T, 0, num_pad_entries> &src) {
- *this = src;
- return *this;
-}
-
-template <typename T, int num_entries, int num_pad_entries>
-TMenuList<T, num_entries, num_pad_entries> &TMenuList<T, num_entries, num_pad_entries>::assign(const TMenuList<T, num_entries, num_pad_entries> &src) {
- *this = src;
- return *this;
-}
-
-template <typename T>
-void TMenuListEntry<T>::_assign(const TMenuListEntry<T> &src) {
- TPlyGuildCardTag::assign(src);
- entry = src.entry;
-}
-
-template <typename T>
-void TMenuListEntry<T>::assign(const TMenuListEntry<T> &src) {
- TPlyGuildCardTag::operator=(src);
- entry = src.entry;
-}
+ };
+public:
+ packet_header header;
+ TMenuListEntry<T> 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<object_flags>(static_cast<u16>(a) ^ static_cast<u16>(b)); };
-static inline object_flags operator&(object_flags a, object_flags b) { return static_cast<object_flags>(static_cast<u16>(a) & static_cast<u16>(b)); };
-static inline object_flags operator|(object_flags a, object_flags b) { return static_cast<object_flags>(static_cast<u16>(a) | static_cast<u16>(b)); };
-static inline object_flags operator~(object_flags a) { return static_cast<object_flags>(~static_cast<u16>(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<u16>(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<u32, 2> m_magic;
+public:
+ u32 m_magic[2];
u32 m_flags;
u32 m_proxy_dst_addr;
u16 m_proxy_dst_port;
- TArray<u8, 14> 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<char, 16> name;
- TArray<u32, 2> smth;
+ char name[16];
+ u32 smth[2];
u32 name_colour;
u8 extra_model;
- TArray<u8, 15> 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<TPlyDispConfigSmthTag, 4> m_tags;
- TArray<TPlyDispConfigSmthTag, 4> 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<u8, 20> 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<u8, 12> data_u8;
- TArray<u16, 6> data_u16;
- TArray<u32, 3> data_u32;
+ u8 data_u8[12];
+ u16 data_u16[6];
+ u32 data_u32[3];
} data1;
u32 id;
union {
- TArray<u8, 4> data_u8;
- TArray<u8, 2> 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<u8, 4> 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<TPlyInventoryItem, 30> 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<u32>());
- bswap_32(m_smth1.as<u32>());
+ bswap_32(reinterpret_cast<u32 *>(&m_smth));
+ bswap_32(reinterpret_cast<u32 *>(&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<u8, 4> m_smth;
- TArray<u8, 4> 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<u8, 0x7c00-sizeof(packet_header)> 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<char, 16> name;
+ char name[16];
u8 episode;
u8 flags;
};
@@ -54,8 +54,8 @@ struct LobbyListEntry {
};
struct QuestListEntry {
- TArray<char, 32> name;
- TArray<char, 112> 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<u8, 80> m_unused3;
+ u8 m_unused3[80];
TPlyCharData m_character_data;
u32 m_unused4;
TMenuListEntry<GameListEntry> m_game_entries[64];
TMenuListEntry<GameListEntry> m_game_entries2[64];
TMenuListEntry<LobbyListEntry> m_lobby_entries[16];
TMenuListEntry<QuestListEntry> m_quest_entries[30];
- TArray<u8, 128> m_unused5;
- TArray<char, 17> m_serial_number3;
- TArray<char, 17> m_password2;
- TArray<char, 48> m_serial_number;
- TArray<char, 48> m_access_key;
- TArray<char, 64> m_password;
- TArray<char, 16> m_player_name;
- TArray<char, 17> m_serial_number2;
- TArray<char, 17> 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<recv_packet_handler, 52> 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<GameListEntry>, game_entries, 64);
- PRIVATE_MEMBER_ACCESSORS_C_ARRAY(TMenuListEntry<GameListEntry>, game_entries2, 64);
- PRIVATE_MEMBER_ACCESSORS_C_ARRAY(TMenuListEntry<LobbyListEntry>, lobby_entries, 16);
- PRIVATE_MEMBER_ACCESSORS_C_ARRAY(TMenuListEntry<QuestListEntry>, 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<u8, 4> 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<u8, 64> m_unused2;
- TArray<u8, 2048> 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 <global_types.h>
+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