summaryrefslogtreecommitdiff
path: root/src/pso/TProtocol.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pso/TProtocol.cpp')
-rw-r--r--src/pso/TProtocol.cpp97
1 files changed, 96 insertions, 1 deletions
diff --git a/src/pso/TProtocol.cpp b/src/pso/TProtocol.cpp
index 19b2672..35d8a54 100644
--- a/src/pso/TProtocol.cpp
+++ b/src/pso/TProtocol.cpp
@@ -14,6 +14,8 @@
OBJECT_NAME(TProtocol);
packet *server_packet = nullptr;
+u32 new_ip_addr;
+u16 new_port;
TPlyMeetUserExtension meet_user_settings;
u32 game_variations[16][2];
@@ -21,6 +23,52 @@ void copy_packet(struct packet *pkt) {
}
+int TProtocol::send_login3() {
+ int ret;
+ set_ip_address(new_ip_addr);
+ set_port((short)new_port);
+
+ if (open() >= 0) {
+ // Return 0 if we successfully opened the socket.
+ // NOTE: Using a variable for the return value is needed to match.
+ ret = 0;
+ } else {
+ // Return 1 if we failed to open the socket.
+ // NOTE: This return here is needed to match.
+ return 1;
+ }
+ return ret;
+}
+
+void TProtocol::recv_system_file(packet &pkt) {};
+
+void TProtocol::recv_battle_data(packet &pkt) {
+ packet_header tmp = pkt.pkt.header;
+ tmp.bswap();
+};
+
+void TProtocol::seq_jump(u8 *some_struct, TPlyMeetUserExtension &extension) {
+ // TODO: Implement, and match this.
+}
+
+void TProtocol::recv_port(packet &pkt) {
+ TRecvPort tmp = as(TRecvPort &, pkt);
+ tmp.bswap();
+
+ new_ip_addr = tmp.ip_addr;
+ new_port = tmp.port;
+
+ close();
+ m_connected = false;
+ m_packet_offset = 0;
+ m_packet_size = 0;
+
+ // Did we fail to reconnect?
+ if (send_login3()) {
+ m_is_invalid_packet = true;
+ }
+};
+
void TProtocol::recv_message(packet &pkt) {
TMessageBox tmp = as(TMessageBox &, pkt);
tmp.bswap();
@@ -279,14 +327,61 @@ int TProtocol::handle_command(struct packet *pkt) {
{ 0x13, &recv_download },
{ 0x14, &recv_upload },
{ 0x11, &recv_message },
- { 0x1F, &recv_text_list },
+ // 0x18
+ // 0x17
+ { 0x19, &recv_port },
{ 0x1A, &recv_text },
+ { 0x1B, &recv_battle_data },
+ { 0x1C, &recv_system_file },
+ // 0x60
+ // 0x62
+ // 0x6C
+ // 0x6D
+ // 0x81
+ // 0x41
+ // 0x88
+ // 0x8A
+ // 0x80
{ 0x67, &recv_start_lobby2 },
+ // 0x83
+ // 0x1D
+ // 0x65
+ // 0x66
+ // 0x68
+ // 0x69
+ // 0x90
+ // 0x91
+ // 0x92
+ // 0x95
{ 0xA0, &recv_dir_list },
{ 0xA1, &recv_dir_list },
+ // 0xA2
+ // 0xA3
+ // 0xA4
+ // 0xA5
{ 0xA6, &recv_vm_download_head },
{ 0xA7, &recv_vm_download },
+ // 0x97
+ // 0xB0
+ { 0x1F, &recv_text_list },
+ // 0xB1
+ // 0xC0
+ // 0xC4
+ // 0xB2
+ // 0x02
+ // 0x9A
+ // 0x9B
+ // 0x9C
+ // 0xD1
+ // 0xD2
+ // 0xD3
{ 0xD5, &recv_text },
+ // 0xD7
+ // 0xD8
+ // 0xDA
+ // 0x9F
+ // 0xAB
+ // 0xAC
{ 0, nullptr }
};
for (int i = 0; !handlers[i].command; ++i) {