From 8880486c8bb34a65d2fab6a343827b44c64cc730 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Fri, 4 Nov 2022 12:28:19 -0700 Subject: [PATCH 1/2] Fix chat message reads (#817) * Fix chat message reads * Fix teams --- dChatServer/ChatPacketHandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dChatServer/ChatPacketHandler.cpp b/dChatServer/ChatPacketHandler.cpp index 0f7f6919..119083ee 100644 --- a/dChatServer/ChatPacketHandler.cpp +++ b/dChatServer/ChatPacketHandler.cpp @@ -394,7 +394,7 @@ void ChatPacketHandler::HandleChatMessage(Packet* packet) { uint8_t channel = 0; inStream.Read(channel); - std::string message = PacketUtils::ReadString(0x66, packet, true); + std::string message = PacketUtils::ReadString(0x66, packet, true, 512); Game::logger->Log("ChatPacketHandler", "Got a message from (%s) [%d]: %s", senderName.c_str(), channel, message.c_str()); @@ -436,7 +436,7 @@ void ChatPacketHandler::HandleChatMessage(Packet* packet) { void ChatPacketHandler::HandlePrivateChatMessage(Packet* packet) { LWOOBJID senderID = PacketUtils::ReadPacketS64(0x08, packet); std::string receiverName = PacketUtils::ReadString(0x66, packet, true); - std::string message = PacketUtils::ReadString(0xAA, packet, true); + std::string message = PacketUtils::ReadString(0xAA, packet, true, 512); //Get the bois: auto goonA = playerContainer.GetPlayerData(senderID); From 162f84e2857c1fa6b490dde8b5e3acd96d89a985 Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Fri, 4 Nov 2022 19:45:04 -0500 Subject: [PATCH 2/2] simplify path fixing for packed vs unpacked (#816) fix slashes for hasfile for unpacked client checking --- dCommon/dClient/AssetManager.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/dCommon/dClient/AssetManager.cpp b/dCommon/dClient/AssetManager.cpp index ba928340..2b6f84e3 100644 --- a/dCommon/dClient/AssetManager.cpp +++ b/dCommon/dClient/AssetManager.cpp @@ -66,17 +66,15 @@ eAssetBundleType AssetManager::GetAssetBundleType() { bool AssetManager::HasFile(const char* name) { auto fixedName = std::string(name); std::transform(fixedName.begin(), fixedName.end(), fixedName.begin(), [](uint8_t c) { return std::tolower(c); }); + + + std::replace(fixedName.begin(), fixedName.end(), '\\', '/'); + if (std::filesystem::exists(m_ResPath / fixedName)) return true; + + if (this->m_AssetBundleType == eAssetBundleType::Unpacked) return false; + std::replace(fixedName.begin(), fixedName.end(), '/', '\\'); - - auto realPathName = fixedName; - - if (fixedName.rfind("client\\res\\", 0) != 0) { - fixedName = "client\\res\\" + fixedName; - } - - if (std::filesystem::exists(m_ResPath / realPathName)) { - return true; - } + if (fixedName.rfind("client\\res\\", 0) != 0) fixedName = "client\\res\\" + fixedName; uint32_t crc = crc32b(0xFFFFFFFF, (uint8_t*)fixedName.c_str(), fixedName.size()); crc = crc32b(crc, (Bytef*)"\0\0\0\0", 4);