summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/pso/TProtocol.h66
1 files changed, 43 insertions, 23 deletions
diff --git a/include/pso/TProtocol.h b/include/pso/TProtocol.h
index c4b803d..5be26eb 100644
--- a/include/pso/TProtocol.h
+++ b/include/pso/TProtocol.h
@@ -11,19 +11,39 @@
#include <pso/TMainTask.h>
#include <pso/TMenuList.h>
#include <pso/TObject.h>
+#include <pso/TPlyCharData.h>
+#include <pso/TPlyClientConfig.h>
#include <pso/TPlyGuildCardTag.h>
+#include <pso/TPlySmth.h>
#include <pso/TSocket.h>
#include <pso/TTcpSocket.h>
-class TPlySmth {
- TArray<u8, 4> m_smth;
- TArray<u8, 4> m_smth1;
-};
-
struct packet {
packet_header header;
- TArray<u8, 0x7fbc> data;
+ TArray<u8, 0x7c00-sizeof(packet_header)> data;
+
+ template<typename T>
+ T &as() {
+ return reinterpret_cast<T>(*this);
+ };
+};
+
+struct GameListEntry {
+ u8 difficulty_tag;
+ u8 num_players;
+ TArray<char, 16> name;
+ u8 episode;
+ u8 flags;
+};
+
+struct LobbyListEntry {
+ u32 smth;
+};
+
+struct QuestListEntry {
+ TArray<char, 32> name;
+ TArray<char, 112> short_description;
};
typedef void (*recv_packet_handler)(packet &pkt);
@@ -32,7 +52,7 @@ class TProtocol : public TTcpSocket {
private:
TPlySmth m_smth;
TPlyGuildCardTag m_guildcard_tag;
- u16 sub_version;
+ u16 m_sub_version;
int m_login_response_state;
int m_connected;
int m_joined_game;
@@ -47,10 +67,10 @@ private:
TArray<u8, 80> m_unused3;
TPlyCharData m_character_data;
u32 m_unused4;
- TArray<TMenuListEntry<GameMenuEntry>, 64> m_game_entries;
- TArray<TMenuListEntry<GameMenuEntry>, 64> m_game_entries2;
+ TArray<TMenuListEntry<GameListEntry>, 64> m_game_entries;
+ TArray<TMenuListEntry<GameListEntry>, 64> m_game_entries2;
TArray<TMenuListEntry<LobbyListEntry>, 16> m_lobby_entries;
- TArray<TMenuListEntry<QuestMenuEntry>, 30> m_quest_entries;
+ TArray<TMenuListEntry<QuestListEntry>, 30> m_quest_entries;
TArray<u8, 128> m_unused5;
TArray<char, 17> m_serial_number3;
TArray<char, 17> m_password2;
@@ -66,11 +86,11 @@ private:
packet m_packet;
TArray<recv_packet_handler, 52> m_recv_handlers;
public:
- TProtocol(TObject *parent = nullptr, u16 sub_version, int language, char *serial_number, char *access_key, char *password);
+ TProtocol(TObject *parent, 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);
+ virtual void run_task();
+ virtual int send(u8 *data, size_t size);
int handle_command(packet *pkt);
@@ -94,19 +114,19 @@ public:
PRIVATE_MEMBER_ACCESSORS_ARRAY(TMenuListEntry<GameListEntry>, game_entries, 64);
PRIVATE_MEMBER_ACCESSORS_ARRAY(TMenuListEntry<GameListEntry>, game_entries2, 64);
PRIVATE_MEMBER_ACCESSORS_ARRAY(TMenuListEntry<LobbyListEntry>, lobby_entries, 16);
- PRIVATE_MEMBER_ACCESSORS_ARRAY(TMenuListEntry<QuestMenuEntry>, quest_entries, 30);
+ PRIVATE_MEMBER_ACCESSORS_ARRAY(TMenuListEntry<QuestListEntry>, 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_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(packet, packet);
+ PRIVATE_MEMBER_ACCESSORS(struct packet, packet);
PRIVATE_MEMBER_ACCESSORS_ARRAY(recv_packet_handler, recv_handlers, 52);
};