Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMakeLists.txt | 6 +-
- cmake/init-postproject.cmake | 6 +-
- tf2_bot_detector/CMakeLists.txt | 6 +-
- tf2_bot_detector/Platform/Windows/Windows.cpp | 184 +++++++++++++-------------
- 6 files changed, 101 insertions(+), 101 deletions(-)
- diff --git a/CMakeLists.txt b/CMakeLists.txt
- index 7b59f65..071d3d3 100644
- --- a/CMakeLists.txt
- +++ b/CMakeLists.txt
- @@ -23,9 +23,9 @@ add_subdirectory(submodules/imgui_desktop)
- add_subdirectory(tf2_bot_detector_common)
- -if (WIN32)
- - add_subdirectory(tf2_bot_detector_winrt)
- -endif()
- +# if (WIN32)
- + # add_subdirectory(tf2_bot_detector_winrt)
- +# endif()
- # add_subdirectory(tf2_bot_detector_updater)
- add_subdirectory(tf2_bot_detector)
- diff --git a/cmake/init-postproject.cmake b/cmake/init-postproject.cmake
- index 61c26aa..20ff395 100644
- --- a/cmake/init-postproject.cmake
- +++ b/cmake/init-postproject.cmake
- @@ -97,9 +97,9 @@ endif()
- if (WIN32)
- # Restrict ourselves to Windows 8.1 ("windows blue") API where possible
- add_compile_definitions(
- - NTDDI_VERSION=NTDDI_WINBLUE
- - WINVER=_WIN32_WINNT_WINBLUE
- - _WIN32_WINNT=_WIN32_WINNT_WINBLUE
- + NTDDI_VERSION=NTDDI_WIN7
- + WINVER=_WIN32_WINNT_WIN7
- + _WIN32_WINNT=_WIN32_WINNT_WIN7
- )
- add_compile_options("/FISdkddkver.h")
- diff --git a/tf2_bot_detector/CMakeLists.txt b/tf2_bot_detector/CMakeLists.txt
- index a7d8fe6..15f9d31 100644
- --- a/tf2_bot_detector/CMakeLists.txt
- +++ b/tf2_bot_detector/CMakeLists.txt
- @@ -215,9 +215,9 @@ if (TF2BD_ENABLE_DISCORD_INTEGRATION)
- endif()
- -if (WIN32)
- - INCLUDE_TF2BD_WINRT(tf2_bot_detector)
- -endif()
- +# if (WIN32)
- + # INCLUDE_TF2BD_WINRT(tf2_bot_detector)
- +# endif()
- find_package(nlohmann_json CONFIG REQUIRED)
- find_package(libzip CONFIG REQUIRED)
- diff --git a/tf2_bot_detector/Platform/Windows/Windows.cpp b/tf2_bot_detector/Platform/Windows/Windows.cpp
- index 5828d7f..263e5b3 100644
- --- a/tf2_bot_detector/Platform/Windows/Windows.cpp
- +++ b/tf2_bot_detector/Platform/Windows/Windows.cpp
- @@ -6,7 +6,7 @@
- #include "Util/TextUtils.h"
- #include "Log.h"
- #include "WindowsHelpers.h"
- -#include "tf2_bot_detector_winrt.h"
- +// #include "tf2_bot_detector_winrt.h"
- #include <mh/error/ensure.hpp>
- #include <mh/error/exception_details.hpp>
- @@ -39,20 +39,20 @@ static std::filesystem::path GetKnownFolderPath(const KNOWNFOLDERID& id)
- return retVal;
- }
- -static bool IsReallyWindows10OrGreater()
- -{
- - using RtlGetVersionFn = NTSTATUS(WINAPI*)(PRTL_OSVERSIONINFOW lpVersionInformation);
- +// static bool IsReallyWindows10OrGreater()
- +// {
- + // using RtlGetVersionFn = NTSTATUS(WINAPI*)(PRTL_OSVERSIONINFOW lpVersionInformation);
- - static const auto s_RtlGetVersionFn = reinterpret_cast<RtlGetVersionFn>(
- - tf2_bot_detector::Platform::GetProcAddressHelper("ntdll.dll", "RtlGetVersion", true));
- + // static const auto s_RtlGetVersionFn = reinterpret_cast<RtlGetVersionFn>(
- + // tf2_bot_detector::Platform::GetProcAddressHelper("ntdll.dll", "RtlGetVersion", true));
- - RTL_OSVERSIONINFOW info{};
- - info.dwOSVersionInfoSize = sizeof(info);
- - const auto result = s_RtlGetVersionFn(&info);
- - assert(result == STATUS_SUCCESS);
- + // RTL_OSVERSIONINFOW info{};
- + // info.dwOSVersionInfoSize = sizeof(info);
- + // const auto result = s_RtlGetVersionFn(&info);
- + // assert(result == STATUS_SUCCESS);
- - return info.dwMajorVersion >= 10;
- -}
- + // return info.dwMajorVersion >= 10;
- +// }
- static const tf2_bot_detector::WinRT* GetWinRTInterface()
- {
- @@ -60,28 +60,28 @@ static const tf2_bot_detector::WinRT* GetWinRTInterface()
- {
- WinRTHelper()
- {
- - constexpr char WINRT_DLL_NAME[] = "tf2_bot_detector_winrt.dll";
- - m_Module = mh_ensure(LoadLibraryA(WINRT_DLL_NAME));
- + // constexpr char WINRT_DLL_NAME[] = "tf2_bot_detector_winrt.dll";
- + // m_Module = mh_ensure(LoadLibraryA(WINRT_DLL_NAME));
- - CreateWinRTInterfaceFn func = reinterpret_cast<CreateWinRTInterfaceFn>(GetProcAddressHelper(WINRT_DLL_NAME, "CreateWinRTInterface"));
- + // CreateWinRTInterfaceFn func = reinterpret_cast<CreateWinRTInterfaceFn>(GetProcAddressHelper(WINRT_DLL_NAME, "CreateWinRTInterface"));
- - m_WinRT.reset(func());
- + // m_WinRT.reset(func());
- - struct DummyType {};
- - m_ExceptionDetailsHandler = mh::exception_details::add_handler(
- - typeid(DummyType), m_WinRT->GetWinRTExceptionDetailsHandler());
- - }
- - WinRTHelper(WinRTHelper&& other) noexcept :
- - m_Module(std::exchange(other.m_Module, nullptr)),
- - m_WinRT(std::move(other.m_WinRT))
- - {
- + // struct DummyType {};
- + // m_ExceptionDetailsHandler = mh::exception_details::add_handler(
- + // typeid(DummyType), m_WinRT->GetWinRTExceptionDetailsHandler());
- }
- + // WinRTHelper(WinRTHelper&& other) noexcept :
- + // m_Module(std::exchange(other.m_Module, nullptr)),
- + // m_WinRT(std::move(other.m_WinRT))
- + // {
- + // }
- WinRTHelper& operator=(WinRTHelper&& other) noexcept
- {
- - destroy();
- + // destroy();
- - m_Module = std::exchange(other.m_Module, nullptr);
- - m_WinRT = std::move(other.m_WinRT);
- + // m_Module = std::exchange(other.m_Module, nullptr);
- + // m_WinRT = std::move(other.m_WinRT);
- return *this;
- }
- @@ -92,27 +92,27 @@ static const tf2_bot_detector::WinRT* GetWinRTInterface()
- void destroy()
- {
- - m_WinRT.reset();
- + // m_WinRT.reset();
- - if (m_Module)
- - {
- - mh_ensure(FreeLibrary(m_Module));
- - m_Module = {};
- - }
- + // if (m_Module)
- + // {
- + // mh_ensure(FreeLibrary(m_Module));
- + // m_Module = {};
- + // }
- }
- - HMODULE m_Module{};
- - std::unique_ptr<WinRT> m_WinRT;
- - mh::exception_details::handler m_ExceptionDetailsHandler;
- + // HMODULE m_Module{};
- + // std::unique_ptr<WinRT> m_WinRT;
- + // mh::exception_details::handler m_ExceptionDetailsHandler;
- };
- static const tf2_bot_detector::WinRT* s_Value = []() -> const tf2_bot_detector::WinRT*
- {
- - if (IsReallyWindows10OrGreater())
- - {
- - static WinRTHelper s_Helper;
- - return s_Helper.m_WinRT.get();
- - }
- + // if (IsReallyWindows10OrGreater())
- + // {
- + // static WinRTHelper s_Helper;
- + // return s_Helper.m_WinRT.get();
- + // }
- return nullptr;
- }();
- @@ -137,75 +137,75 @@ std::filesystem::path tf2_bot_detector::Platform::GetCurrentExeDir()
- std::filesystem::path tf2_bot_detector::Platform::GetLegacyAppDataDir()
- {
- - if (auto winrt = GetWinRTInterface())
- - {
- - try
- - {
- - auto packageFamilyName = GetWinRTInterface()->GetCurrentPackageFamilyName();
- - if (packageFamilyName.empty())
- - return {};
- -
- - return GetKnownFolderPath(FOLDERID_LocalAppData) / "Packages" / packageFamilyName / "LocalCache" / "Roaming";
- - }
- - catch (...)
- - {
- - LogException();
- - }
- - }
- + // if (auto winrt = GetWinRTInterface())
- + // {
- + // try
- + // {
- + // auto packageFamilyName = GetWinRTInterface()->GetCurrentPackageFamilyName();
- + // if (packageFamilyName.empty())
- + // return {};
- +
- + // return GetKnownFolderPath(FOLDERID_LocalAppData) / "Packages" / packageFamilyName / "LocalCache" / "Roaming";
- + // }
- + // catch (...)
- + // {
- + // LogException();
- + // }
- + // }
- return {};
- }
- std::filesystem::path tf2_bot_detector::Platform::GetRootLocalAppDataDir()
- {
- - if (auto winrt = GetWinRTInterface())
- - {
- - try
- - {
- - if (winrt->IsInPackage())
- - return winrt->GetPackageLocalAppDataDir();
- - }
- - catch (...)
- - {
- - LogException();
- - }
- - }
- + // if (auto winrt = GetWinRTInterface())
- + // {
- + // try
- + // {
- + // if (winrt->IsInPackage())
- + // return winrt->GetPackageLocalAppDataDir();
- + // }
- + // catch (...)
- + // {
- + // LogException();
- + // }
- + // }
- return GetKnownFolderPath(FOLDERID_LocalAppData);
- }
- std::filesystem::path tf2_bot_detector::Platform::GetRootRoamingAppDataDir()
- {
- - if (auto winrt = GetWinRTInterface())
- - {
- - try
- - {
- - if (winrt->IsInPackage())
- - return winrt->GetPackageRoamingAppDataDir();
- - }
- - catch (...)
- - {
- - LogException();
- - }
- - }
- + // if (auto winrt = GetWinRTInterface())
- + // {
- + // try
- + // {
- + // if (winrt->IsInPackage())
- + // return winrt->GetPackageRoamingAppDataDir();
- + // }
- + // catch (...)
- + // {
- + // LogException();
- + // }
- + // }
- return GetKnownFolderPath(FOLDERID_RoamingAppData);
- }
- std::filesystem::path tf2_bot_detector::Platform::GetRootTempDataDir()
- {
- - if (auto winrt = GetWinRTInterface())
- - {
- - try
- - {
- - if (winrt->IsInPackage())
- - return winrt->GetPackageTempDir();
- - }
- - catch (...)
- - {
- - LogException();
- - }
- - }
- + // if (auto winrt = GetWinRTInterface())
- + // {
- + // try
- + // {
- + // if (winrt->IsInPackage())
- + // return winrt->GetPackageTempDir();
- + // }
- + // catch (...)
- + // {
- + // LogException();
- + // }
- + // }
- return std::filesystem::temp_directory_path();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement