Detect steam update

This commit is contained in:
momo5502 2023-03-04 13:42:56 +01:00
parent b8505abef1
commit f825668720
3 changed files with 24 additions and 0 deletions

View File

@ -37,6 +37,18 @@ namespace game
return server; return server;
} }
bool is_client()
{
static const auto server = get_host_library().get_optional_header()->CheckSum == 0x888C368;
return server;
}
bool is_legacy_client()
{
static const auto server = get_host_library().get_optional_header()->CheckSum == 0x8880704;
return server;
}
std::filesystem::path get_appdata_path() std::filesystem::path get_appdata_path()
{ {
static const auto appdata_path = [] static const auto appdata_path = []

View File

@ -7,6 +7,8 @@ namespace game
{ {
size_t get_base(); size_t get_base();
bool is_server(); bool is_server();
bool is_client();
bool is_legacy_client();
inline size_t relocate(const size_t val) inline size_t relocate(const size_t val)
{ {

View File

@ -314,6 +314,16 @@ namespace
throw std::runtime_error("Bad binary loaded into memory"); throw std::runtime_error("Bad binary loaded into memory");
} }
if (!is_server && !game::is_legacy_client())
{
if(game::is_client())
{
throw std::runtime_error("You are running the latest Steam update. We're working on supporting it. For the time being, however, you have to revert to the old binary.");
}
throw std::runtime_error("Bad binary loaded into memory");
}
patch_imports(); patch_imports();
if (!component_loader::post_load()) if (!component_loader::post_load())