Some demonware progress

This commit is contained in:
momo5502 2022-09-21 19:32:40 +02:00
parent f6de4aceb0
commit 1d0f79623f
11 changed files with 5149 additions and 60 deletions

View File

@ -419,24 +419,6 @@ namespace demonware
}
}
utils::hook::detour handle_auth_reply_hook;
bool handle_auth_reply_stub(void* a1, void* a2, void* a3)
{
// Skip bdAuth::validateResponseSignature
//utils::hook::set(0x7D4AB0_b, 0xC301B0);
// Skip bdAuth::processPlatformData
//utils::hook::set(0x7D55C0_b, 0xC301B0);
return handle_auth_reply_hook.invoke<bool>(a1, a2, a3);
}
void request_start_match_stub()
{
//const auto* args = "StartServer";
//game::UI_RunMenuScript(0, &args);
}
void register_hook(const std::string& process, void* stub)
{
const utils::nt::library game_module{};
@ -498,30 +480,7 @@ namespace demonware
utils::hook::copy_string(0x1430B9BE0_g, "http://prod.uno.demonware.net/v1.0");
utils::hook::copy_string(0x1430B93C8_g, "http://%s:%d/auth/");
/*
// utils::hook::set<uint8_t>(0x19F8C0_b, 0xC3); // SV_SendMatchData, not sure
utils::hook::nop(0x19BB67_b, 5); // LiveStorage_SendMatchDataComplete (crashes at the end of match)
utils::hook::nop(0x19BC3F_b, 5); // LiveStorage_GettingStoreConfigComplete probably (crashes randomly)
utils::hook::nop(0x19BC48_b, 5); // similar to above (crashes in killcam)
utils::hook::set<uint8_t>(0x1A3340_b, 0xC3); // Live_CheckForFullDisconnect
// Remove some while loop that freezes the rendering for a few secs while connecting
utils::hook::nop(0x625555_b, 5);
handle_auth_reply_hook.create(0x7AC600_b, handle_auth_reply_stub);
// Skip update check in Live_SyncOnlineDataFlags
utils::hook::set(0x47A6D0_b, 0xC301B0);
// Remove update failed popup
utils::hook::set(0x47B2B0_b, 0xC301B0);
// xpartygo -> just start the match
utils::hook::jump(0x355B80_b, request_start_match_stub);
utils::hook::set(0x396AD0_b, 0xC301B0); // DB_IsZoneLoaded("ffotd")
utils::hook::set(0x4DD600_b, 0xC300B0); // dont use ffotd
utils::hook::set(0x4DD5B0_b, 0xC300B0); // dont dl ffotd
*/
utils::hook::set<uint32_t>(0x141EC4B50_g, 0xC3D08948); // Skip publisher file signature stuff
}
void pre_destroy() override

View File

@ -123,6 +123,23 @@ namespace demonware
gmtime_s(&gmtm, &now);
strftime(date, 64, "%a, %d %b %G %T", &gmtm);
rapidjson::Document extra;
extra.SetObject();
std::string username = std::string(ticket.m_username, sizeof(ticket.m_username)).data();
extra.AddMember("username", username, extra.GetAllocator());
extra.AddMember("time_to_live", 9999, extra.GetAllocator());
const auto lul = utils::cryptography::base64::encode("lul");
extra.AddMember("extended_data", lul, extra.GetAllocator());
rapidjson::StringBuffer extra_buffer{};
rapidjson::Writer<rapidjson::StringBuffer, rapidjson::Document::EncodingType, rapidjson::ASCII<>>
extra_writer(extra_buffer);
extra.Accept(extra_writer);
std::string extra_data{};
extra_data.append(extra_buffer.GetString(), extra_buffer.GetLength());
// json content
rapidjson::Document doc;
doc.SetObject();
@ -131,14 +148,15 @@ namespace demonware
doc.AddMember("code", "700", doc.GetAllocator());
auto seed = std::to_string(iv_seed);
doc.AddMember("iv_seed", rapidjson::StringRef(seed.data(), seed.size()), doc.GetAllocator());
doc.AddMember("client_ticket", rapidjson::StringRef(ticket_b64.data(), ticket_b64.size()), doc.GetAllocator());
doc.AddMember("server_ticket", rapidjson::StringRef(auth_data_b64.data(), auth_data_b64.size()),
doc.GetAllocator());
doc.AddMember("iv_seed", seed, doc.GetAllocator());
doc.AddMember("client_ticket", ticket_b64, doc.GetAllocator());
doc.AddMember("server_ticket", auth_data_b64, doc.GetAllocator());
doc.AddMember("client_id", "", doc.GetAllocator());
doc.AddMember("account_type", "steam", doc.GetAllocator());
doc.AddMember("crossplay_enabled", false, doc.GetAllocator());
doc.AddMember("loginqueue_eanbled", false, doc.GetAllocator());
doc.AddMember("identity", identity, doc.GetAllocator());
doc.AddMember("extra_data", extra_data, doc.GetAllocator());
rapidjson::Value value{};
doc.AddMember("lsg_endpoint", value, doc.GetAllocator());

View File

@ -4,7 +4,9 @@
#include <utils/nt.hpp>
#include <utils/io.hpp>
#include <utils/cryptography.hpp>
#include <utils/compression.hpp>
#include "resource.hpp"
#include "game/game.hpp"
namespace demonware
@ -13,13 +15,15 @@ namespace demonware
{
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(24, &bdStorage::upload_files);
this->register_task(16, &bdStorage::get_files);
this->register_task(12, &bdStorage::unk12);
this->register_task(10, &bdStorage::set_user_file);
//this->map_publisher_resource("motd-.*\\.txt", DW_MOTD);
// this->map_publisher_resource("ffotd-.*\\.ff", DW_FASTFILE);
//this->map_publisher_resource("playlists(_.+)?\\.aggr", DW_PLAYLISTS);
this->map_publisher_resource("motd-.*\\.gz", DW_MOTD);
this->map_publisher_resource("playlists(_.+)?\\.gz", DW_PLAYLISTS);
this->map_publisher_resource("featured_cards(.+)?\\.gz", DW_CARDS);
// this->map_publisher_resource(".*ffotd-.*\\.ff", DW_FASTFILE);
}
void bdStorage::map_publisher_resource(const std::string& expression, const INT id)
@ -53,6 +57,11 @@ namespace demonware
buffer = std::get<callback>(resource.second)();
}
if (utils::string::ends_with(name, ".gz"))
{
buffer = utils::compression::zlib::compress(buffer);
}
return true;
}
}
@ -128,12 +137,42 @@ namespace demonware
}
}
std::string bdStorage::get_user_file_path(const std::string& name)
void bdStorage::set_user_file(service_server* server, byte_buffer* buffer) const
{
return "players2/user/" + name;
bool priv;
uint64_t owner;
std::string game, filename, data;
buffer->read_string(&game);
buffer->read_string(&filename);
buffer->read_bool(&priv);
buffer->read_blob(&data);
buffer->read_uint64(&owner);
const auto path = get_user_file_path(filename);
utils::io::write_file(path, data);
auto* info = new bdFileInfo;
info->file_id = *reinterpret_cast<const uint64_t*>(utils::cryptography::sha1::compute(filename).data());
info->filename = filename;
info->create_time = uint32_t(time(nullptr));
info->modified_time = info->create_time;
info->file_size = uint32_t(data.size());
info->owner_id = owner;
info->priv = priv;
auto reply = server->create_reply(this->task_id());
reply->add(info);
reply->send();
}
void bdStorage::set_user_file(service_server* server, byte_buffer* buffer) const
std::string bdStorage::get_user_file_path(const std::string& name)
{
return "players/user/" + name;
}
void bdStorage::upload_files(service_server* server, byte_buffer* buffer) const
{
uint64_t owner;
uint32_t numfiles;
@ -181,7 +220,7 @@ namespace demonware
reply->send();
}
void bdStorage::get_user_file(service_server* server, byte_buffer* buffer) const
void bdStorage::get_files(service_server* server, byte_buffer* buffer) const
{
uint32_t unk32_0;
uint32_t numfiles, count = 0;
@ -207,7 +246,8 @@ namespace demonware
if (!utils::io::read_file(path, &data))
{
#ifndef NDEBUG
printf("[DW]: [bdStorage]: get user file: missing file: %s, %s, %s\n", game.data(), filename.data(), platform.data());
printf("[DW]: [bdStorage]: get user file: missing file: %s, %s, %s\n", game.data(), filename.data(),
platform.data());
#endif
continue;
}

View File

@ -19,7 +19,8 @@ namespace demonware
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 upload_files(service_server* server, byte_buffer* buffer) const;
void get_files(service_server* server, byte_buffer* buffer) const;
void unk12(service_server* server, byte_buffer* buffer) const;
static std::string get_user_file_path(const std::string& name);

View File

@ -16,6 +16,9 @@ namespace game
};
WEAK symbol<void(char* text, int maxSize)> Con_GetTextCopy{0x14133A7D0_g};
// Live
WEAK symbol<bool(uint64_t, int*, bool)> Live_GetConnectivityInformation{0x141E0C410_g};
// Sys
WEAK symbol<void()> Sys_ShowConsole{0x142333F80_g};
WEAK symbol<TLSData*()> Sys_GetTLS{0x142184210_g};

View File

@ -4,3 +4,8 @@
#define IMAGE_SPLASH 300
#define IMAGE_LOGO 301
#define DW_MOTD 302
#define DW_CARDS 303
#define DW_PLAYLISTS 304
#define DW_FASTFILE 305

View File

@ -95,6 +95,11 @@ END
IMAGE_SPLASH BITMAP "resources/splash.bmp"
IMAGE_LOGO BITMAP "resources/logo.bmp"
DW_MOTD RCDATA "resources/dw/experiments_tu32.gz"
DW_CARDS RCDATA "resources/dw/featured_cards-english_tu32.gz"
DW_PLAYLISTS RCDATA "resources/dw/playlists_tu32.gz"
//DW_FASTFILE RCDATA "resources/dw/en_core_ffotd_tu32_593.ff"
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,624 @@
{
"version": 1,
"enabled": true,
"usertype": 0,
"experiment_data":
[
{
"enabled": false,
"name": "sv_lootxp_rate",
"variants": [
{
"include_rate": 7000
}, {
"include_rate": 500
}, {
"include_rate": 500
}, {
"include_rate": 500
}, {
"include_rate": 500
}, {
"include_rate": 500
}, {
"include_rate": 500
}
]
}, {
"enabled": false,
"name": "cl_playlist_order",
"variants": [
{
"include_rate": 5000
}, {
"include_rate": 2500
}
]
}, {
"enabled": true,
"name": "jul_2017_sales",
"variants": [
{
"include_rate": 5000
}, {
"include_rate": 2000
}, {
"include_rate": 1000
}, {
"include_rate": 1000
}, {
"include_rate": 1000
}
]
}, {
"enabled": true,
"name": "jul_2017_small",
"variants": [
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
}
]
} , {
"enabled": false,
"name": "com_test_exp",
"variants": [
{
"include_rate": 500
}, {
"include_rate": 500
}, {
"include_rate": 500
}, {
"include_rate": 500
}, {
"include_rate": 500
}, {
"include_rate": 500
}, {
"include_rate": 500
}, {
"include_rate": 500
}, {
"include_rate": 500
}, {
"include_rate": 500
}, {
"include_rate": 500
}
]
} , {
"enabled": false,
"name": "chris_exp",
"variants": [
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
}
]
}, {
"enabled": false,
"name": "chris_variable_discount",
"variants": [
{
"include_rate": 2500
},
{
"include_rate": 2500
},
{
"include_rate": 2500
},
{
"include_rate": 2500
}
]
}, {
"enabled": false,
"name": "no_dupe_preview",
"variants": [
{
"include_rate": 5000
},
{
"include_rate": 5000
}
]
}, {
"enabled": false,
"name": "bonus_crypto",
"variants": [
{
"include_rate": 2500
},
{
"include_rate": 2500
},
{
"include_rate": 2500
},
{
"include_rate": 2500
}
]
}, {
"enabled": true,
"name": "threepack_exp",
"variants": [
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
}
]
},{
"enabled": true,
"name": "dec_2017_bribe",
"variants": [
{
"include_rate": 2000
},
{
"include_rate": 2000
},
{
"include_rate": 2000
},
{
"include_rate": 2000
},
{
"include_rate": 2000
}
]
},{
"enabled": true,
"name": "zm_PlayerMessage",
"variants": [
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
}
]
}, {
"enabled": true,
"name": "ui_purchase_experiment",
"variants": [
{
"include_rate": 5000
},
{
"include_rate": 5000
}
]
}, {
"enabled": true,
"name": "store_image_experiment",
"variants": [
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
}
]
}, {
"enabled": true,
"name": "igs_bonus_image_experiment",
"variants": [
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
}
]
},{
"enabled": true,
"name": "bundle_and_bribe_experiment",
"variants": [
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
}
]
},{
"enabled": true,
"name": "most_popular_banner_experiment",
"variants": [
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
},
{
"include_rate": 1000
}
]
},{
"enabled": true,
"name": "outfit_purchase_experiment",
"variants": [
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
},
{
"include_rate": 500
}
]
}
]
}

View File

@ -0,0 +1,48 @@
{
"version": 1,
"enabled": true,
"cards_count": 5,
"timer": 5000,
"data": [
{
"priority": "1",
"type": "crm",
"title": "TEMP TITLE",
"action_title": "Open",
"action": "opencrm",
"bg": "t7_store_featured_message"
},
{
"priority": "2",
"type": "crm",
"title": "TEMP TITLE",
"action_title": "Open",
"action": "opencrm",
"bg": "t7_store_featured_message"
},
{
"priority": "3",
"type": "crm",
"title": "TEMP TITLE",
"action_title": "Open",
"action": "opencrm",
"bg": "t7_store_featured_message"
},
{
"priority": "4",
"type": "crm",
"title": "TEMP TITLE",
"action_title": "Open",
"action": "opencrm",
"bg": "t7_store_featured_message"
},
{
"priority": "5",
"type": "motd",
"title": "MESSAGE OF THE DAY",
"action_title": "Open",
"action": "openmotd",
"bg": "t7_store_featured_message"
}
]
}

File diff suppressed because it is too large Load Diff

View File

@ -239,13 +239,14 @@ namespace utils::nt
std::string load_resource(const int id)
{
auto* const res = FindResource(library(), MAKEINTRESOURCE(id), RT_RCDATA);
const auto lib = library::get_by_address(load_resource);
auto* const res = FindResource(lib, MAKEINTRESOURCE(id), RT_RCDATA);
if (!res) return {};
auto* const handle = LoadResource(nullptr, res);
auto* const handle = LoadResource(lib, res);
if (!handle) return {};
return std::string(LPSTR(LockResource(handle)), SizeofResource(nullptr, res));
return std::string(LPSTR(LockResource(handle)), SizeofResource(lib, res));
}
void relaunch_self()