summaryrefslogtreecommitdiff
path: root/include/pso/TProtocol.h
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2023-03-06 16:19:36 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2023-03-06 16:19:36 -0400
commit06d75ece6452a33f11afd7e5ec3dd1f916c8583f (patch)
tree6a3b5d45eee8d64630a647d04a43638ebef91605 /include/pso/TProtocol.h
parent306a76cb444102bc207ee16e8a65aa9e90bbd37a (diff)
TProtocol: Match both `parse_packet()`, and `run_task()`
Diffstat (limited to 'include/pso/TProtocol.h')
-rw-r--r--include/pso/TProtocol.h28
1 files changed, 20 insertions, 8 deletions
diff --git a/include/pso/TProtocol.h b/include/pso/TProtocol.h
index ed80d04..6cd2a9e 100644
--- a/include/pso/TProtocol.h
+++ b/include/pso/TProtocol.h
@@ -18,17 +18,27 @@
#include <pso/TSocket.h>
#include <pso/TTcpSocket.h>
-
EXTERN_OBJECT_NAME(TProtocol);
+extern void copy_packet(struct packet *pkt);
struct packet {
- packet_header header;
- TArray<u8, 0x7c00-sizeof(packet_header)> data;
+ union {
+ struct {
+ packet_header header;
+ TArray<u8, 0x7c00-sizeof(packet_header)> data;
+ } packet;
+ u8 bytes[0x7c00];
+ };
template<typename T>
T &as() {
return reinterpret_cast<T>(*this);
};
+
+ template<typename T>
+ T *as_ptr() {
+ return reinterpret_cast<T *>(this);
+ };
};
struct GameListEntry {
@@ -51,7 +61,7 @@ struct QuestListEntry {
typedef void (*recv_packet_handler)(packet &pkt);
class TProtocol : public TTcpSocket {
-private:
+public:
TPlySmth m_smth;
TPlyGuildCardTag m_guildcard_tag;
u16 m_sub_version;
@@ -59,7 +69,7 @@ private:
int m_connected;
int m_joined_game;
int m_has_meet_user_settings;
- int m_buffer_ready;
+ int m_handle_pings_only;
int m_entry_count;
int m_unused;
int m_lobby_list_count;
@@ -92,9 +102,11 @@ public:
virtual ~TProtocol();
virtual void run_task();
- virtual int send(u8 *data, size_t size);
+ virtual short send(u8 *data, size_t size);
- int handle_command(packet *pkt);
+ void some_stub();
+ int handle_command(struct packet *pkt);
+ void parse_packet();
PRIVATE_MEMBER_ACCESSORS(TPlySmth, smth);
PRIVATE_MEMBER_ACCESSORS(TPlyGuildCardTag, guildcard_tag);
@@ -103,7 +115,7 @@ public:
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, handle_pings_only);
PRIVATE_MEMBER_ACCESSORS(int, entry_count);
PRIVATE_MEMBER_ACCESSORS(int, unused);
PRIVATE_MEMBER_ACCESSORS(int, lobby_list_count);