summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pso/TProtocol.cpp40
1 files changed, 35 insertions, 5 deletions
diff --git a/src/pso/TProtocol.cpp b/src/pso/TProtocol.cpp
index e876e02..c4b42b5 100644
--- a/src/pso/TProtocol.cpp
+++ b/src/pso/TProtocol.cpp
@@ -19,11 +19,41 @@ u32 new_ip_addr;
u16 new_port;
TPlyMeetUserExtension meet_user_settings;
u32 game_variations[16][2];
+const char *port_map_copyright = "DreamCast Port Map. Copyright SEGA Enterprises. 1999";
void copy_packet(struct packet *pkt) {
}
+void TProtocol::recv_pso_regist_check(packet &pkt) {
+ packet_header tmp = pkt.pkt.header;
+ tmp.bswap();
+ m_regist_state = tmp.flags;
+ if (m_recv_handlers.handle_18_90_9A_recv_pso_regist_check != nullptr) {
+ m_recv_handlers.handle_18_90_9A_recv_pso_regist_check(tmp.flags);
+ }
+}
+
+void TProtocol::recv_pso_regist_connect(packet &pkt) {
+ TRecvPsoRegistConnect tmp = as(TRecvPsoRegistConnect &, pkt);
+ tmp.bswap();
+ if (!strcmp(port_map_copyright, tmp.copyright)) {
+ TSendPsoRegistConnect tmp2;
+ m_recv_crypt.reset(tmp.server_key);
+ m_send_crypt.reset(tmp.client_key);
+ m_is_encrypted = true;
+ memset(&tmp2, 0, sizeof(tmp2));
+ tmp2.header.command = 0x90;
+ tmp2.header.size = sizeof(tmp2);
+ strncpy(tmp2.serial_number, m_serial_number_v1, sizeof(tmp2.serial_number)-1);
+ strncpy(tmp2.access_key, m_access_key_v1, sizeof(tmp2.access_key)-1);
+ tmp2.bswap();
+ send(as(u8 *, &tmp2), sizeof(tmp2));
+ } else {
+ close();
+ }
+}
+
void TProtocol::recv_exit_lobby(packet &pkt) {
TRecvExit<true> tmp = as(TRecvExit<true> &, pkt);
tmp.bswap();
@@ -838,7 +868,7 @@ void TProtocol::recv_login(packet &pkt) {
void TProtocol::recv_regist(packet &pkt) {
packet_header tmp = pkt.pkt.header;
tmp.bswap();
- m_login_response_state = tmp.flags;
+ m_regist_state = tmp.flags;
if (m_recv_handlers.handle_03_recv_regist != nullptr) {
m_recv_handlers.handle_03_recv_regist(tmp.flags);
}
@@ -876,7 +906,7 @@ int TProtocol::handle_command(struct packet *pkt) {
{ 0x13, &recv_download },
{ 0x14, &recv_upload },
{ 0x11, &recv_message },
- // 0x18
+ { 0x18, &recv_pso_regist_check },
// 0x17
{ 0x19, &recv_port },
{ 0x1A, &recv_text },
@@ -898,8 +928,8 @@ int TProtocol::handle_command(struct packet *pkt) {
{ 0x66, &recv_exit_game },
{ 0x68, &recv_burst_lobby },
{ 0x69, &recv_exit_lobby },
- // 0x90
- // 0x91
+ { 0x90, &recv_pso_regist_check },
+ { 0x91, &recv_pso_regist_connect },
// 0x92
// 0x95
{ 0xA0, &recv_dir_list },
@@ -1037,7 +1067,7 @@ TProtocol::TProtocol(TObject *parent, u16 sub_version, int language, char *seria
m_smth.m_smth1[i++] = thing[j++];
}
m_guildcard_tag = TPlyGuildCardTag(-1, -1);
- m_login_response_state = 0;
+ m_regist_state = 0;
m_connected = 0;
m_joined_game = 0;
m_has_meet_user_settings = 0;