DW done maybe

This commit is contained in:
Federico Cecchetto 2022-02-26 00:39:54 +01:00
parent 1f885dd588
commit 857f220e06
9 changed files with 71 additions and 24 deletions

View File

@ -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)
});
}
}

View File

@ -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

View File

@ -268,10 +268,10 @@ namespace network
// increase allowed packet size
const auto max_packet_size = 0x20000;
utils::hook::set<int>(0x1404255F0, max_packet_size); // H1MP64(1.4)
utils::hook::set<int>(0x14042562E, max_packet_size); // H1MP64(1.4)
utils::hook::set<int>(0x140425521, max_packet_size); // H1MP64(1.4)
utils::hook::set<int>(0x140425549, max_packet_size); // H1MP64(1.4)
utils::hook::set<int>(0x1404255F1, max_packet_size); // H1MP64(1.4)
utils::hook::set<int>(0x140425630, max_packet_size); // H1MP64(1.4)
utils::hook::set<int>(0x140425522, max_packet_size); // H1MP64(1.4)
utils::hook::set<int>(0x140425545, max_packet_size); // H1MP64(1.4)
// ignore built in "print" oob command and add in our own
utils::hook::set<uint8_t>(0x14025280E, 0xEB); // H1MP64(1.4)

View File

@ -169,6 +169,7 @@ namespace demonware
#ifdef DEBUG
printf("sending reply: %s\n", result.data());
#endif
this->send_reply(&reply);
#ifdef DEBUG

View File

@ -24,6 +24,7 @@ namespace demonware
this->register_service<bdFacebook>();
this->register_service<bdUNK63>();
this->register_service<bdUNK80>();
this->register_service<bdUNK95>();
this->register_service<bdPresence>();
this->register_service<bdMarketingComms>();
this->register_service<bdMatchMaking2>();

View File

@ -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

View File

@ -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);

View File

@ -0,0 +1,17 @@
#include <std_include.hpp>
#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();
}
}

View File

@ -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;
};
}