diff --git a/src/Components/Modules/Console.cpp b/src/Components/Modules/Console.cpp index 3da5039c..aa627c21 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"))) + if (!Monitor::IsEnabled() && !Flags::HasFlag("stdout") && (!Dedicated::IsEnabled() || Flags::HasFlag("console")) && !Loader::PerformingUnitTests()) { FreeConsole(); } @@ -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 + else if(!Loader::PerformingUnitTests()) { FreeConsole(); } diff --git a/src/Components/Modules/FastFiles.cpp b/src/Components/Modules/FastFiles.cpp index 96b8fa60..8d50114c 100644 --- a/src/Components/Modules/FastFiles.cpp +++ b/src/Components/Modules/FastFiles.cpp @@ -345,12 +345,10 @@ namespace Components { Logger::Error("The fastfile you are trying to load is outdated (%d, expected %d)", header[1], XFILE_VERSION_IW4X); } -#ifdef DEBUG else if (header[1] > XFILE_VERSION_IW4X) { - Logger::Error("You are loading a fastfile that is too new (%d, expected %d), how's that possible?", header[1], XFILE_VERSION_IW4X); + Logger::Error("You are loading a fastfile that is too new (%d, expected %d), update your game", header[1], XFILE_VERSION_IW4X); } -#endif *reinterpret_cast(header) = XFILE_MAGIC_UNSIGNED; } diff --git a/src/Steam/Interfaces/SteamUtils.cpp b/src/Steam/Interfaces/SteamUtils.cpp index e6eee89b..56bfee0d 100644 --- a/src/Steam/Interfaces/SteamUtils.cpp +++ b/src/Steam/Interfaces/SteamUtils.cpp @@ -6,12 +6,12 @@ namespace Steam { unsigned int Utils::GetSecondsSinceAppActive() { - return 0; + return Game::Sys_Milliseconds() / 1000; } unsigned int Utils::GetSecondsSinceComputerActive() { - return 0; + return timeGetTime(); } int Utils::GetConnectedUniverse() @@ -21,12 +21,10 @@ namespace Steam unsigned int Utils::GetServerRealTime() { - static ::std::optional timeDelta; - + static std::optional timeDelta; if(!timeDelta.has_value()) { unsigned int steamTime = static_cast(time(nullptr)); - if(Steam::Proxy::SteamUtils) { steamTime = Steam::Proxy::SteamUtils->GetServerRealTime(); @@ -40,6 +38,11 @@ namespace Steam const char* Utils::GetIPCountry() { + if (Steam::Proxy::SteamUtils) + { + return Steam::Proxy::SteamUtils->GetIPCountry(); + } + return "US"; } @@ -60,6 +63,11 @@ namespace Steam unsigned char Utils::GetCurrentBatteryPower() { + if (Steam::Proxy::SteamUtils) + { + return Steam::Proxy::SteamUtils->GetCurrentBatteryPower(); + } + return 255; } diff --git a/src/Utils/Cryptography.cpp b/src/Utils/Cryptography.cpp index 1850b854..9bc4443b 100644 --- a/src/Utils/Cryptography.cpp +++ b/src/Utils/Cryptography.cpp @@ -48,10 +48,8 @@ namespace Utils { ECC::Key key; - register_prng(&sprng_desc); - ltc_mp = ltm_desc; - + register_prng(&sprng_desc); ecc_make_key(nullptr, find_prng("sprng"), bits / 8, key.getKeyPtr()); return key; @@ -64,10 +62,8 @@ namespace Utils uint8_t buffer[512]; DWORD length = sizeof(buffer); - register_prng(&sprng_desc); - ltc_mp = ltm_desc; - + register_prng(&sprng_desc); ecc_sign_hash(reinterpret_cast(message.data()), message.size(), buffer, &length, nullptr, find_prng("sprng"), key.getKeyPtr()); return std::string(reinterpret_cast(buffer), length);