diff --git a/src/Components/Loader.cpp b/src/Components/Loader.cpp index cc3399a4..5f0d5c87 100644 --- a/src/Components/Loader.cpp +++ b/src/Components/Loader.cpp @@ -112,7 +112,7 @@ namespace Components for (auto component : Loader::Components) { #ifdef DEBUG - if (!Loader::PerformingUnitTests()) + if (!Loader::IsPerformingUnitTests()) { Logger::Print("Unregistering component: %s\n", component->getName().data()); } @@ -178,7 +178,7 @@ namespace Components return result; } - bool Loader::PerformingUnitTests() + bool Loader::IsPerformingUnitTests() { #if defined(DEBUG) || defined(FORCE_UNIT_TESTS) return Flags::HasFlag("tests"); @@ -192,7 +192,7 @@ namespace Components if (component) { #if defined(DEBUG) || defined(FORCE_UNIT_TESTS) - if (!Loader::PerformingUnitTests()) + if (!Loader::IsPerformingUnitTests()) { Logger::Print("Component registered: %s\n", component->getName().data()); } diff --git a/src/Components/Loader.hpp b/src/Components/Loader.hpp index cfcf6a69..076d6470 100644 --- a/src/Components/Loader.hpp +++ b/src/Components/Loader.hpp @@ -32,7 +32,7 @@ namespace Components static void PreDestroy(); static void PreDestroyNoPostGame(); static bool PerformUnitTests(); - static bool PerformingUnitTests(); + static bool IsPerformingUnitTests(); static void Register(Component* component); static bool IsPregame(); diff --git a/src/Components/Modules/Console.cpp b/src/Components/Modules/Console.cpp index aa627c21..a18eaa97 100644 --- a/src/Components/Modules/Console.cpp +++ b/src/Components/Modules/Console.cpp @@ -491,7 +491,7 @@ namespace Components void Console::FreeNativeConsole() { - if (!Monitor::IsEnabled() && !Flags::HasFlag("stdout") && (!Dedicated::IsEnabled() || Flags::HasFlag("console")) && !Loader::PerformingUnitTests()) + if (!Monitor::IsEnabled() && !Flags::HasFlag("stdout") && (!Dedicated::IsEnabled() || Flags::HasFlag("console")) && !Loader::IsPerformingUnitTests()) { FreeConsole(); } @@ -583,7 +583,7 @@ namespace Components } // Code below is not necessary when performing unit tests! - if (Loader::PerformingUnitTests()) return; + if (Loader::IsPerformingUnitTests()) return; // External console if (Flags::HasFlag("stdout") || Monitor::IsEnabled()) @@ -643,7 +643,7 @@ namespace Components Utils::Hook(0x43D570, Console::Error, HOOK_JUMP).install()->quick(); Utils::Hook(0x4859A5, Console::Input, HOOK_CALL).install()->quick(); } - else if(!Loader::PerformingUnitTests()) + else if(!Loader::IsPerformingUnitTests()) { FreeConsole(); } diff --git a/src/Components/Modules/IPCPipe.cpp b/src/Components/Modules/IPCPipe.cpp index 34eb4fef..9baef8f9 100644 --- a/src/Components/Modules/IPCPipe.cpp +++ b/src/Components/Modules/IPCPipe.cpp @@ -63,7 +63,7 @@ namespace Components if (INVALID_HANDLE_VALUE != this->pipe && this->pipe) { // Only create the thread, when not performing unit tests! - if (!Loader::PerformingUnitTests()) + if (!Loader::IsPerformingUnitTests()) { this->threadAttached = true; this->thread = std::thread(Pipe::ReceiveThread, this); @@ -204,7 +204,7 @@ namespace Components IPCPipe::IPCPipe() { - if (Dedicated::IsEnabled() || Monitor::IsEnabled() || Loader::PerformingUnitTests() || ZoneBuilder::IsEnabled()) return; + if (Dedicated::IsEnabled() || Monitor::IsEnabled() || Loader::IsPerformingUnitTests() || ZoneBuilder::IsEnabled()) return; // Server pipe IPCPipe::ServerPipe.onConnect(IPCPipe::ConnectClient); diff --git a/src/Components/Modules/Localization.cpp b/src/Components/Modules/Localization.cpp index 3f49f61e..c14053e6 100644 --- a/src/Components/Modules/Localization.cpp +++ b/src/Components/Modules/Localization.cpp @@ -287,7 +287,7 @@ namespace Components }); // #ifndef DISABLE_ANTICHEAT -// if (!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled() && !Utils::IsWineEnvironment() && !Loader::PerformingUnitTests()) +// if (!Dedicated::IsEnabled() && !ZoneBuilder::IsEnabled() && !Utils::IsWineEnvironment() && !Loader::IsPerformingUnitTests()) // { // AntiCheat::PatchVirtualProtect(VirtualProtect, VirtualProtectEx); // } diff --git a/src/Components/Modules/Logger.cpp b/src/Components/Modules/Logger.cpp index 7208c7a4..b1e3c619 100644 --- a/src/Components/Modules/Logger.cpp +++ b/src/Components/Modules/Logger.cpp @@ -29,7 +29,7 @@ namespace Components void Logger::MessagePrint(int channel, std::string message) { - if (Flags::HasFlag("stdout") || Loader::PerformingUnitTests()) + if (Flags::HasFlag("stdout") || Loader::IsPerformingUnitTests()) { printf("%s", message.data()); fflush(stdout); @@ -252,7 +252,7 @@ namespace Components Utils::Hook(0x4B0218, Logger::GameLogStub, HOOK_CALL).install()->quick(); Utils::Hook(Game::Com_PrintMessage, Logger::PrintMessageStub, HOOK_JUMP).install()->quick(); - if (Loader::PerformingUnitTests()) + if (Loader::IsPerformingUnitTests()) { Utils::Hook(Game::Com_Printf, Logger::PrintStub, HOOK_JUMP).install()->quick(); } diff --git a/src/Components/Modules/News.cpp b/src/Components/Modules/News.cpp index bb329a7b..298136db 100644 --- a/src/Components/Modules/News.cpp +++ b/src/Components/Modules/News.cpp @@ -235,7 +235,7 @@ namespace Components News::LaunchUpdater("-update -c"); }); - if (!Utils::IsWineEnvironment() && !Loader::PerformingUnitTests()) + if (!Utils::IsWineEnvironment() && !Loader::IsPerformingUnitTests()) { News::Terminate = false; News::Thread = std::thread([]() @@ -249,7 +249,7 @@ namespace Components Localization::Set("MPUI_MOTD_TEXT", data); } - if (!Loader::PerformingUnitTests() && !News::Terminate) + if (!Loader::IsPerformingUnitTests() && !News::Terminate) { News::GetLatestUpdater(); diff --git a/src/Components/Modules/Scheduler.cpp b/src/Components/Modules/Scheduler.cpp index 87642e54..51c4f4e1 100644 --- a/src/Components/Modules/Scheduler.cpp +++ b/src/Components/Modules/Scheduler.cpp @@ -117,7 +117,7 @@ namespace Components Utils::Hook(0x4D697A, Scheduler::ShutdownStub, HOOK_CALL).install()->quick(); - if (!Loader::PerformUnitTests()) + if (!Loader::IsPerformingUnitTests()) { Scheduler::AsyncTerminate = false; Scheduler::AsyncThread = std::thread([]() diff --git a/src/Components/Modules/Session.cpp b/src/Components/Modules/Session.cpp index 5d90762c..a8f4108f 100644 --- a/src/Components/Modules/Session.cpp +++ b/src/Components/Modules/Session.cpp @@ -117,7 +117,7 @@ namespace Components Session::SignatureKey = Utils::Cryptography::ECC::GenerateKey(512); //Scheduler::OnFrame(Session::RunFrame); - if (!Loader::PerformingUnitTests()) + if (!Loader::IsPerformingUnitTests()) { Session::Terminate = false; Session::Thread = std::thread([]() diff --git a/src/Components/Modules/Singleton.cpp b/src/Components/Modules/Singleton.cpp index 177807df..8ecae19d 100644 --- a/src/Components/Modules/Singleton.cpp +++ b/src/Components/Modules/Singleton.cpp @@ -20,7 +20,7 @@ namespace Components Console::FreeNativeConsole(); - if (Loader::PerformingUnitTests() || Dedicated::IsEnabled() || ZoneBuilder::IsEnabled() || Monitor::IsEnabled()) return; + if (Loader::IsPerformingUnitTests() || Dedicated::IsEnabled() || ZoneBuilder::IsEnabled() || Monitor::IsEnabled()) return; Singleton::FirstInstance = (CreateMutexA(nullptr, FALSE, "iw4x_mutex") && GetLastError() != ERROR_ALREADY_EXISTS); diff --git a/src/Main.cpp b/src/Main.cpp index fa6dfa0d..feecc890 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -9,7 +9,7 @@ namespace Main Components::Loader::Initialize(); #if defined(DEBUG) || defined(FORCE_UNIT_TESTS) - if (Components::Loader::PerformingUnitTests()) + if (Components::Loader::IsPerformingUnitTests()) { DWORD result = (Components::Loader::PerformUnitTests() ? 0 : -1); Components::Loader::Uninitialize();