summaryrefslogtreecommitdiff
path: root/include/pso
diff options
context:
space:
mode:
Diffstat (limited to 'include/pso')
-rw-r--r--include/pso/PSOV3Encryption.h1
-rw-r--r--include/pso/PSOV3EncryptionTCP.h1
-rw-r--r--include/pso/TMath.h1
-rw-r--r--include/pso/TMenuList.h1
-rw-r--r--include/pso/TPlyCharData.h1
-rw-r--r--include/pso/TPlyClientConfig.h1
-rw-r--r--include/pso/TPlyDispData.h1
-rw-r--r--include/pso/TPlyGuildCardTag.h6
-rw-r--r--include/pso/TPlyInventory.h1
-rw-r--r--include/pso/TProtocol.h107
-rw-r--r--include/pso/TSocket.h1
-rw-r--r--include/pso/TTcpSocket.h1
-rw-r--r--include/pso/packet_classes.h27
13 files changed, 127 insertions, 23 deletions
diff --git a/include/pso/PSOV3Encryption.h b/include/pso/PSOV3Encryption.h
index d34cd4f..f0066f4 100644
--- a/include/pso/PSOV3Encryption.h
+++ b/include/pso/PSOV3Encryption.h
@@ -4,7 +4,6 @@
#include <global_types.h>
#include <string.h>
#include <pso/macros.h>
-#include <pso/TArray.h>
class PSOEncryption {
public:
diff --git a/include/pso/PSOV3EncryptionTCP.h b/include/pso/PSOV3EncryptionTCP.h
index 9546df0..be4efbb 100644
--- a/include/pso/PSOV3EncryptionTCP.h
+++ b/include/pso/PSOV3EncryptionTCP.h
@@ -6,7 +6,6 @@
#include <pso/macros.h>
#include <pso/protocol.h>
#include <pso/PSOV3Encryption.h>
-#include <pso/TArray.h>
class PSOV3EncryptionTCP : public PSOV3Encryption {
public:
diff --git a/include/pso/TMath.h b/include/pso/TMath.h
index 799c498..e279a2c 100644
--- a/include/pso/TMath.h
+++ b/include/pso/TMath.h
@@ -4,7 +4,6 @@
#include <global_types.h>
#include <pso/macros.h>
#include <pso/protocol.h>
-#include <pso/TArray.h>
struct vec2f {
float x;
diff --git a/include/pso/TMenuList.h b/include/pso/TMenuList.h
index d065622..3a38a66 100644
--- a/include/pso/TMenuList.h
+++ b/include/pso/TMenuList.h
@@ -4,7 +4,6 @@
#include "pso/forward.h"
#include "pso/protocol.h"
#include "pso/macros.h"
-#include "pso/TArray.h"
#include "pso/TPlyGuildCardTag.h"
#include <global_types.h>
diff --git a/include/pso/TPlyCharData.h b/include/pso/TPlyCharData.h
index 7e0036c..5a7dd48 100644
--- a/include/pso/TPlyCharData.h
+++ b/include/pso/TPlyCharData.h
@@ -4,7 +4,6 @@
#include <global_types.h>
#include <pso/macros.h>
#include <pso/protocol.h>
-#include <pso/TArray.h>
#include <pso/TPlyInventory.h>
#include <pso/TPlyDispData.h>
diff --git a/include/pso/TPlyClientConfig.h b/include/pso/TPlyClientConfig.h
index b4c9103..8876640 100644
--- a/include/pso/TPlyClientConfig.h
+++ b/include/pso/TPlyClientConfig.h
@@ -4,7 +4,6 @@
#include <global_types.h>
#include <pso/macros.h>
#include <pso/protocol.h>
-#include <pso/TArray.h>
class TPlyClientConfig {
public:
diff --git a/include/pso/TPlyDispData.h b/include/pso/TPlyDispData.h
index 2113d04..679e329 100644
--- a/include/pso/TPlyDispData.h
+++ b/include/pso/TPlyDispData.h
@@ -4,7 +4,6 @@
#include <global_types.h>
#include <pso/macros.h>
#include <pso/protocol.h>
-#include <pso/TArray.h>
#include <pso/TMath.h>
#include <pso/TPlyGuildCardTag.h>
diff --git a/include/pso/TPlyGuildCardTag.h b/include/pso/TPlyGuildCardTag.h
index de96902..948426a 100644
--- a/include/pso/TPlyGuildCardTag.h
+++ b/include/pso/TPlyGuildCardTag.h
@@ -14,6 +14,12 @@ struct gc_tag {
class TPlyGuildCardTag {
public:
TPlyGuildCardTag() {};
+ TPlyGuildCardTag(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;
+ };
TPlyGuildCardTag(u16 tag2, u32 guildcard_number) {
m_tag.tag0 = 0;
m_tag.tag1 = 0;
diff --git a/include/pso/TPlyInventory.h b/include/pso/TPlyInventory.h
index 397b4cc..3256717 100644
--- a/include/pso/TPlyInventory.h
+++ b/include/pso/TPlyInventory.h
@@ -4,7 +4,6 @@
#include <global_types.h>
#include <pso/macros.h>
#include <pso/protocol.h>
-#include <pso/TArray.h>
struct TItemData {
void init();
diff --git a/include/pso/TProtocol.h b/include/pso/TProtocol.h
index f9d22f9..9d24830 100644
--- a/include/pso/TProtocol.h
+++ b/include/pso/TProtocol.h
@@ -5,9 +5,9 @@
#include <string.h>
#include <pso/macros.h>
#include <pso/forward.h>
+#include <pso/packet_classes.h>
#include <pso/protocol.h>
#include <pso/PSOV3EncryptionTCP.h>
-#include <pso/TArray.h>
#include <pso/TMainTask.h>
#include <pso/TMenuList.h>
#include <pso/TObject.h>
@@ -29,16 +29,6 @@ struct packet {
} pkt;
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 {
@@ -58,7 +48,80 @@ struct QuestListEntry {
char short_description[112];
};
-typedef void (*recv_packet_handler)(packet &pkt);
+
+#define RECV_PACKET_HANDLERS \
+ o(handle_unused_login, void) \
+ o(handle_03_recv_regist, void) \
+ o(handle_04_recv_login, void) \
+ o(handle_05_recv_logout, void) \
+ o(handle_07_A0_A1_recv_dir_list, int entry_count, TMenuListEntry<GameListEntry> *entries, TMenuListEntry<GameListEntry> &entry_0) \
+ o(handle_08_recv_game_list, int entry_count, TMenuListEntry<GameListEntry> *entries, TMenuListEntry<GameListEntry> &entry_0) \
+ o(handle_01_recv_error, char *mesg) \
+ o(handle_06_recv_chat, TPlyGuildCardTag &tag, char *mesg) \
+ o(handle_11_additional_info_reply_packet, void) \
+ o(handle_1A_D5_large_message_box_packet, void) \
+ o(handle_0E_recv_start_game, void) \
+ o(unused7, void) \
+ o(handle_64_join_game_packet, void) \
+ o(unused8, void) \
+ o(handle_67_join_lobby_packet, void) \
+ o(handle_80_unused_ignored_packet, void) \
+ o(unused9, void) \
+ o(handle_65_add_player_to_game_packet, void) \
+ o(handle_66_player_left_game_packet, void) \
+ o(handle_68_add_player_to_lobby_packet, void) \
+ o(handle_69_player_left_lobby_packet, void) \
+ o(handle_18_90_9A_login_response_packet, void) \
+ o(handle_92_9C_register_response_packet, void) \
+ o(unused10, void) \
+ o(handle_95_request_character_data_packet, void) \
+ o(handle_81_simple_mail_packet, void) \
+ o(handle_41_guild_card_search_reply_packet, void) \
+ o(send_96_unused, void) \
+ o(handle_97_checksum_reply_packet, void) \
+ o(handle_B1_current_time_packet, void) \
+ o(handle_C0_choice_search_option_packet, void) \
+ o(handle_C4_choice_search_reply_packet, void) \
+ o(handle_D8_infoboard_packet, void) \
+ o(handle_A2_quest_list_packet, void) \
+ o(handle_A3_quest_info_packet, void) \
+ o(handle_44_quest_file_list_packet, void) \
+ o(handle_13_quest_data_packet, void) \
+ o(handle_A4_downloadable_quest_menu_packet, void) \
+ o(handle_A5_downloadable_quest_info_packet, void) \
+ o(handle_A6_download_quest_file_list_packet, void) \
+ o(handle_A7_download_quest_file_data_packet, void) \
+ o(unused11, void) \
+ o(handle_1F_lobby_info_desk_list_packet, void) \
+ o(handle_B0_server_message_packet, void) \
+ o(handle_88_player_arrow_color_list_packet, void) \
+ o(handle_8A_lobby_name_packet, void) \
+ o(handle_C5_player_challenge_data_packet, void) \
+ o(handle_DA_lobby_event_packet, void) \
+ o(handle_AB_quest_stats_response_packet, void) \
+ o(handle_D3_execute_trade_packet, void) \
+ o(handle_D4_trade_result_packet, void) \
+ o(handle_D1_advance_trade_state_packet, void)
+
+#define recv_packet_handler(name) recv_packet_handler_##name
+
+#define o(name, ...) typedef void (*recv_packet_handler(name))(__VA_ARGS__);
+RECV_PACKET_HANDLERS;
+#undef o
+
+struct recv_packet_handlers {
+ #define o(name, ...) recv_packet_handler(name) name;
+ RECV_PACKET_HANDLERS;
+ #undef o
+};
+
+typedef void (TProtocol::*command_handler)(packet &pkt);
+
+struct command_handler_entry {
+ int command;
+ command_handler handler;
+};
+
class TProtocol : public TTcpSocket {
public:
@@ -96,7 +159,7 @@ public:
int m_packet_offset;
int m_packet_size;
struct packet m_packet;
- recv_packet_handler m_recv_handlers[52];
+ struct recv_packet_handlers m_recv_handlers;
public:
TProtocol(TObject *parent, u16 sub_version, int language, char *serial_number, char *access_key, char *password);
virtual ~TProtocol();
@@ -107,6 +170,24 @@ public:
void some_stub() {};
int handle_command(struct packet *pkt);
void parse_packet();
+
+ // Command handlers.
+ // 0x01
+ void recv_error(packet &pkt);
+ // 0x03
+ void recv_regist(packet &pkt);
+ // 0x04
+ void recv_login(packet &pkt);
+ // 0x05
+ void recv_logout(packet &pkt);
+ // 0x06
+ void recv_chat(packet &pkt);
+ // 0x07
+ void recv_dir_list(packet &pkt);
+ // 0x08
+ void recv_game_list(packet &pkt);
+ // 0x0E
+ void recv_start_game(packet &pkt);
};
#endif
diff --git a/include/pso/TSocket.h b/include/pso/TSocket.h
index 4a1f5ab..66df9dc 100644
--- a/include/pso/TSocket.h
+++ b/include/pso/TSocket.h
@@ -5,7 +5,6 @@
#include <string.h>
#include <pso/macros.h>
#include <pso/forward.h>
-#include <pso/TArray.h>
#include <pso/TObject.h>
union ipv4_addr {
diff --git a/include/pso/TTcpSocket.h b/include/pso/TTcpSocket.h
index aa0790a..1be39a4 100644
--- a/include/pso/TTcpSocket.h
+++ b/include/pso/TTcpSocket.h
@@ -6,7 +6,6 @@
#include <pso/macros.h>
#include <pso/forward.h>
#include <pso/PSOV3EncryptionTCP.h>
-#include <pso/TArray.h>
#include <pso/TSocket.h>
#include <pso/TObject.h>
diff --git a/include/pso/packet_classes.h b/include/pso/packet_classes.h
new file mode 100644
index 0000000..87e0b06
--- /dev/null
+++ b/include/pso/packet_classes.h
@@ -0,0 +1,27 @@
+#ifndef PACKET_CLASSES_H
+#define PACKET_CLASSES_H
+
+#include <global_types.h>
+#include <string.h>
+#include <pso/macros.h>
+#include <pso/forward.h>
+#include <pso/protocol.h>
+#include <pso/TMenuList.h>
+#include <pso/TPlyCharData.h>
+#include <pso/TPlyClientConfig.h>
+#include <pso/TPlyGuildCardTag.h>
+#include <pso/TPlySmth.h>
+
+class TMessageBox {
+public:
+ packet_header header;
+ TPlyGuildCardTag tag;
+ char mesg[512];
+public:
+ void bswap() {
+ header.bswap();
+ tag.bswap();
+ };
+};
+
+#endif