diff --git a/src/CET.cpp b/src/CET.cpp index 0d9eb3be..74d3b252 100644 --- a/src/CET.cpp +++ b/src/CET.cpp @@ -9,7 +9,7 @@ static std::unique_ptr s_pInstance{ nullptr }; void CET::Initialize() { - s_pInstance.reset(new (std::nothrow) CET); + s_pInstance.reset(new CET); } void CET::Shutdown() diff --git a/src/Image.cpp b/src/Image.cpp index 821b6166..e550ba81 100644 --- a/src/Image.cpp +++ b/src/Image.cpp @@ -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(); @@ -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) diff --git a/src/Image.h b/src/Image.h index 7cbb8f0a..87191812 100644 --- a/src/Image.h +++ b/src/Image.h @@ -6,7 +6,7 @@ struct Image static std::tuple 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 diff --git a/src/Options.cpp b/src/Options.cpp index 1983cf64..58969d53 100644 --- a/src/Options.cpp +++ b/src/Options.cpp @@ -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(); diff --git a/src/dllmain.cpp b/src/dllmain.cpp index 3885e65e..2b15c5fa 100644 --- a/src/dllmain.cpp +++ b/src/dllmain.cpp @@ -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) diff --git a/vendor/RED4ext.SDK b/vendor/RED4ext.SDK index 4556a26b..a9fe4dec 160000 --- a/vendor/RED4ext.SDK +++ b/vendor/RED4ext.SDK @@ -1 +1 @@ -Subproject commit 4556a26b6df9eb60e03db4190c1a04c00c3cdb3b +Subproject commit a9fe4decd9d247b4258dca6adebbd0b220c5f9fb