// Compiler version: // 2.4.2 build 81 (GC MW 1.3.2) // Compiler flags: // -nodefaults -proc gekko -fp hard -O4 -use_lmw_stmw on -enum int -str reuse -rostr -sdata2 4 -lang=c++ -Cpp_exceptions off -RTTI off // System typedefs. typedef signed char s8; typedef signed short int s16; typedef signed long s32; typedef signed long long int s64; typedef unsigned char u8; typedef unsigned short int u16; typedef unsigned long u32; typedef unsigned long long int u64; typedef int BOOL; typedef unsigned long size_t; typedef long ptrdiff_t; // Macros. #define FALSE 0 #define TRUE 1 #define NULL 0 #if !defined(__cplusplus) || __cplusplus < 201103L #ifndef nullptr #define nullptr NULL #endif #endif #define ATTRIBUTE_ALIGN(num) __attribute__((aligned(num))) // pso/macros.h #define EXTERN_OBJECT_NAME(name) extern const char *name##_name; #define OBJECT_NAME(name) const char *name##_name = #name; #define OBJECT_NAMES \ o(TObject) \ o(TMainTask) #define TL_OBJECTS \ o(tl_su, TL_SU) \ TL_OBJECTS_AT_TL_00 #define TL_OBJECTS_AT_TL_00 \ TL_00_OBJECTS \ TL_02_OBJECTS \ o(tl_particle, TL_PARTICLE) \ TL_PARTICLE_MODEL_OBJECTS #define TL_OBJECTS_AT_TL_00_WITHOUT_TL_PARTICLE \ TL_00_OBJECTS \ TL_02_OBJECTS \ TL_PARTICLE_MODEL_OBJECTS #define TL_OBJECTS_AT_TL_02 \ TL_02_OBJECTS \ o(tl_particle, TL_PARTICLE) \ TL_PARTICLE_MODEL_OBJECTS #define TL_00_OBJECTS \ o(tl_00, TL_00) \ o(tl_camera, TL_CAMERA) \ o(tl_01, TL_01) #define TL_02_OBJECTS \ o(tl_02, TL_02) \ o(tl_item_equip, TL_ITEM_EQUIP) \ o(tl_03, TL_03) \ o(tl_loc_start, TL_LOC_START) \ o(tl_04, TL_04) \ o(tl_05, TL_05) \ o(tl_06, TL_06) \ o(tl_07, TL_07) \ o(tl_loc_end, TL_LOC_END) \ o(tl_window, TL_WINDOW) #define TL_PARTICLE_MODEL_OBJECTS \ o(tl_particlemodel, TL_PARTICLEMODEL) \ o(tl_radermap, TL_RADERMAP) \ o(tl_clipout, TL_CLIPOUT) \ o(tl_fade, TL_FADE) \ o(tl_fadeafter, TL_FADEAFTER) #define FOREACH_NODE(type, first, varname) for (type *varname = (type *)(first); varname != NULL; varname = (type *)(varname->next())) #define FOREACH_NODE_NODECL(type, first, varname) for (varname = (type *)(first); varname != NULL; varname = (type *)(varname->next())) #define FOREACH_NODE_MULTI_ITER(type, first, varname, ...) for (type *varname = (type *)(first); varname != NULL; varname = (type *)(varname->next()), __VA_ARGS__) #define FOREACH_NODE_NODECL_MULTI_ITER(type, first, varname, ...) for (varname = (type *)(first); varname != NULL; varname = (type *)(varname->next()), __VA_ARGS__) #define __packed__ #define WEAK_FUNC __declspec(weak) #define PRIVATE_MEMBER_GETTER(type, name) \ type name() { \ return m_##name; \ } #define PRIVATE_MEMBER_SETTER(type, name) \ void set_##name(type val) { \ m_##name = val; \ } #define PRIVATE_MEMBER_GETTER_ARRAY(type, name, size) \ TArray &name() { \ return m_##name; \ } #define PRIVATE_MEMBER_GETTER_FUNC(ret_type, name, ...) \ ret_type (*name())(__VA_ARGS__) { \ return m_##name; \ } #define PRIVATE_MEMBER_SETTER_FUNC(ret_type, name, ...) \ void set_##name(ret_type (*val)(__VA_ARGS__)) { \ m_##name = val; \ } #define PRIVATE_MEMBER_ACCESSORS(type, name) \ PRIVATE_MEMBER_GETTER(type, name); \ PRIVATE_MEMBER_SETTER(type, name) #define PRIVATE_MEMBER_ACCESSORS(type, name) \ PRIVATE_MEMBER_GETTER(type &, name); \ PRIVATE_MEMBER_SETTER(type, name) #define PRIVATE_MEMBER_ACCESSORS_NON_REF(type, name) \ PRIVATE_MEMBER_GETTER(type, name); \ PRIVATE_MEMBER_SETTER(type, name) #define PRIVATE_MEMBER_ACCESSORS_ARRAY(type, name, size) \ PRIVATE_MEMBER_GETTER_ARRAY(type, name, size) #define PRIVATE_MEMBER_ACCESSORS_FUNC(ret_type, name, ...) \ PRIVATE_MEMBER_GETTER_FUNC(ret_type, name, __VA_ARGS__); \ PRIVATE_MEMBER_SETTER_FUNC(ret_type, name, __VA_ARGS__) // pso/TMainTask.h #define X_OR_Y_CHILD(flags, old_flags, one_prefix, zero_prefix, suffix) \ if (flags != old_flags) { \ TMainTask *child; \ u32 bit = 1; \ FOREACH_NODE_NODECL_MULTI_ITER(TMainTask, main_task.down(), child, bit <<= 1) { \ if (flags & bit) { \ child->one_prefix##_##suffix(); \ } else { \ child->zero_prefix##_##suffix(); \ } \ } \ old_flags = flags; \ } #define SET_OR_CLEAR_CHILD_FLAGS(flags, old_flags, flag_bit) \ X_OR_Y_CHILD(flags, old_flags, set_flag, clear_flag, flag_bit) #define DISALLOW_OR_ALLOW_CHILD(flags, old_flags, flag_name) \ X_OR_Y_CHILD(flags, old_flags, allow, disallow, flag_name) // pso/forward.h // Class forward. class TTcpSocket; class PSOV3EncryptionTCP; class TSocket; class THeap; class TObject; class TMainTask; class TPlyGuildCardTag; class TProtocol; struct packet; struct packet_header; // pso/TProtocol.h // User typedefs. typedef void (*recv_packet_handler)(packet &pkt); // pso/TArray.h // Template defs. template class TArray { public: T m_data[n]; public: T *data() { return m_data; }; size_t size() { return n; }; size_t byte_size() { return n * sizeof(T); }; T &at(size_t i) { return m_data[i]; } T &operator[](size_t i) { return at(i); }; T *start() { return m_data; }; T *end() { return &m_data[size()-1]; }; template T2 *as() { return reinterpret_cast(m_data); }; template T2 &at_as(size_t i) { return reinterpret_cast(at(i)); }; template size_t size_as() { return byte_size() / sizeof(T2); }; template TArray &to() { typedef TArray to_type; return reinterpret_cast(*this); }; u8 *as_bytes() { return reinterpret_cast(m_data); }; void fill(u8 val) { memset(m_data, val, byte_size()); }; template void fill_with(const T2 val) { _fill_with(val); }; template void fast_fill_with(const T2 val) { _fill_with(val); }; template void copy(const T2 &val) { _copy(val); }; template void copy_reverse(const T2 &val) { _copy_reverse(val); }; template void fast_copy(const T2 &val) { _copy(val); }; template void fast_copy_reverse(const T2 &val) { _copy_reverse(val); }; private: template void _fill_with(const T2 val) { T2 *data = as(); size_t size = size_as(); if (do_unroll_check && size <= 8) { int i = 0; switch (size) { case 8: data[i++] = val; case 7: data[i++] = val; case 6: data[i++] = val; case 5: data[i++] = val; case 4: data[i++] = val; case 3: data[i++] = val; case 2: data[i++] = val; case 1: data[i++] = val; default: break; } } else { for (int i = 0; i < size; ++i) { data[i] = val; } } }; template void _copy(const T2 &val) { size_t size = sizeof(T2)/sizeof(T); const T *src = reinterpret_cast(&val); if (do_unroll_check && size <= 8) { int i = 0; switch (size) { case 8: m_data[i] = src[i++]; case 7: m_data[i] = src[i++]; case 6: m_data[i] = src[i++]; case 5: m_data[i] = src[i++]; case 4: m_data[i] = src[i++]; case 3: m_data[i] = src[i++]; case 2: m_data[i] = src[i++]; case 1: m_data[i] = src[i++]; default: break; } } else { for (int i = 0; i < size; ++i) { m_data[i] = src[i]; } } }; template void _copy_reverse(const T2 &val) { size_t size = sizeof(T2)/sizeof(T); const T *src = reinterpret_cast(&val); if (do_unroll_check && size <= 8) { int i = size-1; int j = 0; switch (size) { case 8: m_data[i--] = src[j++]; case 7: m_data[i--] = src[j++]; case 6: m_data[i--] = src[j++]; case 5: m_data[i--] = src[j++]; case 4: m_data[i--] = src[j++]; case 3: m_data[i--] = src[j++]; case 2: m_data[i--] = src[j++]; case 1: m_data[i--] = src[j++]; default: break; } } else { for (int i = size-1, j = 0; i; --i, ++j) { m_data[i] = src[j]; } } }; }; // pso/TMenuList.h template class TMenuListEntry : public TPlyGuildCardTag { public: T entry; TMenuListEntry() : TPlyGuildCardTag() {}; void bswap(); void assign(const TMenuListEntry &src); TMenuListEntry &operator=(const TMenuListEntry &src) { _assign(src); return *this; }; private: void _assign(const TMenuListEntry &src); } __packed__; template class TMenuList { public: packet_header header; TArray, num_pad_entries> pad_entries; TArray, num_entries> entries; void bswap(); TMenuList &assign(const TMenuList &src); } __packed__; template class TMenuList { public: packet_header header; TArray, num_entries> entries; void bswap(); TMenuList &assign(const TMenuList &src); } __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) { 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; } // TMainTask.cpp // Const defs. static const int tl_object_count = 20; // TTcpSocket.cpp // Extern defs. EXTERN_OBJECT_NAME(TTcpSocket); extern TTcpSocket *tcp_socket_table[16]; // TObject.cpp #define o(name) extern const char *name##_name; OBJECT_NAMES #undef o // TMainTask.cpp #define o(var, name) extern const char *var##_name; TL_OBJECTS #undef o #define o(var, name) extern TObject *var; TL_OBJECTS #undef o // THeap.cpp extern THeap *obj_heap; extern THeap *alt_heap; // TObject.cpp extern TMainTask main_task; extern TObject global_obj1; extern TObject global_obj2; // TMainTask.cpp // Variable defs. u32 some_main_task_flag = 1; u32 update_flags; u32 old_update_flags; u32 render_flags; u32 old_render_flags; u32 render_shadow_flags; u32 old_render_shadow_flags; u32 some_id_805c6f74; // TTcpSocket.cpp // func defs. extern void func_80019aa0(); extern void controller_stuff(); extern char func_801a5d1c(); extern void render_tick(); extern void func_803d96a4(); extern short tcp_abort(short nh); extern short tcp_bind(short nh, struct at_ip_addr *addr, u16 port); extern short tcp_connect(short nh, struct at_ip_addr *addr, u16 port, struct at_ip_option *option); extern short tcp_create(); extern short tcp_delete(short nh); extern short tcp_get_opt(short nh, short type, u32 *opt); extern short tcp_send(short nh, void (*notify)(short size, short sock_fd), char bufnum, struct send_buffs *sb); extern short tcp_stat(short nh, short *stat, short *backlog, u32 *sendwin, u32 *recvwin); extern short tcp_receive(short nh, void (*notify)(short size, short sock_fd), short len, u8 *buf); extern int get_link_status(); extern char *get_sock_status_name(short code); // THeap.cpp extern void heap_xfree(void *ptr); extern void *heap_xmalloc(size_t size); // TMainTask.cpp extern void camera_stuff(); extern void set_depth_buffer_settings_1(); extern void set_depth_buffer_settings_2(); extern void set_depth_buffer_settings_3(); extern void set_depth_buffer_settings_id(u32 id); extern void save_depth_buffer_settings(); extern void restore_depth_buffer_settings(); extern void func_80083a00(); extern void func_80141618(); extern void set_some_id(u32 id); extern void func_803e11e8(u32 arg1); extern void func_803e11f0(); extern void func_803369b4(); // pso/protocol.h extern void bswap_16(u16 *val); extern void bswap_32(u32 *val); // Struct defs. struct packet_header { u8 command; u8 flags; u16 size; void bswap(); } __packed__; // pso/TMath.h struct vec2f { float x; float y; }; // pso/TPlyGuildCardTag.h struct gc_tag { u8 tag0; u8 tag1; u16 tag2; }; // pso/TPlyDispData.h struct stats { void bswap(); stats &assign(const stats &src); short atp; short mst; short evp; short hp; short dfp; short ata; short lck; }; struct player_stats { void bswap(); player_stats &assign(const player_stats &src); struct stats stats; short mbr_0xe; float proportions; float mbr_0x14; int level; int exp; int meseta; }; struct disp_data_part2 { void bswap(); disp_data_part2 &assign(const disp_data_part2 &src); TArray name; u64 smth; u32 name_colour; u8 extra_model; TArray padding; u32 name_colour_checksum; u8 section_id; u8 char_class; u8 v2_flags; u8 version; u32 v1_flags; u16 costume; u16 skin; u16 face; u16 head; u16 hair; u16 hair_r; u16 hair_g; u16 hair_b; vec2f proportions; }; // TTcpSocket.cpp, but they're really from AVE-TCP struct at_ip4_opt { u8 ttl; u8 svctype; u8 df_flag; }; struct at_ip6_opt { u8 traffic_class; u32 flow_label; u8 hop_limit; }; struct at_ip_option { u32 type; union { struct at_ip6_opt ip6; struct at_ip4_opt ip4; } ip46; }; struct at_ip_addr { u32 type; union { u8 ip6[16]; u32 ip4; } ip46; }; struct send_buffs { short len; u8 *buff; }; // pso/TProtocol.h struct packet { packet_header header; TArray data; }; // pso/TSocket.h // Union defs. union ipv4_addr { u32 addr; TArray addr_bytes; }; // pso/TObject.h // Enum defs. enum object_flags { NONE = 0, QUEUE_DESTRUCTION = 1, CHILD_QUEUE_DESTRUCTION = 2, BIT_2 = 4, BIT_3 = 8, DISALLOW_UPDATE = 0x0F, DISALLOW_RENDER = 0x10, DISALLOW_DESTRUCTION = 0x20, DISALLOW_RENDER_SHADOWS = 0x100, BIT_9 = 0x200, BIT_10 = 0x400, BIT_11 = 0x800, BIT_12 = 0x1000, BIT_13 = 0x2000, BIT_14 = 0x4000, BIT_15 = 0x8000, ALL_BITS = 0xFFFF }; // Inline operator defs. 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; }; // pso/TPlyDispData.h // Class defs. class TPlyDispConfigSmthTag { public: TPlyDispConfigSmthTag(); ~TPlyDispConfigSmthTag(); void bswap(); TPlyDispConfigSmthTag &assign(const TPlyDispConfigSmthTag &src); PRIVATE_MEMBER_ACCESSORS(gc_tag, tag); private: gc_tag m_tag; }; 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: u32 m_mbr_0x0; TArray m_tags; TArray m_tags1; }; 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; }; 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: player_stats m_stats; disp_data_part2 m_disp_part2; TPlyDispConfig m_config; TArray m_tech_levels; }; // pso/TPlyGuildCardTag.h class TPlyGuildCardTag { public: TPlyGuildCardTag(); TPlyGuildCardTag(u16 tag2, u32 guildcard_number); void bswap(); void assign(const TPlyGuildCardTag &src); void assign(const TPlyGuildCardTag *src); 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; m_guildcard_number = src.m_guildcard_number; }; union { gc_tag m_tag; u32 m_tag_u32; }; u32 m_guildcard_number; } __packed__; // pso/PSOV3EncryptionTCP.h class PSOV3EncryptionTCP : public PSOV3Encryption { public: PSOV3EncryptionTCP(); ~PSOV3EncryptionTCP(); void reset(u32 seed); void encrypt(void *void_data, int size); PRIVATE_MEMBER_ACCESSORS(u32, seed); private: u32 m_seed; }; // pso/THeap.h class THeap { public: struct heap_node { heap_node *next; size_t remaining_size; }; heap_node *heap_nodes; size_t mbr_0x04; size_t align; size_t mbr_0x0C; size_t mbr_0x10; public: THeap(size_t size, int align); ~THeap(); void *operator new(size_t size) { return heap_xmalloc(size); }; void operator delete(void *ptr) { heap_xfree(ptr); }; void *heap_alloc(size_t size); void *heap_zalloc(size_t size); void heap_free(void *ptr); }; // pso/TObject.h 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; } void clear_flags(object_flags flags) { m_flags_u16 &= ~static_cast(flags); } void toggle_flags(object_flags flags) { m_flags ^= flags; } u32 get_flags(object_flags flags) { return m_flags & flags; }; const char *m_name; union { object_flags m_flags; u16 m_flags_u16; }; 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(); TObject(TObject *parent = NULL); virtual ~TObject(); void *operator new (size_t size) { return alloc(size); }; void operator delete(void *ptr) { free(ptr); }; const char *name() { return m_name; }; object_flags flags() { return m_flags; }; u16 flags_u16() { return m_flags_u16; }; u16 id() { return m_id; }; TObject *prev() { return m_prev; }; TObject *next() { return m_next; }; TObject *up() { return m_up; }; TObject *down() { return m_down; }; void set_name(const char *name) { m_name = name; }; void set_obj_flags(object_flags flags) { m_flags = flags; }; void set_flags_u16(u16 flags) { m_flags_u16 = flags; }; void set_id(u16 id) { m_id = id; }; void set_prev(TObject *node) { m_prev = node; }; void set_next(TObject *node) { m_next = node; }; void set_up(TObject *node) { m_up = node; }; void set_down(TObject *node) { m_down = node; }; void delete_children(); void queue_destruction_for_each_node(); void run_tasks(); void render_nodes(); void render_shadows_for_each_node(); void render_nodes2(); void empty_func(); void set_parent(TObject *parent); virtual void run_task(); virtual void render(); virtual void render_shadows(); void empty_func2(); void log(const char *str); int get_node_count(); bool 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(); }; // pso/TSocket.h class TSocket : public TObject { private: ipv4_addr m_dst_addr; u16 m_dst_port; u16 m_src_port; ipv4_addr m_src_addr; s16 m_sock_fd; u8 m_sock_flags; bool m_buffer_cleared; s16 m_size; s16 m_buffer_offset; u32 m_unused; TArray m_unused2; TArray m_packet_buffer; s16 m_stat_val; u16 m_unused3; u32 m_send_window; u32 m_recv_window; void (*m_callback)(TSocket *socket); public: TSocket(TObject *parent); virtual ~TSocket(); virtual short open() = 0; virtual short close() = 0; virtual void recv() = 0; virtual short send(u8 *data) = 0; virtual int send(u8 *data, size_t size) = 0; int resolve_domain(char *domain); void set_ip_address(u32 addr); void set_port(u32 port); const u8 next(); int is_empty(); void set_flags(u8 flags) { m_sock_flags |= flags; }; void clear_flags(u8 flags) { m_sock_flags &= ~flags; }; void toggle_flags(u8 flags) { m_sock_flags ^= flags; }; u8 get_flags(u8 flags) { return m_sock_flags & 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(u8, sock_flags); PRIVATE_MEMBER_ACCESSORS(bool, 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); }; // pso/TTcpSocket.h class TTcpSocket : public TSocket { private: PSOV3EncryptionTCP m_send_crypt; PSOV3EncryptionTCP m_recv_crypt; int m_is_encrypted; public: WEAK_FUNC TTcpSocket(TObject *parent = nullptr); virtual ~TTcpSocket(); virtual short open() override; virtual short close() override; virtual void recv() override; virtual short send(u8 *data) override; virtual int send(u8 *data, size_t size) override; short stat(); void some_stub(); 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); }; // pso/TMainTask.h class TMainTask : public TObject { public: u32 task_flags; u32 mbr_0x20; u32 mbr_0x24; public: TMainTask(); void render_screen_overlay(); void some_empty_func(); void tl_toggle_flag_3(); void tl_clear_flag_3(); void tl_delete_children(); void tl_02_toggle_flag_3(); void tl_02_clear_flag_3(); void empty_render_screen_overlay_func(); void run_tl_camera_tasks(); void unused_render_func(); void render_objects(); void render_ui(); void render_particle_effects(); void render_effects(); void render_geometry(); void func_80228bbc(); void func_80228c44(s32 arg0); void func_80228dbc(); void render_clipout_and_fade(); void init_main_task(); virtual ~TMainTask(); 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; }; }; // pso/PSOV3Encryption.h class PSOEncryption { public: PSOEncryption(); virtual void update_stream() = 0; virtual ~PSOEncryption(); virtual void init(u32 seed) = 0; virtual u32 next() = 0; }; class PSOV3Encryption : public PSOEncryption { public: PSOV3Encryption(); virtual void update_stream() override; virtual ~PSOV3Encryption(); virtual void init(u32 seed) override; virtual u32 next() override; 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; u32 *m_buffer_start; u32 *m_buffer_end; }; // pso/TProtocol.h class TProtocol : public TTcpSocket { private: TPlySmth m_smth; TPlyGuildCardTag m_guildcard_tag; u16 sub_version; int m_login_response_state; int m_connected; int m_joined_game; int m_has_meet_user_settings; int m_buffer_ready; int m_entry_count; int m_unused; int m_lobby_list_count; int m_unused2; int m_udp_disabled; int m_language; TArray m_unused3; TPlyCharData m_character_data; u32 m_unused4; TArray, 64> m_game_entries; TArray, 64> m_game_entries2; TArray, 16> m_lobby_entries; TArray, 30> m_quest_entries; 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; TPlyClientConfig m_client_config; int m_packet_offset; int m_packet_size; packet m_packet; TArray m_recv_handlers; public: TProtocol(TObject *parent = nullptr, u16 sub_version, int language, char *serial_number, char *access_key, char *password); virtual ~TProtocol(); virtual run_task(); virtual send(u8 *data, size_t size); int handle_command(packet *pkt); 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, buffer_ready); 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_ARRAY(TMenuListEntry, game_entries, 64); PRIVATE_MEMBER_ACCESSORS_ARRAY(TMenuListEntry, game_entries2, 64); PRIVATE_MEMBER_ACCESSORS_ARRAY(TMenuListEntry, lobby_entries, 16); PRIVATE_MEMBER_ACCESSORS_ARRAY(TMenuListEntry, quest_entries, 30); PRIVATE_MEMBER_ACCESSORS_ARRAY(u8, unused5, 128); PRIVATE_MEMBER_ACCESSORS_ARRAY(char, m_serial_number3, 17); PRIVATE_MEMBER_ACCESSORS_ARRAY(char, m_password2, 17); PRIVATE_MEMBER_ACCESSORS_ARRAY(char, m_serial_number, 48); PRIVATE_MEMBER_ACCESSORS_ARRAY(char, m_access_key, 48); PRIVATE_MEMBER_ACCESSORS_ARRAY(char, m_password, 64); PRIVATE_MEMBER_ACCESSORS_ARRAY(char, m_player_name, 16); PRIVATE_MEMBER_ACCESSORS_ARRAY(char, m_serial_number2, 17); PRIVATE_MEMBER_ACCESSORS_ARRAY(char, m_access_key2, 17); PRIVATE_MEMBER_ACCESSORS(int, packet_offset); PRIVATE_MEMBER_ACCESSORS(int, packet_size); PRIVATE_MEMBER_ACCESSORS(packet, packet); PRIVATE_MEMBER_ACCESSORS_ARRAY(recv_packet_handler, recv_handlers, 52); };