2022-06-02 04:14:44 -04:00
|
|
|
#include <std_include.hpp>
|
|
|
|
|
|
|
|
#include "game.hpp"
|
2022-11-11 11:19:26 -05:00
|
|
|
#include <utils/nt.hpp>
|
2022-06-02 07:49:43 -04:00
|
|
|
|
|
|
|
namespace game
|
|
|
|
{
|
2023-01-01 15:46:36 -05:00
|
|
|
namespace
|
2022-06-02 07:49:43 -04:00
|
|
|
{
|
2023-01-01 15:46:36 -05:00
|
|
|
const utils::nt::library& get_host_library()
|
2022-06-02 07:49:43 -04:00
|
|
|
{
|
2023-01-01 15:51:04 -05:00
|
|
|
static auto host_library = []
|
2022-06-02 07:49:43 -04:00
|
|
|
{
|
2023-01-01 15:46:36 -05:00
|
|
|
utils::nt::library host{};
|
|
|
|
if (!host || host == utils::nt::library::get_by_address(get_base))
|
|
|
|
{
|
|
|
|
throw std::runtime_error("Invalid host application");
|
|
|
|
}
|
|
|
|
|
|
|
|
return host;
|
|
|
|
}();
|
2023-01-01 15:51:04 -05:00
|
|
|
|
|
|
|
return host_library;
|
2023-01-01 15:46:36 -05:00
|
|
|
}
|
|
|
|
}
|
2022-10-28 16:16:14 -04:00
|
|
|
|
2023-01-01 15:46:36 -05:00
|
|
|
size_t get_base()
|
|
|
|
{
|
|
|
|
static auto base = reinterpret_cast<size_t>(get_host_library().get_ptr());
|
2022-11-11 11:19:26 -05:00
|
|
|
return base;
|
2022-10-28 16:16:14 -04:00
|
|
|
}
|
2023-01-01 15:46:36 -05:00
|
|
|
|
|
|
|
bool is_server()
|
|
|
|
{
|
|
|
|
static auto server = get_host_library().get_optional_header()->CheckSum == 0x14C28B4;
|
|
|
|
return server;
|
|
|
|
}
|
2022-06-02 07:49:43 -04:00
|
|
|
}
|