Demonware stuff 4

This commit is contained in:
quaK 2022-09-23 01:05:27 +03:00
parent 98e95347d5
commit 58c14d1998
7 changed files with 116 additions and 20 deletions

View File

@ -530,6 +530,8 @@ namespace demonware
utils::hook::set(0x52AB60_b, 0xC301B0);
utils::hook::set<uint8_t>(0x52A6D0_b, 0xC3);
utils::hook::jump(0x52B800_b, get_patching_status_stub);
utils::hook::set<uint8_t>(0xDC0C00_b, 0xC3); // Live_CheckForFullDisconnect
}
void pre_destroy() override

View File

@ -11,6 +11,7 @@ namespace demonware
lobby_server::lobby_server(std::string name) : tcp_server(std::move(name))
{
this->register_service<bdAnticheat>();
this->register_service<bdAsyncMatchMaking>();
this->register_service<bdBandwidthTest>();
this->register_service<bdCMail>();
this->register_service<bdContentStreaming>();

View File

@ -40,3 +40,4 @@
#include "services/bdUNK123.hpp" // 123
#include "services/bdMatchMaking.hpp" // 138
#include "services/bdReward.hpp" // 139
#include "services/bdAsyncMatchMaking.hpp" // 145

View File

@ -0,0 +1,76 @@
#include <std_include.hpp>
#include "../services.hpp"
namespace demonware
{
bdAsyncMatchMaking::bdAsyncMatchMaking() : service(145, "bdAsyncMatchMaking")
{
this->register_task(2, &bdAsyncMatchMaking::unk2);
this->register_task(3, &bdAsyncMatchMaking::unk3);
this->register_task(6, &bdAsyncMatchMaking::unk6);
this->register_task(7, &bdAsyncMatchMaking::unk7);
}
void bdAsyncMatchMaking::unk2(service_server* server, byte_buffer* /*buffer*/) const
{
// TODO:
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdAsyncMatchMaking::unk3(service_server* server, byte_buffer* /*buffer*/) const
{
// TODO:
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdAsyncMatchMaking::unk6(service_server* server, byte_buffer* /*buffer*/) const
{
class task6Result final : public bdTaskResult
{
public:
std::string jsondata;
void serialize(byte_buffer* data) override
{
data->write_string(jsondata);
}
void deserialize(byte_buffer* data) override
{
data->read_string(&jsondata);
}
};
// TODO:
auto reply = server->create_reply(this->task_id());
rapidjson::Document response_json;
response_json.SetObject();
response_json.AddMember("matchmaking_id", 0, response_json.GetAllocator());
rapidjson::Document backoff_timing_info;
backoff_timing_info.SetObject();
response_json.AddMember("backoff_timing_info", backoff_timing_info, response_json.GetAllocator());
rapidjson::StringBuffer s_buffer{};
rapidjson::Writer<rapidjson::StringBuffer, rapidjson::Document::EncodingType, rapidjson::ASCII<>>
writer(s_buffer);
response_json.Accept(writer);
auto response = new task6Result;
response->jsondata = std::string(s_buffer.GetString(), s_buffer.GetSize());
reply->add(response);
reply->send();
}
void bdAsyncMatchMaking::unk7(service_server* server, byte_buffer* /*buffer*/) const
{
// TODO:
auto reply = server->create_reply(this->task_id());
reply->send();
}
}

View File

@ -0,0 +1,16 @@
#pragma once
namespace demonware
{
class bdAsyncMatchMaking final : public service
{
public:
bdAsyncMatchMaking();
private:
void unk2(service_server* server, byte_buffer* buffer) const;
void unk3(service_server* server, byte_buffer* buffer) const;
void unk6(service_server* server, byte_buffer* buffer) const;
void unk7(service_server* server, byte_buffer* buffer) const;
};
}

View File

@ -11,11 +11,11 @@ namespace demonware
{
bdStorage::bdStorage() : service(10, "bdStorage")
{
this->register_task(20, &bdStorage::list_publisher_files);
this->register_task(21, &bdStorage::get_publisher_file);
this->register_task(24, &bdStorage::set_user_file);
this->register_task(16, &bdStorage::get_user_file);
this->register_task(12, &bdStorage::unk12);
this->register_task(20, &bdStorage::listAllPublisherFiles);
this->register_task(21, &bdStorage::getPublisherFile);
this->register_task(24, &bdStorage::uploadAndValidateFiles);
this->register_task(16, &bdStorage::getFiles);
this->register_task(12, &bdStorage::getFile);
this->map_publisher_resource("motd-.*\\.txt", DW_MOTD);
// this->map_publisher_resource("ffotd-.*\\.ff", DW_FASTFILE);
@ -64,7 +64,7 @@ namespace demonware
return false;
}
void bdStorage::list_publisher_files(service_server* server, byte_buffer* buffer)
void bdStorage::listAllPublisherFiles(service_server* server, byte_buffer* buffer)
{
uint32_t date;
uint16_t num_results, offset;
@ -101,7 +101,7 @@ namespace demonware
reply->send();
}
void bdStorage::get_publisher_file(service_server* server, byte_buffer* buffer)
void bdStorage::getPublisherFile(service_server* server, byte_buffer* buffer)
{
std::string unk, filename;
buffer->read_string(&unk);
@ -134,7 +134,7 @@ namespace demonware
return "players2/user/" + name;
}
void bdStorage::set_user_file(service_server* server, byte_buffer* buffer) const
void bdStorage::uploadAndValidateFiles(service_server* server, byte_buffer* buffer) const
{
uint64_t owner;
uint32_t numfiles;
@ -182,7 +182,7 @@ namespace demonware
reply->send();
}
void bdStorage::get_user_file(service_server* server, byte_buffer* buffer) const
void bdStorage::getFiles(service_server* server, byte_buffer* buffer) const
{
std::string platform;
uint32_t numunk;
@ -236,7 +236,7 @@ namespace demonware
reply->send();
}
void bdStorage::unk12(service_server* server, byte_buffer* buffer) const
void bdStorage::getFile(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(this->task_id());

View File

@ -16,11 +16,11 @@ namespace demonware
void map_publisher_resource_variant(const std::string& expression, resource_variant resource);
bool load_publisher_resource(const std::string& name, std::string& buffer);
void list_publisher_files(service_server* server, byte_buffer* buffer);
void get_publisher_file(service_server* server, byte_buffer* buffer);
void set_user_file(service_server* server, byte_buffer* buffer) const;
void get_user_file(service_server* server, byte_buffer* buffer) const;
void unk12(service_server* server, byte_buffer* buffer) const;
void listAllPublisherFiles(service_server* server, byte_buffer* buffer);
void getPublisherFile(service_server* server, byte_buffer* buffer);
void uploadAndValidateFiles(service_server* server, byte_buffer* buffer) const;
void getFiles(service_server* server, byte_buffer* buffer) const;
void getFile(service_server* server, byte_buffer* buffer) const;
static std::string get_user_file_path(const std::string& name);
};