move wine check to utils [skip ci]
This commit is contained in:
parent
4029bc8a8e
commit
e24c5cf8b3
@ -111,19 +111,6 @@ namespace arxan
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_wine()
|
|
||||||
{
|
|
||||||
static std::optional<bool> is_wine = {};
|
|
||||||
|
|
||||||
if (!is_wine.has_value())
|
|
||||||
{
|
|
||||||
const utils::nt::library ntdll("ntdll.dll");
|
|
||||||
is_wine = ntdll.get_proc<void*>("wine_get_version") != nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return is_wine.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
class component final : public component_interface
|
class component final : public component_interface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
namespace arxan
|
|
||||||
{
|
|
||||||
bool is_wine();
|
|
||||||
}
|
|
@ -1,11 +1,11 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
#include "arxan.hpp"
|
|
||||||
#include "system_check.hpp"
|
#include "system_check.hpp"
|
||||||
|
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
|
|
||||||
|
#include <utils/nt.hpp>
|
||||||
#include <utils/io.hpp>
|
#include <utils/io.hpp>
|
||||||
#include <utils/cryptography.hpp>
|
#include <utils/cryptography.hpp>
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ namespace system_check
|
|||||||
void verify_binary_version()
|
void verify_binary_version()
|
||||||
{
|
{
|
||||||
const auto value = *reinterpret_cast<DWORD*>(0x1337_b);
|
const auto value = *reinterpret_cast<DWORD*>(0x1337_b);
|
||||||
if (!arxan::is_wine())
|
if (!utils::nt::is_wine())
|
||||||
{
|
{
|
||||||
if (value == 0x60202B6A || value == 0xBC0E9FE)
|
if (value == 0x60202B6A || value == 0xBC0E9FE)
|
||||||
{
|
{
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
#include "game/game.hpp"
|
#include "game/game.hpp"
|
||||||
|
|
||||||
#include "component/arxan.hpp"
|
|
||||||
|
|
||||||
#include <utils/flags.hpp>
|
#include <utils/flags.hpp>
|
||||||
#include <utils/io.hpp>
|
#include <utils/io.hpp>
|
||||||
#include <utils/string.hpp>
|
#include <utils/string.hpp>
|
||||||
@ -95,7 +93,7 @@ FARPROC load_binary(const launcher::mode mode, uint64_t* base_address)
|
|||||||
&& function != "SteamAPI_GetSteamInstallPath") // Arxan requires one valid steam api import - maybe SteamAPI_Shutdown is better?
|
&& function != "SteamAPI_GetSteamInstallPath") // Arxan requires one valid steam api import - maybe SteamAPI_Shutdown is better?
|
||||||
{
|
{
|
||||||
static bool check_for_steam_install = false;
|
static bool check_for_steam_install = false;
|
||||||
if (!check_for_steam_install && !arxan::is_wine())
|
if (!check_for_steam_install && !utils::nt::is_wine())
|
||||||
{
|
{
|
||||||
HKEY key;
|
HKEY key;
|
||||||
if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Valve\\Steam", 0, KEY_ALL_ACCESS, &key) == ERROR_SUCCESS)
|
if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Valve\\Steam", 0, KEY_ALL_ACCESS, &key) == ERROR_SUCCESS)
|
||||||
@ -208,7 +206,7 @@ int main()
|
|||||||
FARPROC entry_point;
|
FARPROC entry_point;
|
||||||
|
|
||||||
// leaving these for Windows only for now, need to test to see if we can have for Wine -mikey
|
// leaving these for Windows only for now, need to test to see if we can have for Wine -mikey
|
||||||
if (!arxan::is_wine())
|
if (!utils::nt::is_wine())
|
||||||
{
|
{
|
||||||
enable_dpi_awareness();
|
enable_dpi_awareness();
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "steam.hpp"
|
#include "steam.hpp"
|
||||||
|
|
||||||
#include "component/arxan.hpp"
|
|
||||||
#include "component/console.hpp"
|
#include "component/console.hpp"
|
||||||
|
|
||||||
#include <utils/nt.hpp>
|
#include <utils/nt.hpp>
|
||||||
@ -239,7 +238,7 @@ namespace steam
|
|||||||
// however, on [other] Wine [forks], this should be hit. also, the file dialog may not work.. :P
|
// however, on [other] Wine [forks], this should be hit. also, the file dialog may not work.. :P
|
||||||
HKEY steam_install_reg;
|
HKEY steam_install_reg;
|
||||||
|
|
||||||
if (arxan::is_wine())
|
if (::utils::nt::is_wine())
|
||||||
{
|
{
|
||||||
// let's check the registry to see if the user has already manually selected the Steam installation path
|
// let's check the registry to see if the user has already manually selected the Steam installation path
|
||||||
if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\h1-mod", 0, KEY_QUERY_VALUE, &steam_install_reg)
|
if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\h1-mod", 0, KEY_QUERY_VALUE, &steam_install_reg)
|
||||||
|
@ -206,6 +206,19 @@ namespace utils::nt
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_wine()
|
||||||
|
{
|
||||||
|
static std::optional<bool> is_wine = {};
|
||||||
|
|
||||||
|
if (!is_wine.has_value())
|
||||||
|
{
|
||||||
|
const utils::nt::library ntdll("ntdll.dll");
|
||||||
|
is_wine = ntdll.get_proc<void*>("wine_get_version") != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return is_wine.value();
|
||||||
|
}
|
||||||
|
|
||||||
void raise_hard_exception()
|
void raise_hard_exception()
|
||||||
{
|
{
|
||||||
int data = false;
|
int data = false;
|
||||||
|
@ -102,6 +102,8 @@ namespace utils::nt
|
|||||||
HMODULE module_;
|
HMODULE module_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool is_wine();
|
||||||
|
|
||||||
__declspec(noreturn) void raise_hard_exception();
|
__declspec(noreturn) void raise_hard_exception();
|
||||||
std::string load_resource(int id);
|
std::string load_resource(int id);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user