From bb9b64d2fb46d1d349e36f760dc218e09e91a136 Mon Sep 17 00:00:00 2001 From: quaK <38787176+Joelrau@users.noreply.github.com> Date: Wed, 21 Sep 2022 02:57:39 +0300 Subject: [PATCH] Demonware stuff 2 --- src/client/game/demonware/data_types.hpp | 34 +++++++++---------- .../demonware/services/bdMarketingComms.cpp | 16 ++++++--- .../game/demonware/services/bdStorage.cpp | 12 +++---- 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/src/client/game/demonware/data_types.hpp b/src/client/game/demonware/data_types.hpp index 8753d815..eb2fc703 100644 --- a/src/client/game/demonware/data_types.hpp +++ b/src/client/game/demonware/data_types.hpp @@ -144,32 +144,30 @@ namespace demonware } }; - // made up name - class bdFile final : public bdTaskResult + struct bdFileQueryResult final : public bdTaskResult { - public: - uint64_t owner_id; + uint64_t user_id; std::string platform; std::string filename; - uint32_t unk; - std::string data; + uint32_t errorcode; + std::string filedata; - void serialize(byte_buffer* buffer) override + void serialize(byte_buffer* data) override { - buffer->write_uint64(this->owner_id); - buffer->write_string(this->platform); - buffer->write_string(this->filename); - buffer->write_uint32(this->unk); - buffer->write_blob(this->data); + data->write_uint64(user_id); + data->write_string(platform); + data->write_string(filename); + data->write_uint32(errorcode); + data->write_blob(filedata); } - void deserialize(byte_buffer* buffer) override + void deserialize(byte_buffer* data) override { - buffer->read_uint64(&this->owner_id); - buffer->read_string(&this->platform); - buffer->read_string(&this->filename); - buffer->read_uint32(&this->unk); - buffer->read_blob(&this->data); + data->read_uint64(&user_id); + data->read_string(&platform); + data->read_string(&filename); + data->read_uint32(&errorcode); + data->read_blob(&filedata); } }; diff --git a/src/client/game/demonware/services/bdMarketingComms.cpp b/src/client/game/demonware/services/bdMarketingComms.cpp index 367eba2f..3aaabf71 100644 --- a/src/client/game/demonware/services/bdMarketingComms.cpp +++ b/src/client/game/demonware/services/bdMarketingComms.cpp @@ -1,13 +1,17 @@ #include #include "../services.hpp" +#include "game/game.hpp" + +#include + namespace demonware { bdMarketingComms::bdMarketingComms() : service(104, "bdMarketingComms") { this->register_task(1, &bdMarketingComms::getMessages); this->register_task(4, &bdMarketingComms::reportFullMessagesViewed); - this->register_task(6, &bdMarketingComms::reportFullMessagesViewed); + this->register_task(6, &bdMarketingComms::unk6); } void bdMarketingComms::getMessages(service_server* server, byte_buffer* /*buffer*/) const @@ -24,10 +28,12 @@ namespace demonware reply->send(); } - void bdMarketingComms::unk6(service_server* server, byte_buffer* /*buffer*/) const + void bdMarketingComms::unk6(service_server* server, byte_buffer* buffer) const { - // TODO: - auto reply = server->create_reply(this->task_id()); - reply->send(); +#ifdef DEBUG + utils::io::write_file("demonware/bdMarketingComms/unk6", buffer->get_buffer()); +#endif + + server->create_reply(this->task_id(), game::BD_NO_FILE)->send(); } } diff --git a/src/client/game/demonware/services/bdStorage.cpp b/src/client/game/demonware/services/bdStorage.cpp index 2a025442..63442d29 100644 --- a/src/client/game/demonware/services/bdStorage.cpp +++ b/src/client/game/demonware/services/bdStorage.cpp @@ -203,7 +203,7 @@ namespace demonware std::string platform; uint32_t numunk; uint32_t numfiles; - uint64_t owner = 0; + uint64_t user_id = 0; std::string game; buffer->read_string(&platform); @@ -211,7 +211,7 @@ namespace demonware for (uint32_t i = 0; i < numunk; i++) { - buffer->read_uint64(&owner); + buffer->read_uint64(&user_id); buffer->read_string(&game); } @@ -234,12 +234,12 @@ namespace demonware continue; } - auto response = new bdFile; - response->owner_id = owner; - response->unk = 0; + auto response = new bdFileQueryResult; + response->user_id = user_id; response->platform = platform; response->filename = filename; - response->data = data; + response->errorcode = 0; + response->filedata = data; reply->add(response); ++count;