Skip to content

Commit

Permalink
1.11 patch
Browse files Browse the repository at this point in the history
  • Loading branch information
maximegmd committed Jan 28, 2021
1 parent da1c706 commit 8ea5dbd
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/CET.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ static std::unique_ptr<CET> s_pInstance{ nullptr };

void CET::Initialize()
{
s_pInstance.reset(new (std::nothrow) CET);
s_pInstance.reset(new CET);
}

void CET::Shutdown()
Expand Down
3 changes: 3 additions & 0 deletions src/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ void Image::Initialize()
static uint8_t s_Guid105[] = { 0x93, 0x5B, 0x36, 0x35, 0xDF, 0xA8, 0xE7, 0x41, 0x91, 0x8A, 0x64, 0x64, 0xF7, 0xA4, 0xF0, 0x8E };
static uint8_t s_Guid106[] = { 0x67, 0xFB, 0x96, 0x6B, 0xAA, 0x3D, 0x57, 0x4E, 0x93, 0x8F, 0x1C, 0xC5, 0x85, 0xc6, 0xF5, 0x29 };
static uint8_t s_Guid110[] = { 0xE0, 0xC2, 0x94, 0x64, 0x5C, 0xB4, 0x32, 0x45, 0x95, 0x10, 0x09, 0xA1, 0x0F, 0xB2, 0x53, 0xF8 };
static uint8_t s_Guid111[] = { 0x8C, 0x13, 0x59, 0xA9, 0x7E, 0x6E, 0x49, 0x4F, 0x82, 0xF9, 0xCF, 0x58, 0x71, 0x6B, 0x7D, 0x3A };

mem::module mainModule = mem::module::main();

Expand Down Expand Up @@ -55,6 +56,8 @@ void Image::Initialize()
version = MakeVersion(1, 6);
else if (memcmp(&pdb_info->Guid, s_Guid110, 16) == 0)
version = MakeVersion(1, 10);
else if (memcmp(&pdb_info->Guid, s_Guid111, 16) == 0)
version = MakeVersion(1, 11);
else
{
for (auto c : pdb_info->Guid)
Expand Down
2 changes: 1 addition & 1 deletion src/Image.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ struct Image

static std::tuple<uint32_t, uint16_t> GetSupportedVersion() noexcept
{
return std::make_tuple(1, 10);
return std::make_tuple(1, 11);
}

static uint64_t MakeVersion(uint32_t aMajor, uint16_t aMinor) noexcept
Expand Down
10 changes: 10 additions & 0 deletions src/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,19 @@ Options::Options(Paths& aPaths)
spdlog::info("Root path: \"{}\"", aPaths.GameRoot().string());
spdlog::info("Cyber Engine Tweaks path: \"{}\"", aPaths.CETRoot().string());
spdlog::info("Lua scripts search path: \"{}\"", aPaths.ModsRoot().string());

if (GameImage.GetVersion() != GameImage.GetSupportedVersion())
{
spdlog::error("Unsupported game version! Only {}.{:02d} is supported.", major, minor);
throw std::runtime_error("Unsupported version");
}

}
else
{
spdlog::info("Unknown Game Version, update the mod");
throw std::runtime_error("Unknown version");
}

Load();

Expand Down
11 changes: 0 additions & 11 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@ static void Initialize()

const auto& options = CET::Get().GetOptions();

// check if we are hooked to valid process
if (!options.ExeValid)
return;

if (options.GameImage.GetVersion() != Image::GetSupportedVersion())
{
auto [major, minor] = Image::GetSupportedVersion();
spdlog::error("Unsupported game version! Only {}.{:02d} is supported.", major, minor);
return;
}

// single instance check
s_modInstanceMutex = CreateMutex(NULL, TRUE, _T("Cyber Engine Tweaks Module Instance"));
if (s_modInstanceMutex == nullptr)
Expand Down
2 changes: 1 addition & 1 deletion vendor/RED4ext.SDK

0 comments on commit 8ea5dbd

Please sign in to comment.