From 94c69b351d3bd49d4856b20c22c9fb420fcaece0 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Tue, 7 Mar 2023 10:01:23 -0400 Subject: TProtocol: Rename `packet.packet` -> `packet.pkt` --- context.h | 4 ++-- include/pso/TProtocol.h | 4 ++-- src/pso/TProtocol.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/context.h b/context.h index 42f6b99..ba7fb34 100644 --- a/context.h +++ b/context.h @@ -704,7 +704,7 @@ struct packet { struct { packet_header header; TArray data; - } packet; + } pkt; u8 bytes[0x7c00]; }; @@ -1310,7 +1310,7 @@ public: TPlyClientConfig m_client_config; int m_packet_offset; int m_packet_size; - packet m_packet; + struct packet m_packet; TArray m_recv_handlers; public: TProtocol(TObject *parent, u16 sub_version, int language, char *serial_number, char *access_key, char *password); diff --git a/include/pso/TProtocol.h b/include/pso/TProtocol.h index 4a1d05a..ac2589e 100644 --- a/include/pso/TProtocol.h +++ b/include/pso/TProtocol.h @@ -26,7 +26,7 @@ struct packet { struct { packet_header header; TArray data; - } packet; + } pkt; u8 bytes[0x7c00]; }; @@ -95,7 +95,7 @@ public: TPlyClientConfig m_client_config; int m_packet_offset; int m_packet_size; - packet m_packet; + struct packet m_packet; TArray m_recv_handlers; public: TProtocol(TObject *parent, u16 sub_version, int language, char *serial_number, char *access_key, char *password); diff --git a/src/pso/TProtocol.cpp b/src/pso/TProtocol.cpp index e3c45a9..0970d39 100644 --- a/src/pso/TProtocol.cpp +++ b/src/pso/TProtocol.cpp @@ -31,13 +31,13 @@ void TProtocol::parse_packet() { m_packet.bytes[m_packet_offset++] = next(); if (m_packet_offset == sizeof(packet_header)) { if (m_is_encrypted) { - m_recv_crypt.encrypt(&m_packet.packet.header, sizeof(packet_header)); + m_recv_crypt.encrypt(&m_packet.pkt.header, sizeof(packet_header)); } } // NOTE: The `const int &` is required here to match. // Convert packet size to native endian. - const int &packet_size = m_packet_size = to_be_uint16_t(m_packet.packet.header.size); + const int &packet_size = m_packet_size = to_be_uint16_t(m_packet.pkt.header.size); // Is the packet size invalid? if (packet_size > max_packet_size || !packet_size) { m_packet_size = 0; @@ -48,13 +48,13 @@ void TProtocol::parse_packet() { } else if (m_packet_size > 0 && m_packet_offset >= m_packet_size) { // Decrypt it if necessary. if (m_is_encrypted) { - m_recv_crypt.encrypt(&m_packet.packet.data, m_packet_size-sizeof(packet_header)); + m_recv_crypt.encrypt(&m_packet.pkt.data, m_packet_size-sizeof(packet_header)); } struct packet *pkt = &m_packet; m_packet_size = 0; m_packet_offset = 0; if (m_handle_pings_only) { - if (pkt->packet.header.command == 0x1d) { + if (pkt->pkt.header.command == 0x1d) { if (!handle_command(pkt)) { continue; } else { -- cgit v1.2.3-13-gbd6f