cleanup demonware

This commit is contained in:
xensik 2021-02-04 15:34:16 +01:00
parent 9ce9723505
commit 14650ee7f3
41 changed files with 244 additions and 373 deletions

View File

@ -6,8 +6,8 @@
#include "byte_buffer.hpp"
#include "data_types.hpp"
#include "reply.hpp"
#include "service.hpp"
#include "server.hpp"
#include "service.hpp"
//#include "services/bdTeams.hpp" // 3
#include "services/bdStats.hpp" // 4
@ -43,8 +43,6 @@
namespace demonware
{
// KEYS
void derive_keys();
void derive_keys_s1();
void queue_packet_to_hash(const std::string& packet);
void set_session_key(const std::string& key);

View File

@ -5,27 +5,6 @@
namespace demonware
{
// SHA256 auth signature, Hmacs ...
char dw_key[296] = "\x30\x82\x01\x22\x30\x0D\x06\x09\x2A\x86\x48\x86\xF7\x0D\x01\x01"
"\x01\x05\x00\x03\x82\x01\x0F\x00\x30\x82\x01\x0A\x02\x82\x01\x01"
"\x00\xC0\xA2\x0B\x1F\x6C\xB8\x1B\x12\x70\xED\x1A\xEF\x30\x6C\x75"
"\x9D\xC1\x08\x89\x99\xF0\x2A\xC8\xAC\x2F\xC7\xD5\xD0\x3B\x61\x29"
"\x39\xF3\x8F\x62\x39\xDA\xF1\x20\x11\xE7\x92\xE9\x16\x24\x22\x96"
"\x09\x9E\xAC\x19\xCD\x24\x3E\x58\xC6\x40\x86\x78\xD7\xDF\x70\x77"
"\xCB\xDE\x80\x42\xB1\x38\xF3\x1D\x6A\x3C\x98\xE4\x85\xDB\xFB\x53"
"\x3A\x86\x47\xCE\x58\xB1\xD3\xD7\x0B\x83\x3D\x14\x6B\xDA\x40\x24"
"\x1F\x16\x2B\x0E\x49\x22\xE4\xB7\x63\xFF\xAA\x40\xC2\x44\xDF\xDC"
"\x3F\x8C\x1E\x60\xB4\x6F\x3E\xDA\xB2\x4E\x50\xCA\xFC\x62\x4B\x62"
"\xC7\xE1\x77\x5E\x83\xCD\xE0\xB5\xFC\xC6\xAA\xA0\xC2\x6B\x28\xCC"
"\x8A\xA7\x95\x7B\x1E\x67\xE0\x5B\xAF\xC6\x54\x49\xE6\xAC\x7A\x8D"
"\x1D\xE6\x7D\x12\x04\x94\xC3\x23\x4A\x00\x60\x58\x33\x6F\xE7\x94"
"\x19\xFF\xF6\xE0\xC6\x40\x50\xB7\x9D\x0E\xCD\xDF\xE7\x92\x5D\x84"
"\x94\x13\x06\x61\xBC\x44\x75\x54\x70\x54\x77\x4C\xC0\x28\x7D\xFC"
"\xC9\x9A\x92\x38\xD4\xD5\xEE\xF3\x27\x44\x66\x13\x2C\x06\xF0\x64"
"\xE7\xEC\xF8\x75\xFD\x15\xD4\x1B\x91\x45\x9D\x4A\x3F\x40\xE9\x35"
"\x53\x7F\xFC\x96\x61\xE1\x48\x74\x21\xF0\x04\x20\x41\x30\x02\xD2"
"\xF9\x02\x03\x01\x00\x01\x00";
struct data_t
{
char m_session_key[24];
@ -37,81 +16,6 @@ namespace demonware
std::string packet_buffer;
bool calculate_hmacs(const char* input, unsigned int inputSize, const char* key, unsigned int keySize, void* dst, unsigned int dstSize)
{
char buffer[400];
unsigned int pos = 0;
unsigned int out_offset = 0;
char count = 1;
char result[20];
std::memcpy(&buffer[pos], key, keySize);
pos += keySize;
buffer[pos] = count;
pos++;
unsigned int outlen = 20;
std::string output = utils::cryptography::hmac_sha1::process(std::string(buffer, pos), std::string(input, inputSize), &outlen);
std::memcpy(result, output.data(), 20);
std::memcpy(dst, result, 20);
out_offset = 20;
// second loop
while (1)
{
if (out_offset >= dstSize)
return true;
pos = 0;
std::memcpy(&buffer[pos], result, 20);
pos += 20;
std::memcpy(&buffer[pos], key, keySize);
pos += keySize;
count++;
buffer[pos] = count;
pos++;
unsigned int outlen2 = 20;
std::string output2 = utils::cryptography::hmac_sha1::process(std::string(buffer, pos), std::string(input, inputSize), &outlen2);
std::memcpy(result, output2.data(), 20);
std::memcpy(&((char*)dst)[out_offset], result, std::min(20u, (dstSize - out_offset)));
out_offset += 20;
}
return true;
}
void derive_keys()
{
std::string key_1 = utils::cryptography::sha1::compute(packet_buffer);
char out_1[24];
calculate_hmacs(data.m_session_key, 24, dw_key, 294, out_1, 24);
unsigned int len = 20;
std::string data_2(out_1, 24);
std::string data_3 = utils::cryptography::hmac_sha1::process(data_2, key_1, &len);
char out_2[16];
calculate_hmacs(data_3.data(), 20, "CLIENTCHAL", 10, out_2, 16);
char out_3[72];
calculate_hmacs(data_3.data(), 20, "BDDATA", 6, out_3, 72);
std::memcpy(data.m_response, &out_2[8], 8);
std::memcpy(data.m_dec_key, &out_3[40], 16);
std::memcpy(data.m_enc_key, &out_3[56], 16);
#ifdef DEBUG
printf("[demonware] HmacSHA1 id: %s\n", utils::string::dump_hex(std::string(&out_2[8], 8)).data());
printf("[demonware] AES enc key: %s\n", utils::string::dump_hex(std::string(&out_3[40], 16)).data());
printf("[demonware] AES dec key: %s\n", utils::string::dump_hex(std::string(&out_3[56], 16)).data());
printf("[demonware] Bravo 6, going dark.\n");
#endif
}
void calculate_hmacs_s1(const char* data_, unsigned int data_size, const char* key, unsigned int key_size, char* dst, unsigned int dst_size)
{
char buffer[64];

View File

@ -39,7 +39,6 @@ namespace demonware
std::lock_guard _(this->mutex_);
//this->reply_sent_ = true;
const auto buffer = data->data();
for (auto& byte : buffer)
{
@ -67,18 +66,14 @@ namespace demonware
void server_auth3::dispatch(const std::string& packet)
{
if (packet.starts_with("POST /auth/")) // user request auth
if (packet.starts_with("POST /auth/"))
{
#ifdef DEBUG
printf("[demonware]: [auth]: user requested authentication.\n");
#endif
//std::string result = "HTTP/1.1 100 Continue\r\n\r\n";
//raw_reply reply(result);
//this->send_reply(&reply);
return;
}
else // user send data
else
{
unsigned int title_id = 0;
unsigned int iv_seed = 0;
@ -158,15 +153,12 @@ namespace demonware
content.append("\"lsg_endpoint\": null,");
content.append("}");
//std::string signature = utils::sha256::compute(content, false);
// http stuff
std::string result;
result.append("HTTP/1.1 200 OK\r\n");
result.append("Server: TornadoServer/4.5.3\r\n");
result.append("Content-Type: application/json\r\n");
result.append(utils::string::va("Date: %s GMT\r\n", date));
//result.append(utils::va("X-Signature: %s\r\n", signature.data()));
result.append(utils::string::va("Content-Length: %d\r\n\r\n", content.size()));
result.append(content);
printf("%s\n", result.data());

View File

@ -100,15 +100,12 @@ namespace demonware
if (size <= 0)
{
#ifdef DEBUG
printf("[demonware]: [lobby]: ping packet\n");
#endif
const std::string zero("\x00\x00\x00\x00", 4);
raw_reply reply(zero);
this->send_reply(&reply);
return;
}
else if (size == 0xC8) // Connection id
else if (size == 0xC8)
{
#ifdef DEBUG
printf("[demonware]: [lobby]: received client_header_ack.\n");
@ -193,9 +190,8 @@ namespace demonware
return;
}
}
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
printf("[demonware]: [lobby]: ERROR! received unk message.\n");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
return;
}
}
@ -214,9 +210,14 @@ namespace demonware
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
printf("[demonware]: [lobby]: missing service '%s'\n", utils::string::va("%d", id));
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
// return no error
byte_buffer buffer(data);
std::uint8_t task_id;
buffer.read_byte(&task_id);
this->create_reply(task_id)->send();
}
}

View File

@ -4,95 +4,71 @@
namespace demonware
{
class task
class service
{
using callback_t = std::function<void(service_server*, byte_buffer*)>;
std::uint8_t id_;
std::string name_;
std::mutex mutex_;
std::uint8_t task_id_;
std::map<std::uint8_t, callback_t> tasks_;
public:
virtual ~service() = default;
service(service&&) = delete;
service(const service&) = delete;
service& operator=(const service&) = delete;
service(std::uint8_t id, std::string name) : id_(id), task_id_(0), name_(std::move(name)) { }
auto id() const -> std::uint8_t { return this->id_; }
auto name() const -> std::string { return this->name_; }
auto task_id() const -> std::uint8_t { return this->task_id_; }
virtual void exec_task(service_server* server, const std::string& data)
{
public:
using callback_t = std::function<void(service_server*, uint8_t, byte_buffer*)>;
std::lock_guard $(this->mutex_);
private:
std::uint8_t id_;
std::string name_;
callback_t callback_;
byte_buffer buffer(data);
public:
virtual ~task() = default;
task(task&&) = delete;
task(const task&) = delete;
task& operator=(const task&) = delete;
task(std::uint8_t id, std::string name, callback_t callback) : id_(id), name_(std::move(name)), callback_(callback) { }
buffer.read_byte(&this->task_id_);
auto id() -> std::uint8_t { return this->id_; }
auto name() -> std::string { return this->name_; }
const auto& it = this->tasks_.find(this->task_id_);
void exec(service_server* server, byte_buffer* data)
if (it != this->tasks_.end())
{
this->callback_(server, this->id_, data);
}
};
std::cout << "demonware::" << name_ << ": executing task '" << utils::string::va("%d", this->task_id_) << "'\n";
class service
it->second(server, &buffer);
}
else
{
std::cout << "demonware::" << name_ << ": missing task '" << utils::string::va("%d", this->task_id_) << "'\n";
// return no error
server->create_reply(this->task_id_)->send();
}
}
protected:
template <typename Class, typename T, typename... Args>
void register_task(const uint8_t id, T(Class::* callback)(Args ...) const)
{
std::uint8_t id_;
std::string name_;
std::mutex mutex_;
std::map<std::uint8_t, std::unique_ptr<task>> tasks_;
public:
virtual ~service() = default;
service(service&&) = delete;
service(const service&) = delete;
service& operator=(const service&) = delete;
service(std::uint8_t id, std::string name) : id_(id), name_(std::move(name)) { }
auto id() -> std::uint8_t { return this->id_; }
auto name() -> std::string { return this->name_; }
virtual void exec_task(service_server* server, const std::string& data)
this->tasks_[id] = [this, callback](Args ... args) -> T
{
std::lock_guard $(this->mutex_);
return (reinterpret_cast<Class*>(this)->*callback)(args...);
};
}
byte_buffer buffer(data);
std::uint8_t task_id;
buffer.read_byte(&task_id);
const auto& it = this->tasks_.find(task_id);
if (it != this->tasks_.end())
{
#ifdef DEBUG
printf("[demonware]: [%s]: executing task '%s\n", name_.data(), it->second->name().data());
#endif
it->second->exec(server, &buffer);
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
printf("[demonware]: [%s]: missing task '%s'\n", name_.data(), utils::string::va("%d", task_id));
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
}
}
protected:
template <typename Class, typename T, typename... Args>
void register_task(const uint8_t id, std::string name, T(Class::* callback)(Args ...) const)
template <typename Class, typename T, typename... Args>
void register_task(const uint8_t id, T(Class::* callback)(Args ...))
{
this->tasks_[id] = [this, callback](Args ... args) -> T
{
this->tasks_[id] = std::make_unique<task>(id, std::move(name), [this, callback](Args ... args) -> T
{
return (reinterpret_cast<Class*>(this)->*callback)(args...);
});
}
template <typename Class, typename T, typename... Args>
void register_task(const uint8_t id, std::string name, T(Class::* callback)(Args ...))
{
this->tasks_[id] = std::make_unique<task>(id, std::move(name), [this, callback](Args ... args) -> T
{
return (reinterpret_cast<Class*>(this)->*callback)(args...);
});
}
};
return (reinterpret_cast<Class*>(this)->*callback)(args...);
};
}
};
} // namespace demonware

View File

@ -6,21 +6,21 @@ namespace demonware
bdAnticheat::bdAnticheat() : service(38, "bdAnticheat")
{
this->register_task(2, "unk2", &bdAnticheat::unk2);
this->register_task(4, "report console details", &bdAnticheat::report_console_details);
this->register_task(2, &bdAnticheat::unk2);
this->register_task(4, &bdAnticheat::report_console_details);
}
void bdAnticheat::unk2(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdAnticheat::unk2(service_server* server, byte_buffer* buffer) const
{
// TODO: Read data as soon as needed
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdAnticheat::report_console_details(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdAnticheat::report_console_details(service_server* server, byte_buffer* buffer) const
{
// TODO: Read data as soon as needed
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}

View File

@ -9,8 +9,8 @@ namespace demonware
bdAnticheat();
private:
void unk2(service_server* server, uint8_t type, byte_buffer* buffer) const;
void report_console_details(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk2(service_server* server, byte_buffer* buffer) const;
void report_console_details(service_server* server, byte_buffer* buffer) const;
};
}

View File

@ -6,21 +6,21 @@ namespace demonware
bdContentStreaming::bdContentStreaming() : service(50, "bdContentStreaming")
{
this->register_task(2, "unk2", &bdContentStreaming::unk2);
this->register_task(3, "unk3", &bdContentStreaming::unk3);
this->register_task(2, &bdContentStreaming::unk2);
this->register_task(3, &bdContentStreaming::unk3);
}
void bdContentStreaming::unk2(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdContentStreaming::unk2(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdContentStreaming::unk3(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdContentStreaming::unk3(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}

View File

@ -9,8 +9,8 @@ namespace demonware
bdContentStreaming();
private:
void unk2(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk3(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk2(service_server* server, byte_buffer* buffer) const;
void unk3(service_server* server, byte_buffer* buffer) const;
};
}

View File

@ -6,21 +6,21 @@ namespace demonware
bdCounters::bdCounters() : service(23, "bdCounters")
{
this->register_task(1, "unk1", &bdCounters::unk1);
this->register_task(2, "unk2", &bdCounters::unk2);
this->register_task(1, &bdCounters::unk1);
this->register_task(2, &bdCounters::unk2);
}
void bdCounters::unk1(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdCounters::unk1(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdCounters::unk2(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdCounters::unk2(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}

View File

@ -9,8 +9,8 @@ namespace demonware
bdCounters();
private:
void unk1(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk2(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk1(service_server* server, byte_buffer* buffer) const;
void unk2(service_server* server, byte_buffer* buffer) const;
};
}

View File

@ -5,10 +5,10 @@ namespace demonware
{
bdDML::bdDML() : service(27, "bdDML")
{
this->register_task(2, "get user raw data", &bdDML::get_user_raw_data);
this->register_task(2, &bdDML::get_user_raw_data);
}
void bdDML::get_user_raw_data(service_server* server, uint8_t type, byte_buffer* /*buffer*/) const
void bdDML::get_user_raw_data(service_server* server, byte_buffer* /*buffer*/) const
{
auto result = new bdDMLRawData;
result->country_code = "US";
@ -21,7 +21,7 @@ namespace demonware
result->asn = 0x2119;
result->timezone = "+01:00";
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->add(result);
reply->send();
}

View File

@ -8,6 +8,6 @@ namespace demonware
bdDML();
private:
void get_user_raw_data(service_server* server, uint8_t type, byte_buffer* buffer) const;
void get_user_raw_data(service_server* server, byte_buffer* buffer) const;
};
}

View File

@ -6,13 +6,13 @@ namespace demonware
bdEventLog::bdEventLog() : service(67, "bdEventLog")
{
this->register_task(6, "unk6", &bdEventLog::unk6);
this->register_task(6, &bdEventLog::unk6);
}
void bdEventLog::unk6(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdEventLog::unk6(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}

View File

@ -9,7 +9,7 @@ namespace demonware
bdEventLog();
private:
void unk6(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk6(service_server* server, byte_buffer* buffer) const;
};
}

View File

@ -6,37 +6,37 @@ namespace demonware
bdFacebook::bdFacebook() : service(36, "bdFacebook")
{
this->register_task(1, "unk1", &bdFacebook::unk1);
this->register_task(3, "unk3", &bdFacebook::unk3);
this->register_task(7, "unk7", &bdFacebook::unk7);
this->register_task(8, "unk8", &bdFacebook::unk8);
this->register_task(1, &bdFacebook::unk1);
this->register_task(3, &bdFacebook::unk3);
this->register_task(7, &bdFacebook::unk7);
this->register_task(8, &bdFacebook::unk8);
}
void bdFacebook::unk1(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdFacebook::unk1(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdFacebook::unk3(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdFacebook::unk3(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdFacebook::unk7(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdFacebook::unk7(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdFacebook::unk8(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdFacebook::unk8(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}

View File

@ -9,10 +9,10 @@ namespace demonware
bdFacebook();
private:
void unk1(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk3(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk7(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk8(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk1(service_server* server, byte_buffer* buffer) const;
void unk3(service_server* server, byte_buffer* buffer) const;
void unk7(service_server* server, byte_buffer* buffer) const;
void unk8(service_server* server, byte_buffer* buffer) const;
};
}

View File

@ -6,21 +6,21 @@ namespace demonware
bdGroups::bdGroups() : service(28, "bdGroup")
{
this->register_task(1, "set_groups", &bdGroups::set_groups);
this->register_task(4, "unk4", &bdGroups::unk4);
this->register_task(1, &bdGroups::set_groups);
this->register_task(4, &bdGroups::unk4);
}
void bdGroups::set_groups(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdGroups::set_groups(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdGroups::unk4(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdGroups::unk4(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}

View File

@ -9,8 +9,8 @@ namespace demonware
bdGroups();
private:
void set_groups(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk4(service_server* server, uint8_t type, byte_buffer* buffer) const;
void set_groups(service_server* server, byte_buffer* buffer) const;
void unk4(service_server* server, byte_buffer* buffer) const;
};
}

View File

@ -6,13 +6,13 @@ namespace demonware
bdMarketing::bdMarketing() : service(139, "bdMarketing")
{
this->register_task(3, "unk3", &bdMarketing::unk3);
this->register_task(3, &bdMarketing::unk3);
}
void bdMarketing::unk3(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdMarketing::unk3(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}

View File

@ -9,7 +9,7 @@ namespace demonware
bdMarketing();
private:
void unk3(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk3(service_server* server, byte_buffer* buffer) const;
};
}

View File

@ -6,45 +6,45 @@ namespace demonware
bdMatchMaking2::bdMatchMaking2() : service(138, "bdMatchMaking2")
{
this->register_task(1, "unk1", &bdMatchMaking2::unk1);
this->register_task(2, "unk2", &bdMatchMaking2::unk2);
this->register_task(3, "unk3", &bdMatchMaking2::unk3);
this->register_task(5, "unk5", &bdMatchMaking2::unk5);
this->register_task(16, "unk16", &bdMatchMaking2::unk16);
this->register_task(1, &bdMatchMaking2::unk1);
this->register_task(2, &bdMatchMaking2::unk2);
this->register_task(3, &bdMatchMaking2::unk3);
this->register_task(5, &bdMatchMaking2::unk5);
this->register_task(16, &bdMatchMaking2::unk16);
}
void bdMatchMaking2::unk1(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdMatchMaking2::unk1(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdMatchMaking2::unk2(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdMatchMaking2::unk2(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdMatchMaking2::unk3(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdMatchMaking2::unk3(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdMatchMaking2::unk5(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdMatchMaking2::unk5(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdMatchMaking2::unk16(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdMatchMaking2::unk16(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}

View File

@ -9,11 +9,11 @@ namespace demonware
bdMatchMaking2();
private:
void unk1(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk2(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk3(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk5(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk16(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk1(service_server* server, byte_buffer* buffer) const;
void unk2(service_server* server, byte_buffer* buffer) const;
void unk3(service_server* server, byte_buffer* buffer) const;
void unk5(service_server* server, byte_buffer* buffer) const;
void unk16(service_server* server, byte_buffer* buffer) const;
};
}

View File

@ -6,21 +6,21 @@ namespace demonware
bdPresence::bdPresence() : service(103, "bdPresence")
{
this->register_task(1, "unk1", &bdPresence::unk1);
this->register_task(3, "unk3", &bdPresence::unk3);
this->register_task(1, &bdPresence::unk1);
this->register_task(3, &bdPresence::unk3);
}
void bdPresence::unk1(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdPresence::unk1(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdPresence::unk3(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdPresence::unk3(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}

View File

@ -9,8 +9,8 @@ namespace demonware
bdPresence();
private:
void unk1(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk3(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk1(service_server* server, byte_buffer* buffer) const;
void unk3(service_server* server, byte_buffer* buffer) const;
};
}

View File

@ -6,13 +6,13 @@ namespace demonware
bdProfiles::bdProfiles() : service(8, "bdProfiles")
{
this->register_task(3, "unk3", &bdProfiles::unk3);
this->register_task(3, &bdProfiles::unk3);
}
void bdProfiles::unk3(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdProfiles::unk3(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}

View File

@ -9,7 +9,7 @@ namespace demonware
bdProfiles();
private:
void unk3(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk3(service_server* server, byte_buffer* buffer) const;
};
}

View File

@ -6,21 +6,21 @@ namespace demonware
bdRichPresence::bdRichPresence() : service(68, "bdRichPresence")
{
this->register_task(1, "unk1", &bdRichPresence::unk1);
this->register_task(2, "unk2", &bdRichPresence::unk2);
this->register_task(1, &bdRichPresence::unk1);
this->register_task(2, &bdRichPresence::unk2);
}
void bdRichPresence::unk1(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdRichPresence::unk1(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdRichPresence::unk2(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdRichPresence::unk2(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}

View File

@ -9,8 +9,8 @@ namespace demonware
bdRichPresence();
private:
void unk1(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk2(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk1(service_server* server, byte_buffer* buffer) const;
void unk2(service_server* server, byte_buffer* buffer) const;
};
}

View File

@ -6,45 +6,45 @@ namespace demonware
bdStats::bdStats() : service(4, "bdStats")
{
this->register_task(1, "unk1", &bdStats::unk1);
this->register_task(3, "unk3", &bdStats::unk3); // leaderboards
this->register_task(4, "unk4", &bdStats::unk4);
this->register_task(8, "unk8", &bdStats::unk8);
this->register_task(11, "unk11", &bdStats::unk11);
this->register_task(1, &bdStats::unk1);
this->register_task(3, &bdStats::unk3); // leaderboards
this->register_task(4, &bdStats::unk4);
this->register_task(8, &bdStats::unk8);
this->register_task(11, &bdStats::unk11);
}
void bdStats::unk1(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdStats::unk1(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdStats::unk3(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdStats::unk3(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdStats::unk4(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdStats::unk4(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdStats::unk8(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdStats::unk8(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdStats::unk11(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdStats::unk11(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}

View File

@ -9,11 +9,11 @@ namespace demonware
bdStats();
private:
void unk1(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk3(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk4(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk8(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk11(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk1(service_server* server, byte_buffer* buffer) const;
void unk3(service_server* server, byte_buffer* buffer) const;
void unk4(service_server* server, byte_buffer* buffer) const;
void unk8(service_server* server, byte_buffer* buffer) const;
void unk11(service_server* server, byte_buffer* buffer) const;
};
}

View File

@ -8,11 +8,11 @@ namespace demonware
{
bdStorage::bdStorage() : service(10, "bdStorage")
{
this->register_task(6, "list publisher files", &bdStorage::list_publisher_files);
this->register_task(7, "get publisher file", &bdStorage::get_publisher_file);
this->register_task(10, "set user file", &bdStorage::set_user_file);
this->register_task(12, "get user file", &bdStorage::get_user_file);
this->register_task(13, "unk13", &bdStorage::unk13);
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(13, &bdStorage::unk13);
this->map_publisher_resource("motd-.*\\.txt", DW_MOTD);
this->map_publisher_resource("ffotd-*\\.ff", DW_FASTFILE);
@ -49,7 +49,7 @@ namespace demonware
return false;
}
void bdStorage::list_publisher_files(service_server* server, uint8_t type, byte_buffer* buffer)
void bdStorage::list_publisher_files(service_server* server, byte_buffer* buffer)
{
uint32_t date;
uint16_t num_results, offset;
@ -60,7 +60,7 @@ namespace demonware
buffer->read_uint16(&offset);
buffer->read_string(&filename);
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
if (this->load_publisher_resource(filename, data))
{
@ -80,7 +80,7 @@ namespace demonware
reply->send();
}
void bdStorage::get_publisher_file(service_server* server, uint8_t type, byte_buffer* buffer)
void bdStorage::get_publisher_file(service_server* server, byte_buffer* buffer)
{
std::string filename;
buffer->read_string(&filename);
@ -97,13 +97,13 @@ namespace demonware
printf("[demonware]: [bdStorage]: sending publisher file: %s, size: %lld\n", filename.data(), data.size());
#endif
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->add(new bdFileData(data));
reply->send();
}
else
{
server->create_reply(type, game::BD_NO_FILE)->send();
server->create_reply(this->task_id(), game::BD_NO_FILE)->send();
}
}
@ -112,7 +112,7 @@ namespace demonware
return "players2/user/" + name;
}
void bdStorage::set_user_file(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdStorage::set_user_file(service_server* server, byte_buffer* buffer) const
{
bool priv;
uint64_t owner;
@ -137,12 +137,12 @@ namespace demonware
info->owner_id = owner;
info->priv = priv;
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->add(info);
reply->send();
}
void bdStorage::get_user_file(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdStorage::get_user_file(service_server* server, byte_buffer* buffer) const
{
uint64_t owner{};
std::string game, filename, platform, data;
@ -159,20 +159,20 @@ namespace demonware
const auto path = get_user_file_path(filename);
if (utils::io::read_file(path, &data))
{
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->add(new bdFileData(data));
reply->send();
}
else
{
server->create_reply(type, game::BD_NO_FILE)->send();
server->create_reply(this->task_id(), game::BD_NO_FILE)->send();
}
}
void bdStorage::unk13(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdStorage::unk13(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
} // namespace demonware

View File

@ -14,11 +14,11 @@ namespace demonware
void map_publisher_resource(const std::string& expression, INT id);
bool load_publisher_resource(const std::string& name, std::string& buffer);
void list_publisher_files(service_server* server, uint8_t type, byte_buffer* buffer);
void get_publisher_file(service_server* server, uint8_t type, byte_buffer* buffer);
void set_user_file(service_server* server, uint8_t type, byte_buffer* buffer) const;
void get_user_file(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk13(service_server* server, uint8_t type, byte_buffer* buffer) const;
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 unk13(service_server* server, byte_buffer* buffer) const;
static std::string get_user_file_path(const std::string& name);
};

View File

@ -5,15 +5,15 @@ namespace demonware
{
bdTitleUtilities::bdTitleUtilities() : service(12, "bdTitleUtilities")
{
this->register_task(6, "get server time", &bdTitleUtilities::get_server_time);
this->register_task(6, &bdTitleUtilities::get_server_time);
}
void bdTitleUtilities::get_server_time(service_server* server, uint8_t type, byte_buffer* /*buffer*/) const
void bdTitleUtilities::get_server_time(service_server* server, byte_buffer* /*buffer*/) const
{
const auto time_result = new bdTimeStamp;
time_result->unix_time = uint32_t(time(nullptr));
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->add(time_result);
reply->send();
}

View File

@ -8,6 +8,6 @@ namespace demonware
bdTitleUtilities();
private:
void get_server_time(service_server* server, uint8_t type, byte_buffer* buffer) const;
void get_server_time(service_server* server, byte_buffer* buffer) const;
};
}

View File

@ -6,13 +6,13 @@ namespace demonware
bdUNK104::bdUNK104() : service(104, "bdUNK104")
{
this->register_task(1, "unk1", &bdUNK104::unk1);
this->register_task(1, &bdUNK104::unk1);
}
void bdUNK104::unk1(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdUNK104::unk1(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}

View File

@ -9,7 +9,7 @@ namespace demonware
bdUNK104();
private:
void unk1(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk1(service_server* server, byte_buffer* buffer) const;
};
}

View File

@ -9,10 +9,10 @@ namespace demonware
//this->register_task(6, "unk6", &bdUNK63::unk6);
}
void bdUNK63::unk(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdUNK63::unk(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}

View File

@ -9,7 +9,7 @@ namespace demonware
bdUNK63();
private:
void unk(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk(service_server* server, byte_buffer* buffer) const;
};
}

View File

@ -6,53 +6,53 @@ namespace demonware
bdUNK80::bdUNK80() : service(80, "bdUNK80")
{
this->register_task(42, "unk42", &bdUNK80::unk42);
this->register_task(49, "unk49", &bdUNK80::unk49);
this->register_task(60, "unk60", &bdUNK80::unk60);
this->register_task(130, "unk130", &bdUNK80::unk130);
this->register_task(165, "unk165", &bdUNK80::unk165);
this->register_task(193, "unk193", &bdUNK80::unk193);
this->register_task(42, &bdUNK80::unk42);
this->register_task(49, &bdUNK80::unk49);
this->register_task(60, &bdUNK80::unk60);
this->register_task(130, &bdUNK80::unk130);
this->register_task(165, &bdUNK80::unk165);
this->register_task(193, &bdUNK80::unk193);
}
void bdUNK80::unk42(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdUNK80::unk42(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdUNK80::unk49(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdUNK80::unk49(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdUNK80::unk60(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdUNK80::unk60(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdUNK80::unk130(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdUNK80::unk130(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdUNK80::unk165(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdUNK80::unk165(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}
void bdUNK80::unk193(service_server* server, uint8_t type, byte_buffer* buffer) const
void bdUNK80::unk193(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(type);
auto reply = server->create_reply(this->task_id());
reply->send();
}

View File

@ -9,12 +9,12 @@ namespace demonware
bdUNK80();
private:
void unk42(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk49(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk60(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk130(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk165(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk193(service_server* server, uint8_t type, byte_buffer* buffer) const;
void unk42(service_server* server, byte_buffer* buffer) const;
void unk49(service_server* server, byte_buffer* buffer) const;
void unk60(service_server* server, byte_buffer* buffer) const;
void unk130(service_server* server, byte_buffer* buffer) const;
void unk165(service_server* server, byte_buffer* buffer) const;
void unk193(service_server* server, byte_buffer* buffer) const;
};
}