From f8256687206d7604c2ac756ed7e2281dda1a9be0 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sat, 4 Mar 2023 13:42:56 +0100 Subject: [PATCH] Detect steam update --- src/client/game/game.cpp | 12 ++++++++++++ src/client/game/game.hpp | 2 ++ src/client/main.cpp | 10 ++++++++++ 3 files changed, 24 insertions(+) diff --git a/src/client/game/game.cpp b/src/client/game/game.cpp index 0fb8f24a..bcd52d81 100644 --- a/src/client/game/game.cpp +++ b/src/client/game/game.cpp @@ -37,6 +37,18 @@ namespace game 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() { static const auto appdata_path = [] diff --git a/src/client/game/game.hpp b/src/client/game/game.hpp index 2a825538..6c48470f 100644 --- a/src/client/game/game.hpp +++ b/src/client/game/game.hpp @@ -7,6 +7,8 @@ namespace game { size_t get_base(); bool is_server(); + bool is_client(); + bool is_legacy_client(); inline size_t relocate(const size_t val) { diff --git a/src/client/main.cpp b/src/client/main.cpp index 23b3f708..cd04cf9f 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -314,6 +314,16 @@ namespace 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(); if (!component_loader::post_load())