Wine compatibility and patches (#219)

Co-authored-by: Skull <86374920+skkuull@users.noreply.github.com>
This commit is contained in:
m
2022-09-02 21:54:39 -05:00
committed by GitHub
parent 170b912597
commit 99e047a8c9
6 changed files with 185 additions and 22 deletions

View File

@ -3,6 +3,8 @@
#include "scheduler.hpp"
#include "game/game.hpp"
#include "arxan.hpp"
#include <utils/hook.hpp>
namespace arxan
@ -108,6 +110,22 @@ namespace arxan
}
}
bool is_wine()
{
static bool is_wine = false;
static bool is_wine_set = false;
if (!is_wine_set)
{
const utils::nt::library ntdll("ntdll.dll");
is_wine = ntdll.get_proc<void*>("wine_get_version") != nullptr;
is_wine_set = true;
}
return is_wine;
}
class component final : public component_interface
{
public:
@ -137,9 +155,12 @@ namespace arxan
void post_unpack() override
{
// cba to implement sp, not sure if it's even needed
if (game::environment::is_sp()) return;
if (game::environment::is_sp())
{
return;
}
}
};
}
REGISTER_COMPONENT(arxan::component)
REGISTER_COMPONENT(arxan::component)

View File

@ -0,0 +1,6 @@
#pragma once
namespace arxan
{
bool is_wine();
}

View File

@ -3,6 +3,8 @@
#include "steam_proxy.hpp"
#include "scheduler.hpp"
#include "arxan.hpp"
#include <utils/nt.hpp>
#include <utils/flags.hpp>
#include <utils/string.hpp>
@ -102,7 +104,10 @@ namespace steam_proxy
void load_client()
{
const std::filesystem::path steam_path = steam::SteamAPI_GetSteamInstallPath();
if (steam_path.empty()) return;
if (steam_path.empty())
{
return;
}
utils::nt::library::load(steam_path / "tier0_s64.dll");
utils::nt::library::load(steam_path / "vstdlib_s64.dll");

View File

@ -1,6 +1,7 @@
#include <std_include.hpp>
#include "loader/component_loader.hpp"
#include "system_check.hpp"
#include "arxan.hpp"
#include "game/game.hpp"
@ -64,14 +65,26 @@ namespace system_check
return verify_hashes(mp_zone_hashes) && (game::environment::is_dedi() || verify_hashes(sp_zone_hashes));
}
// need to update these values
void verify_binary_version()
{
const auto value = *reinterpret_cast<DWORD*>(0x1337_b);
if (value != 0x60202B6A && value != 0xBC0E9FE)
if (arxan::is_wine())
{
throw std::runtime_error("Unsupported Call of Duty: Modern Warfare Remastered version (1.15)");
if (value != 0xFFB81262 && value != 0xFFB81143)
{
return;
}
}
else
{
if (value != 0x60202B6A && value != 0xBC0E9FE)
{
return;
}
}
throw std::runtime_error("Unsupported Call of Duty: Modern Warfare Remastered version (1.15)");
}
}