summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--context.h58
-rw-r--r--include/pso/TProtocol.h66
-rw-r--r--obj_files.mk1
-rw-r--r--src/pso/TProtocol.cpp36
4 files changed, 120 insertions, 41 deletions
diff --git a/context.h b/context.h
index 8048a60..aa1e952 100644
--- a/context.h
+++ b/context.h
@@ -678,7 +678,29 @@ struct send_buffs {
// pso/TProtocol.h
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;
};
// pso/TSocket.h
@@ -1236,7 +1258,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;
@@ -1251,10 +1273,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;
@@ -1270,11 +1292,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);
@@ -1298,18 +1320,18 @@ 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);
};
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);
};
diff --git a/obj_files.mk b/obj_files.mk
index 48bd54d..c8fb0f1 100644
--- a/obj_files.mk
+++ b/obj_files.mk
@@ -9,6 +9,7 @@ O_FILES := $(BUILD_DIR)/src/main.o \
$(BUILD_DIR)/src/pso/TObject.o \
$(BUILD_DIR)/src/pso/TObject2.o \
$(BUILD_DIR)/src/pso/PSOV3Encryption.o \
+ $(BUILD_DIR)/src/pso/TProtocol.o \
$(BUILD_DIR)/src/Dolphin/PPCArch.o \
$(BUILD_DIR)/src/Dolphin/db.o \
$(BUILD_DIR)/src/Dolphin/os/OS.o \
diff --git a/src/pso/TProtocol.cpp b/src/pso/TProtocol.cpp
new file mode 100644
index 0000000..41986d1
--- /dev/null
+++ b/src/pso/TProtocol.cpp
@@ -0,0 +1,36 @@
+#include <global_types.h>
+#include <string.h>
+#include "pso/forward.h"
+#include "pso/macros.h"
+#include "pso/TArray.h"
+#include "pso/TMainTask.h"
+#include "pso/TMenuList.h"
+#include "pso/TPlyCharData.h"
+#include "pso/TPlyDispData.h"
+#include "pso/TPlyInventory.h"
+#include "pso/TObject.h"
+#include "pso/TProtocol.h"
+#include "pso/TSocket.h"
+#include "pso/TTcpSocket.h"
+
+
+
+TProtocol::TProtocol(TObject *parent, u16 sub_version, int language, char *serial_number, char *access_key, char *password) : TTcpSocket(parent) {
+
+}
+
+TProtocol::~TProtocol() {
+
+}
+
+void TProtocol::run_task() {
+
+}
+
+int TProtocol::send(u8 *data, size_t size) {
+ return TTcpSocket::send(data, size);
+}
+
+int handle_command(packet *pkt) {
+
+}