From 857f220e06b5a1ee2fdbd95e7b483a960ad72077 Mon Sep 17 00:00:00 2001 From: Federico Cecchetto Date: Sat, 26 Feb 2022 00:39:54 +0100 Subject: [PATCH] DW done maybe --- src/client/component/auth.cpp | 37 +++++++++++-------- src/client/component/demonware.cpp | 3 +- src/client/component/network.cpp | 8 ++-- .../game/demonware/servers/auth3_server.cpp | 1 + .../game/demonware/servers/lobby_server.cpp | 1 + src/client/game/demonware/services.hpp | 1 + .../game/demonware/services/bdStorage.cpp | 14 +++++-- .../game/demonware/services/bdUNK95.cpp | 17 +++++++++ .../game/demonware/services/bdUNK95.hpp | 13 +++++++ 9 files changed, 71 insertions(+), 24 deletions(-) create mode 100644 src/client/game/demonware/services/bdUNK95.cpp create mode 100644 src/client/game/demonware/services/bdUNK95.hpp diff --git a/src/client/component/auth.cpp b/src/client/component/auth.cpp index 08c406eb..0f0484c8 100644 --- a/src/client/component/auth.cpp +++ b/src/client/component/auth.cpp @@ -82,14 +82,21 @@ namespace auth return key; } + // need to move this somewhere else probably + std::string hash_string(const std::string& str) + { + const auto value = game::generateHashValue(str.data()); + return utils::string::va("0x%lX", value); + } + int send_connect_data_stub(game::netsrc_t sock, game::netadr_s* adr, const char* format, const int len) { std::string connect_string(format, len); game::SV_Cmd_TokenizeString(connect_string.data()); const auto _ = gsl::finally([]() - { - game::SV_Cmd_EndTokenizedString(); - }); + { + game::SV_Cmd_EndTokenizedString(); + }); const command::params_sv params; if (params.size() < 3) @@ -98,7 +105,7 @@ namespace auth } const utils::info_string info_string{std::string{params[2]}}; - const auto challenge = info_string.get("challenge"); + const auto challenge = info_string.get(hash_string("challenge")); connect_string.clear(); connect_string.append(params[0]); @@ -139,8 +146,8 @@ namespace auth const utils::info_string info_string{std::string{params[2]}}; - const auto steam_id = info_string.get("xuid"); - const auto challenge = info_string.get("challenge"); + const auto steam_id = info_string.get(hash_string("xuid")); + const auto challenge = info_string.get(hash_string("challenge")); if (steam_id.empty() || challenge.empty()) { @@ -172,17 +179,17 @@ namespace auth void* get_direct_connect_stub() { return utils::hook::assemble([](utils::hook::assembler& a) - { - a.lea(rcx, qword_ptr(rsp, 0x20)); - a.movaps(xmmword_ptr(rsp, 0x20), xmm0); + { + a.lea(rcx, qword_ptr(rsp, 0x20)); + a.movaps(xmmword_ptr(rsp, 0x20), xmm0); - a.pushad64(); - a.mov(rdx, rdi); - a.call_aligned(direct_connect); - a.popad64(); + a.pushad64(); + a.mov(rdx, rsi); + a.call_aligned(direct_connect); + a.popad64(); - a.jmp(0x140488CE2); // H1MP64(1.4) - }); + a.jmp(0x140488CE2); // H1MP64(1.4) + }); } } diff --git a/src/client/component/demonware.cpp b/src/client/component/demonware.cpp index c41cd43b..7d4c5b56 100644 --- a/src/client/component/demonware.cpp +++ b/src/client/component/demonware.cpp @@ -488,7 +488,6 @@ namespace demonware { if (library == "WS2_32.dll") { - printf("%s\n", function.data()); if (function == "#3") return io::closesocket_stub; if (function == "#4") return io::connect_stub; if (function == "#5") return io::getpeername_stub; @@ -559,6 +558,8 @@ namespace demonware utils::hook::set(0x140728380, 0xC301B0); // Checks extended_data and extra_data in json object utils::hook::set(0x140728E90, 0xC301B0); + // Update check + utils::hook::set(0x1403A5390, 0xC301B0); } void pre_destroy() override diff --git a/src/client/component/network.cpp b/src/client/component/network.cpp index 6fce092c..553f1a43 100644 --- a/src/client/component/network.cpp +++ b/src/client/component/network.cpp @@ -268,10 +268,10 @@ namespace network // increase allowed packet size const auto max_packet_size = 0x20000; - utils::hook::set(0x1404255F0, max_packet_size); // H1MP64(1.4) - utils::hook::set(0x14042562E, max_packet_size); // H1MP64(1.4) - utils::hook::set(0x140425521, max_packet_size); // H1MP64(1.4) - utils::hook::set(0x140425549, max_packet_size); // H1MP64(1.4) + utils::hook::set(0x1404255F1, max_packet_size); // H1MP64(1.4) + utils::hook::set(0x140425630, max_packet_size); // H1MP64(1.4) + utils::hook::set(0x140425522, max_packet_size); // H1MP64(1.4) + utils::hook::set(0x140425545, max_packet_size); // H1MP64(1.4) // ignore built in "print" oob command and add in our own utils::hook::set(0x14025280E, 0xEB); // H1MP64(1.4) diff --git a/src/client/game/demonware/servers/auth3_server.cpp b/src/client/game/demonware/servers/auth3_server.cpp index 601e7511..b273cd44 100644 --- a/src/client/game/demonware/servers/auth3_server.cpp +++ b/src/client/game/demonware/servers/auth3_server.cpp @@ -169,6 +169,7 @@ namespace demonware #ifdef DEBUG printf("sending reply: %s\n", result.data()); #endif + this->send_reply(&reply); #ifdef DEBUG diff --git a/src/client/game/demonware/servers/lobby_server.cpp b/src/client/game/demonware/servers/lobby_server.cpp index 822b7912..04b52aaa 100644 --- a/src/client/game/demonware/servers/lobby_server.cpp +++ b/src/client/game/demonware/servers/lobby_server.cpp @@ -24,6 +24,7 @@ namespace demonware this->register_service(); this->register_service(); this->register_service(); + this->register_service(); this->register_service(); this->register_service(); this->register_service(); diff --git a/src/client/game/demonware/services.hpp b/src/client/game/demonware/services.hpp index c4d2d97a..86326c7e 100644 --- a/src/client/game/demonware/services.hpp +++ b/src/client/game/demonware/services.hpp @@ -28,6 +28,7 @@ #include "services/bdRichPresence.hpp" // 68 //#include "services/bdTitleUtilities2.hpp" // 72 #include "services/bdUNK80.hpp" +#include "services/bdUNK95.hpp" // AccountLinking // 86 #include "services/bdPresence.hpp" //103 #include "services/bdMarketingComms.hpp" //104 diff --git a/src/client/game/demonware/services/bdStorage.cpp b/src/client/game/demonware/services/bdStorage.cpp index 5bd1382d..f9ecf867 100644 --- a/src/client/game/demonware/services/bdStorage.cpp +++ b/src/client/game/demonware/services/bdStorage.cpp @@ -11,10 +11,10 @@ namespace demonware { bdStorage::bdStorage() : service(10, "bdStorage") { - this->register_task(6, &bdStorage::list_publisher_files); - this->register_task(7, &bdStorage::get_publisher_file); - this->register_task(10, &bdStorage::set_user_file); - this->register_task(12, &bdStorage::get_user_file); + this->register_task(20, &bdStorage::list_publisher_files); + this->register_task(21, &bdStorage::get_publisher_file); + //this->register_task(10, &bdStorage::set_user_file); + this->register_task(16, &bdStorage::get_user_file); this->register_task(13, &bdStorage::unk13); this->map_publisher_resource("motd-.*\\.txt", DW_MOTD); @@ -70,6 +70,8 @@ namespace demonware uint16_t num_results, offset; std::string filename, data; + int out{}; + buffer->read(2, &out); buffer->read_uint32(&date); buffer->read_uint16(&num_results); buffer->read_uint16(&offset); @@ -98,6 +100,8 @@ namespace demonware void bdStorage::get_publisher_file(service_server* server, byte_buffer* buffer) { std::string filename; + int out{}; + buffer->read(2, &out); buffer->read_string(&filename); #ifdef DEBUG @@ -162,6 +166,8 @@ namespace demonware uint64_t owner{}; std::string game, filename, platform, data; + int out{}; + buffer->read(2, &out); buffer->read_string(&game); buffer->read_string(&filename); buffer->read_uint64(&owner); diff --git a/src/client/game/demonware/services/bdUNK95.cpp b/src/client/game/demonware/services/bdUNK95.cpp new file mode 100644 index 00000000..3cac7302 --- /dev/null +++ b/src/client/game/demonware/services/bdUNK95.cpp @@ -0,0 +1,17 @@ +#include +#include "../services.hpp" + +namespace demonware +{ + bdUNK95::bdUNK95() : service(95, "bdUNK95") + { + this->register_task(1, &bdUNK95::unk1); + } + + void bdUNK95::unk1(service_server* server, byte_buffer* /*buffer*/) const + { + // TODO: + auto reply = server->create_reply(this->task_id()); + reply->send(); + } +} diff --git a/src/client/game/demonware/services/bdUNK95.hpp b/src/client/game/demonware/services/bdUNK95.hpp new file mode 100644 index 00000000..790395d3 --- /dev/null +++ b/src/client/game/demonware/services/bdUNK95.hpp @@ -0,0 +1,13 @@ +#pragma once + +namespace demonware +{ + class bdUNK95 final : public service + { + public: + bdUNK95(); + + private: + void unk1(service_server* server, byte_buffer* buffer) const; + }; +}